dom_agent_aura.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_UI_DEVTOOLS_VIEWS_DOM_AGENT_AURA_H_
  5. #define COMPONENTS_UI_DEVTOOLS_VIEWS_DOM_AGENT_AURA_H_
  6. #include "components/ui_devtools/views/dom_agent_views.h"
  7. #include "ui/aura/env_observer.h"
  8. #include "ui/aura/window_observer.h"
  9. namespace aura {
  10. class Window;
  11. } // namespace aura
  12. namespace ui_devtools {
  13. class DOMAgentAura : public DOMAgentViews,
  14. public aura::EnvObserver,
  15. public aura::WindowObserver {
  16. public:
  17. DOMAgentAura();
  18. DOMAgentAura(const DOMAgentAura&) = delete;
  19. DOMAgentAura& operator=(const DOMAgentAura&) = delete;
  20. ~DOMAgentAura() override;
  21. static DOMAgentAura* GetInstance() { return dom_agent_aura_; }
  22. // DOMAgent
  23. std::vector<UIElement*> CreateChildrenForRoot() override;
  24. // aura::EnvObserver:
  25. void OnWindowInitialized(aura::Window* window) override {}
  26. void OnHostInitialized(aura::WindowTreeHost* host) override;
  27. // aura::WindowObserver:
  28. void OnWindowDestroying(aura::Window* window) override;
  29. std::unique_ptr<protocol::DOM::Node> BuildTreeForWindow(
  30. UIElement* window_element_root) override;
  31. private:
  32. static DOMAgentAura* dom_agent_aura_;
  33. std::vector<aura::Window*> roots_;
  34. };
  35. } // namespace ui_devtools
  36. #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_DOM_AGENT_AURA_H_