| 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 AshDevToolsDOMAgent(ash::WmShell* shell); |
| 39 ~AshDevToolsDOMAgent() override; | 39 ~AshDevToolsDOMAgent() override; |
| 40 | 40 |
| 41 // DOM::Backend | 41 // DOM::Backend |
| 42 ui::devtools::protocol::Response disable() override; | 42 ui::devtools::protocol::Response disable() override; |
| 43 ui::devtools::protocol::Response getDocument( | 43 ui::devtools::protocol::Response getDocument( |
| 44 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; | 44 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; |
| 45 ui::devtools::protocol::Response highlightNode( |
| 46 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> |
| 47 highlight_config, |
| 48 ui::devtools::protocol::Maybe<int> node_id) override; |
| 49 ui::devtools::protocol::Response hideHighlight() override; |
| 45 | 50 |
| 46 // WindowObserver | 51 // WindowObserver |
| 47 void OnWindowTreeChanging(WmWindow* window, | 52 void OnWindowTreeChanging(WmWindow* window, |
| 48 const TreeChangeParams& params) override; | 53 const TreeChangeParams& params) override; |
| 49 void OnWindowTreeChanged(WmWindow* window, | 54 void OnWindowTreeChanged(WmWindow* window, |
| 50 const TreeChangeParams& params) override; | 55 const TreeChangeParams& params) override; |
| 51 void OnWindowStackingChanged(WmWindow* window) override; | 56 void OnWindowStackingChanged(WmWindow* window) override; |
| 52 void OnWindowBoundsChanged(WmWindow* window, | 57 void OnWindowBoundsChanged(WmWindow* window, |
| 53 const gfx::Rect& old_bounds, | 58 const gfx::Rect& old_bounds, |
| 54 const gfx::Rect& new_bounds) override; | 59 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); | 105 void RemoveWidgetNode(views::Widget* widget, bool remove_observer); |
| 101 | 106 |
| 102 void AddViewTree(views::View* view); | 107 void AddViewTree(views::View* view); |
| 103 void RemoveViewTree(views::View* view, | 108 void RemoveViewTree(views::View* view, |
| 104 views::View* parent, | 109 views::View* parent, |
| 105 bool remove_observer); | 110 bool remove_observer); |
| 106 void RemoveViewNode(views::View* view, | 111 void RemoveViewNode(views::View* view, |
| 107 views::View* parent, | 112 views::View* parent, |
| 108 bool remove_observer); | 113 bool remove_observer); |
| 109 | 114 |
| 115 void DestroyHighlightingWidget(); |
| 110 void RemoveObservers(); | 116 void RemoveObservers(); |
| 111 void Reset(); | 117 void Reset(); |
| 112 | 118 |
| 119 using WindowAndBoundsPair = std::pair<WmWindow*, gfx::Rect>; |
| 120 WindowAndBoundsPair GetNodeWindowAndBounds(int node_id); |
| 121 void InitializeHighlightingWidget(); |
| 122 void UpdateHighlight(const WindowAndBoundsPair& window_and_bounds, |
| 123 SkColor background, |
| 124 SkColor border); |
| 125 ui::devtools::protocol::Response HighlightNode( |
| 126 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> |
| 127 highlight_config, |
| 128 int node_id); |
| 129 bool IsHighlightingWindow(WmWindow* window); |
| 130 |
| 131 std::unique_ptr<views::Widget> widget_for_highlighting_; |
| 113 ash::WmShell* shell_; | 132 ash::WmShell* shell_; |
| 114 | 133 |
| 115 using WindowToNodeIdMap = std::unordered_map<WmWindow*, int>; | 134 using WindowToNodeIdMap = std::unordered_map<WmWindow*, int>; |
| 116 WindowToNodeIdMap window_to_node_id_map_; | 135 WindowToNodeIdMap window_to_node_id_map_; |
| 117 using NodeIdToWindowMap = std::unordered_map<int, WmWindow*>; | 136 using NodeIdToWindowMap = std::unordered_map<int, WmWindow*>; |
| 118 NodeIdToWindowMap node_id_to_window_map_; | 137 NodeIdToWindowMap node_id_to_window_map_; |
| 119 | 138 |
| 120 using WidgetToNodeIdMap = std::unordered_map<views::Widget*, int>; | 139 using WidgetToNodeIdMap = std::unordered_map<views::Widget*, int>; |
| 121 WidgetToNodeIdMap widget_to_node_id_map_; | 140 WidgetToNodeIdMap widget_to_node_id_map_; |
| 122 using NodeIdToWidgetMap = std::unordered_map<int, views::Widget*>; | 141 using NodeIdToWidgetMap = std::unordered_map<int, views::Widget*>; |
| 123 NodeIdToWidgetMap node_id_to_widget_map_; | 142 NodeIdToWidgetMap node_id_to_widget_map_; |
| 124 | 143 |
| 125 using ViewToNodeIdMap = std::unordered_map<views::View*, int>; | 144 using ViewToNodeIdMap = std::unordered_map<views::View*, int>; |
| 126 ViewToNodeIdMap view_to_node_id_map_; | 145 ViewToNodeIdMap view_to_node_id_map_; |
| 127 using NodeIdToViewMap = std::unordered_map<int, views::View*>; | 146 using NodeIdToViewMap = std::unordered_map<int, views::View*>; |
| 128 NodeIdToViewMap node_id_to_view_map_; | 147 NodeIdToViewMap node_id_to_view_map_; |
| 129 | 148 |
| 130 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; | 149 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; |
| 131 | 150 |
| 132 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); | 151 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); |
| 133 }; | 152 }; |
| 134 | 153 |
| 135 } // namespace devtools | 154 } // namespace devtools |
| 136 } // namespace ash | 155 } // namespace ash |
| 137 | 156 |
| 138 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 157 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| OLD | NEW |