Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 5 #ifndef ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| 6 #define ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 6 #define ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| 7 | 7 |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window_observer.h" | 9 #include "ash/common/wm_window_observer.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 class ASH_EXPORT AshDevToolsDOMAgent | 30 class ASH_EXPORT AshDevToolsDOMAgent |
| 31 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< | 31 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< |
| 32 ui::devtools::protocol::DOM::Metainfo>), | 32 ui::devtools::protocol::DOM::Metainfo>), |
| 33 public WmWindowObserver, | 33 public WmWindowObserver, |
| 34 public views::WidgetObserver, | 34 public views::WidgetObserver, |
| 35 public views::WidgetRemovalsObserver, | 35 public views::WidgetRemovalsObserver, |
| 36 public views::ViewObserver { | 36 public views::ViewObserver { |
| 37 public: | 37 public: |
| 38 explicit AshDevToolsDOMAgent(ash::WmShell* shell); | 38 explicit AshDevToolsDOMAgent( |
|
sadrul
2016/12/06 20:48:59
You don't need explicit anymore.
Sarmad Hashmi
2016/12/06 22:54:34
Done.
| |
| 39 ash::WmShell* shell, | |
| 40 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner); | |
| 39 ~AshDevToolsDOMAgent() override; | 41 ~AshDevToolsDOMAgent() override; |
| 40 | 42 |
| 41 // DOM::Backend | 43 // DOM::Backend |
| 42 ui::devtools::protocol::Response disable() override; | 44 ui::devtools::protocol::Response disable() override; |
| 43 ui::devtools::protocol::Response getDocument( | 45 ui::devtools::protocol::Response getDocument( |
| 44 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; | 46 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; |
| 47 ui::devtools::protocol::Response highlightNode( | |
| 48 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> | |
| 49 highlight_config, | |
| 50 ui::devtools::protocol::Maybe<int> node_id) override; | |
| 51 ui::devtools::protocol::Response hideHighlight() override; | |
| 45 | 52 |
| 46 // WindowObserver | 53 // WindowObserver |
| 47 void OnWindowTreeChanging(WmWindow* window, | 54 void OnWindowTreeChanging(WmWindow* window, |
| 48 const TreeChangeParams& params) override; | 55 const TreeChangeParams& params) override; |
| 49 void OnWindowTreeChanged(WmWindow* window, | 56 void OnWindowTreeChanged(WmWindow* window, |
| 50 const TreeChangeParams& params) override; | 57 const TreeChangeParams& params) override; |
| 51 void OnWindowStackingChanged(WmWindow* window) override; | 58 void OnWindowStackingChanged(WmWindow* window) override; |
| 52 void OnWindowBoundsChanged(WmWindow* window, | 59 void OnWindowBoundsChanged(WmWindow* window, |
| 53 const gfx::Rect& old_bounds, | 60 const gfx::Rect& old_bounds, |
| 54 const gfx::Rect& new_bounds) override; | 61 const gfx::Rect& new_bounds) override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 void RemoveWidgetNode(views::Widget* widget, bool remove_observer); | 107 void RemoveWidgetNode(views::Widget* widget, bool remove_observer); |
| 101 | 108 |
| 102 void AddViewTree(views::View* view); | 109 void AddViewTree(views::View* view); |
| 103 void RemoveViewTree(views::View* view, | 110 void RemoveViewTree(views::View* view, |
| 104 views::View* parent, | 111 views::View* parent, |
| 105 bool remove_observer); | 112 bool remove_observer); |
| 106 void RemoveViewNode(views::View* view, | 113 void RemoveViewNode(views::View* view, |
| 107 views::View* parent, | 114 views::View* parent, |
| 108 bool remove_observer); | 115 bool remove_observer); |
| 109 | 116 |
| 117 void DestroyHighlightingWidget(); | |
| 110 void RemoveObservers(); | 118 void RemoveObservers(); |
| 111 void Reset(); | 119 void Reset(); |
| 112 | 120 |
| 121 using WindowAndBoundsPair = std::pair<WmWindow*, gfx::Rect>; | |
| 122 WindowAndBoundsPair GetNodeWindowAndBounds(int node_id); | |
| 123 void InitializeHighlightingWidget(); | |
| 124 void UpdateHighlight(std::pair<WmWindow*, gfx::Rect>, | |
|
sadrul
2016/12/06 20:48:59
const WindowAndBoundsPair&
Sarmad Hashmi
2016/12/06 22:54:34
Done.
| |
| 125 SkColor background, | |
| 126 SkColor border); | |
| 127 void HighlightNode( | |
| 128 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> | |
| 129 highlight_config, | |
| 130 int node_id); | |
| 131 bool IsHighlightingWindow(WmWindow* window); | |
| 132 | |
| 133 std::unique_ptr<views::Widget> widget_for_highlighting_; | |
| 134 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | |
| 113 ash::WmShell* shell_; | 135 ash::WmShell* shell_; |
| 114 | 136 |
| 115 using WindowToNodeIdMap = std::unordered_map<WmWindow*, int>; | 137 using WindowToNodeIdMap = std::unordered_map<WmWindow*, int>; |
| 116 WindowToNodeIdMap window_to_node_id_map_; | 138 WindowToNodeIdMap window_to_node_id_map_; |
| 117 using NodeIdToWindowMap = std::unordered_map<int, WmWindow*>; | 139 using NodeIdToWindowMap = std::unordered_map<int, WmWindow*>; |
| 118 NodeIdToWindowMap node_id_to_window_map_; | 140 NodeIdToWindowMap node_id_to_window_map_; |
| 119 | 141 |
| 120 using WidgetToNodeIdMap = std::unordered_map<views::Widget*, int>; | 142 using WidgetToNodeIdMap = std::unordered_map<views::Widget*, int>; |
| 121 WidgetToNodeIdMap widget_to_node_id_map_; | 143 WidgetToNodeIdMap widget_to_node_id_map_; |
| 122 using NodeIdToWidgetMap = std::unordered_map<int, views::Widget*>; | 144 using NodeIdToWidgetMap = std::unordered_map<int, views::Widget*>; |
| 123 NodeIdToWidgetMap node_id_to_widget_map_; | 145 NodeIdToWidgetMap node_id_to_widget_map_; |
| 124 | 146 |
| 125 using ViewToNodeIdMap = std::unordered_map<views::View*, int>; | 147 using ViewToNodeIdMap = std::unordered_map<views::View*, int>; |
| 126 ViewToNodeIdMap view_to_node_id_map_; | 148 ViewToNodeIdMap view_to_node_id_map_; |
| 127 using NodeIdToViewMap = std::unordered_map<int, views::View*>; | 149 using NodeIdToViewMap = std::unordered_map<int, views::View*>; |
| 128 NodeIdToViewMap node_id_to_view_map_; | 150 NodeIdToViewMap node_id_to_view_map_; |
| 129 | 151 |
| 130 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; | 152 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; |
| 131 | 153 |
| 132 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); | 154 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); |
| 133 }; | 155 }; |
| 134 | 156 |
| 135 } // namespace devtools | 157 } // namespace devtools |
| 136 } // namespace ash | 158 } // namespace ash |
| 137 | 159 |
| 138 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 160 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| OLD | NEW |