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

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

Issue 2899783002: Move DevTools out of ash and turn it to a component. (Closed)
Patch Set: NON_EXPORTED_BASE base class Created 3 years, 6 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_VIEWS_UI_DEVTOOLS_DOM_AGENT_H_
6 #define ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 6 #define COMPONENTS_UI_DEVTOOLS_VIEWS_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"
11 #include "components/ui_devtools/DOM.h" 8 #include "components/ui_devtools/DOM.h"
12 #include "components/ui_devtools/devtools_base_agent.h" 9 #include "components/ui_devtools/devtools_base_agent.h"
10 #include "components/ui_devtools/views/ui_element_delegate.h"
13 #include "ui/aura/env_observer.h" 11 #include "ui/aura/env_observer.h"
14 #include "ui/views/view.h" 12 #include "ui/views/view.h"
15 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
16 14
17 namespace aura { 15 namespace aura {
18 class Window; 16 class Window;
19 } 17 }
20 18
21 namespace ash { 19 namespace ui {
22 namespace devtools { 20 namespace devtools {
23 21
24 class UIElement; 22 class UIElement;
25 23
26 class ASH_EXPORT AshDevToolsDOMAgentObserver { 24 class UIDevToolsDOMAgentObserver {
27 public: 25 public:
28 // TODO(thanhph): Use UIElement* as input argument instead. 26 // TODO(thanhph): Use UIElement* as input argument instead.
29 virtual void OnNodeBoundsChanged(int node_id) = 0; 27 virtual void OnNodeBoundsChanged(int node_id) = 0;
30 }; 28 };
31 29
32 class ASH_EXPORT AshDevToolsDOMAgent 30 class UIDevToolsDOMAgent
33 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< 31 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent<
sadrul 2017/06/14 03:25:57 You should not need NON_EXPORTED_BASE.
thanhph 2017/06/14 15:26:37 Done.
34 ui::devtools::protocol::DOM::Metainfo>), 32 ui::devtools::protocol::DOM::Metainfo>),
35 public UIElementDelegate, 33 public UIElementDelegate,
36 public aura::EnvObserver { 34 public aura::EnvObserver {
37 public: 35 public:
38 AshDevToolsDOMAgent(); 36 UIDevToolsDOMAgent();
39 ~AshDevToolsDOMAgent() override; 37 ~UIDevToolsDOMAgent() override;
40 38
41 // DOM::Backend: 39 // DOM::Backend:
42 ui::devtools::protocol::Response disable() override; 40 ui::devtools::protocol::Response disable() override;
43 ui::devtools::protocol::Response getDocument( 41 ui::devtools::protocol::Response getDocument(
44 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; 42 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override;
45 ui::devtools::protocol::Response highlightNode( 43 ui::devtools::protocol::Response highlightNode(
46 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> 44 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig>
47 highlight_config, 45 highlight_config,
48 ui::devtools::protocol::Maybe<int> node_id) override; 46 ui::devtools::protocol::Maybe<int> node_id) override;
49 ui::devtools::protocol::Response hideHighlight() override; 47 ui::devtools::protocol::Response hideHighlight() override;
50 48
51 // UIElementDelegate: 49 // UIElementDelegate:
52 void OnUIElementAdded(UIElement* parent, UIElement* child) override; 50 void OnUIElementAdded(UIElement* parent, UIElement* child) override;
53 void OnUIElementReordered(UIElement* parent, UIElement* child) override; 51 void OnUIElementReordered(UIElement* parent, UIElement* child) override;
54 void OnUIElementRemoved(UIElement* ui_element) override; 52 void OnUIElementRemoved(UIElement* ui_element) override;
55 void OnUIElementBoundsChanged(UIElement* ui_element) override; 53 void OnUIElementBoundsChanged(UIElement* ui_element) override;
56 bool IsHighlightingWindow(aura::Window* window) override; 54 bool IsHighlightingWindow(aura::Window* window) override;
57 55
58 void AddObserver(AshDevToolsDOMAgentObserver* observer); 56 void AddObserver(UIDevToolsDOMAgentObserver* observer);
59 void RemoveObserver(AshDevToolsDOMAgentObserver* observer); 57 void RemoveObserver(UIDevToolsDOMAgentObserver* observer);
60 UIElement* GetElementFromNodeId(int node_id); 58 UIElement* GetElementFromNodeId(int node_id);
61 UIElement* window_element_root() const { return window_element_root_.get(); }; 59 UIElement* window_element_root() const { return window_element_root_.get(); };
62 const std::vector<aura::Window*>& root_windows() const { 60 const std::vector<aura::Window*>& root_windows() const {
63 return root_windows_; 61 return root_windows_;
64 }; 62 };
65 63
66 private: 64 private:
67 // aura::EnvObserver: 65 // aura::EnvObserver:
68 void OnWindowInitialized(aura::Window* window) override {} 66 void OnWindowInitialized(aura::Window* window) override {}
69 void OnHostInitialized(aura::WindowTreeHost* host) override; 67 void OnHostInitialized(aura::WindowTreeHost* host) override;
(...skipping 21 matching lines...) Expand all
91 ui::devtools::protocol::Response HighlightNode( 89 ui::devtools::protocol::Response HighlightNode(
92 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> 90 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig>
93 highlight_config, 91 highlight_config,
94 int node_id); 92 int node_id);
95 93
96 bool is_building_tree_; 94 bool is_building_tree_;
97 std::unique_ptr<UIElement> window_element_root_; 95 std::unique_ptr<UIElement> window_element_root_;
98 std::unordered_map<int, UIElement*> node_id_to_ui_element_; 96 std::unordered_map<int, UIElement*> node_id_to_ui_element_;
99 std::unique_ptr<views::Widget> widget_for_highlighting_; 97 std::unique_ptr<views::Widget> widget_for_highlighting_;
100 std::vector<aura::Window*> root_windows_; 98 std::vector<aura::Window*> root_windows_;
101 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; 99 base::ObserverList<UIDevToolsDOMAgentObserver> observers_;
102 100
103 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); 101 DISALLOW_COPY_AND_ASSIGN(UIDevToolsDOMAgent);
104 }; 102 };
105 103
106 } // namespace devtools 104 } // namespace devtools
107 } // namespace ash 105 } // namespace ui
108 106
109 #endif // ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 107 #endif // COMPONENTS_UI_DEVTOOLS_VIEWS_UI_DEVTOOLS_DOM_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698