Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: components/ui_devtools/devtools/ui_devtools_dom_agent.h

Issue 2852733002: Duplicate -Move DevTools out of ash and turn it to a component. (Closed)
Patch Set: move unittest to ui/views Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_UI_DEVTOOLS_DOM_AGENT_H_
6 #define ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_UI_DEVTOOLS_DOM_AGENT_H_
7 7
8 #include "ash/ash_export.h"
9 #include "ash/devtools/ui_element_delegate.h"
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "components/ui_devtools/DOM.h" 9 #include "components/ui_devtools/DOM.h"
10 #include "components/ui_devtools/devtools/ui_element_delegate.h"
12 #include "components/ui_devtools/devtools_base_agent.h" 11 #include "components/ui_devtools/devtools_base_agent.h"
13 #include "ui/aura/env_observer.h" 12 #include "ui/aura/env_observer.h"
14 #include "ui/views/view.h" 13 #include "ui/views/view.h"
15 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
16 15
17 namespace aura { 16 namespace aura {
18 class Window; 17 class Window;
19 } 18 }
20 19
21 namespace ash { 20 namespace ui {
22 namespace devtools { 21 namespace devtools {
23 22
24 class UIElement; 23 class UIElement;
25 24
26 class ASH_EXPORT AshDevToolsDOMAgentObserver { 25 class UIDevToolsDOMAgentObserver {
27 public: 26 public:
28 virtual void OnNodeBoundsChanged(int node_id) = 0; 27 virtual void OnNodeBoundsChanged(int node_id) = 0;
29 }; 28 };
30 29
31 class ASH_EXPORT AshDevToolsDOMAgent 30 class UIDevToolsDOMAgent
32 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< 31 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent<
33 ui::devtools::protocol::DOM::Metainfo>), 32 ui::devtools::protocol::DOM::Metainfo>),
34 public UIElementDelegate, 33 public UIElementDelegate,
35 public aura::EnvObserver { 34 public aura::EnvObserver {
36 public: 35 public:
37 AshDevToolsDOMAgent(); 36 UIDevToolsDOMAgent();
38 ~AshDevToolsDOMAgent() override; 37 ~UIDevToolsDOMAgent() override;
39 38
40 // DOM::Backend: 39 // DOM::Backend:
41 ui::devtools::protocol::Response disable() override; 40 ui::devtools::protocol::Response disable() override;
42 ui::devtools::protocol::Response getDocument( 41 ui::devtools::protocol::Response getDocument(
43 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; 42 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override;
44 ui::devtools::protocol::Response highlightNode( 43 ui::devtools::protocol::Response highlightNode(
45 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> 44 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig>
46 highlight_config, 45 highlight_config,
47 ui::devtools::protocol::Maybe<int> node_id) override; 46 ui::devtools::protocol::Maybe<int> node_id) override;
48 ui::devtools::protocol::Response hideHighlight() override; 47 ui::devtools::protocol::Response hideHighlight() override;
49 48
50 // UIElementDelegate: 49 // UIElementDelegate:
51 void OnUIElementAdded(UIElement* parent, UIElement* child) override; 50 void OnUIElementAdded(UIElement* parent, UIElement* child) override;
52 void OnUIElementReordered(UIElement* parent, UIElement* child) override; 51 void OnUIElementReordered(UIElement* parent, UIElement* child) override;
53 void OnUIElementRemoved(UIElement* ui_element) override; 52 void OnUIElementRemoved(UIElement* ui_element) override;
54 void OnUIElementBoundsChanged(UIElement* ui_element) override; 53 void OnUIElementBoundsChanged(UIElement* ui_element) override;
55 bool IsHighlightingWindow(aura::Window* window) override; 54 bool IsHighlightingWindow(aura::Window* window) override;
56 55
57 void AddObserver(AshDevToolsDOMAgentObserver* observer); 56 void AddObserver(UIDevToolsDOMAgentObserver* observer);
58 void RemoveObserver(AshDevToolsDOMAgentObserver* observer); 57 void RemoveObserver(UIDevToolsDOMAgentObserver* observer);
59 UIElement* GetElementFromNodeId(int node_id); 58 UIElement* GetElementFromNodeId(int node_id);
60 UIElement* window_element_root() const { return window_element_root_; }; 59 UIElement* window_element_root() const { return window_element_root_; };
61 const std::vector<aura::Window*>& root_windows() const { 60 const std::vector<aura::Window*>& root_windows() const {
62 return root_windows_; 61 return root_windows_;
63 }; 62 };
64 63
65 private: 64 private:
66 // EnvObserver: 65 // EnvObserver:
67 void OnHostInitialized(aura::WindowTreeHost* host) override; 66 void OnHostInitialized(aura::WindowTreeHost* host) override;
68 void OnWindowInitialized(aura::Window* window) override{}; 67 void OnWindowInitialized(aura::Window* window) override{};
69 68
70 // AshDevToolsDOMAgentObserver: 69 // UIDevToolsDOMAgentObserver:
71 void OnNodeBoundsChanged(int node_id); 70 void OnNodeBoundsChanged(int node_id);
72 71
73 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); 72 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree();
74 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForUIElement( 73 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForUIElement(
75 UIElement* ui_element); 74 UIElement* ui_element);
76 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow( 75 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow(
77 UIElement* window_element_root, 76 UIElement* window_element_root,
78 aura::Window* window); 77 aura::Window* window);
79 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForRootWidget( 78 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForRootWidget(
80 UIElement* widget_element, 79 UIElement* widget_element,
(...skipping 11 matching lines...) Expand all
92 ui::devtools::protocol::Response HighlightNode( 91 ui::devtools::protocol::Response HighlightNode(
93 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> 92 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig>
94 highlight_config, 93 highlight_config,
95 int node_id); 94 int node_id);
96 95
97 bool is_building_tree_; 96 bool is_building_tree_;
98 UIElement* window_element_root_; 97 UIElement* window_element_root_;
99 std::unordered_map<int, UIElement*> node_id_to_ui_element_; 98 std::unordered_map<int, UIElement*> node_id_to_ui_element_;
100 std::unique_ptr<views::Widget> widget_for_highlighting_; 99 std::unique_ptr<views::Widget> widget_for_highlighting_;
101 std::vector<aura::Window*> root_windows_; 100 std::vector<aura::Window*> root_windows_;
102 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; 101 base::ObserverList<UIDevToolsDOMAgentObserver> observers_;
103 102
104 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); 103 DISALLOW_COPY_AND_ASSIGN(UIDevToolsDOMAgent);
105 }; 104 };
106 105
107 } // namespace devtools 106 } // namespace devtools
108 } // namespace ash 107 } // namespace ui
109 108
110 #endif // ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 109 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_UI_DEVTOOLS_DOM_AGENT_H_
OLDNEW
« no previous file with comments | « components/ui_devtools/devtools/ui_devtools_css_agent.cc ('k') | components/ui_devtools/devtools/ui_devtools_dom_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698