| 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_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 5 #ifndef ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| 6 #define ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 6 #define ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/devtools/ui_element_delegate.h" | 9 #include "ash/devtools/ui_element_delegate.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // UIElementDelegate: | 49 // UIElementDelegate: |
| 50 void OnUIElementAdded(UIElement* parent, UIElement* child) override; | 50 void OnUIElementAdded(UIElement* parent, UIElement* child) override; |
| 51 void OnUIElementReordered(UIElement* parent, UIElement* child) override; | 51 void OnUIElementReordered(UIElement* parent, UIElement* child) override; |
| 52 void OnUIElementRemoved(UIElement* ui_element) override; | 52 void OnUIElementRemoved(UIElement* ui_element) override; |
| 53 void OnUIElementBoundsChanged(UIElement* ui_element) override; | 53 void OnUIElementBoundsChanged(UIElement* ui_element) override; |
| 54 bool IsHighlightingWindow(aura::Window* window) override; | 54 bool IsHighlightingWindow(aura::Window* window) override; |
| 55 | 55 |
| 56 void AddObserver(AshDevToolsDOMAgentObserver* observer); | 56 void AddObserver(AshDevToolsDOMAgentObserver* observer); |
| 57 void RemoveObserver(AshDevToolsDOMAgentObserver* observer); | 57 void RemoveObserver(AshDevToolsDOMAgentObserver* observer); |
| 58 UIElement* GetElementFromNodeId(int node_id); | 58 UIElement* GetElementFromNodeId(int node_id); |
| 59 UIElement* window_element_root() const { return window_element_root_; }; | 59 UIElement* window_element_root() const { return window_element_root_.get(); }; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 void OnNodeBoundsChanged(int node_id); | 62 void OnNodeBoundsChanged(int node_id); |
| 63 | 63 |
| 64 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); | 64 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); |
| 65 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForUIElement( | 65 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForUIElement( |
| 66 UIElement* ui_element); | 66 UIElement* ui_element); |
| 67 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow( | 67 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow( |
| 68 UIElement* window_element_root, | 68 UIElement* window_element_root, |
| 69 aura::Window* window); | 69 aura::Window* window); |
| 70 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForRootWidget( | 70 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForRootWidget( |
| 71 UIElement* widget_element, | 71 UIElement* widget_element, |
| 72 views::Widget* widget); | 72 views::Widget* widget); |
| 73 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForView( | 73 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForView( |
| 74 UIElement* view_element, | 74 UIElement* view_element, |
| 75 views::View* view); | 75 views::View* view); |
| 76 void RemoveDomNode(UIElement* ui_element); | 76 void RemoveDomNode(UIElement* ui_element); |
| 77 void Reset(); | 77 void Reset(); |
| 78 void InitializeHighlightingWidget(); | 78 void InitializeHighlightingWidget(); |
| 79 void UpdateHighlight( | 79 void UpdateHighlight( |
| 80 const std::pair<aura::Window*, gfx::Rect>& window_and_bounds, | 80 const std::pair<aura::Window*, gfx::Rect>& window_and_bounds, |
| 81 SkColor background, | 81 SkColor background, |
| 82 SkColor border); | 82 SkColor border); |
| 83 ui::devtools::protocol::Response HighlightNode( | 83 ui::devtools::protocol::Response HighlightNode( |
| 84 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> | 84 std::unique_ptr<ui::devtools::protocol::DOM::HighlightConfig> |
| 85 highlight_config, | 85 highlight_config, |
| 86 int node_id); | 86 int node_id); |
| 87 | 87 |
| 88 bool is_building_tree_; | 88 bool is_building_tree_; |
| 89 UIElement* window_element_root_; | 89 std::unique_ptr<UIElement> window_element_root_; |
| 90 std::unordered_map<int, UIElement*> node_id_to_ui_element_; | 90 std::unordered_map<int, UIElement*> node_id_to_ui_element_; |
| 91 std::unique_ptr<views::Widget> widget_for_highlighting_; | 91 std::unique_ptr<views::Widget> widget_for_highlighting_; |
| 92 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; | 92 base::ObserverList<AshDevToolsDOMAgentObserver> observers_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); | 94 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace devtools | 97 } // namespace devtools |
| 98 } // namespace ash | 98 } // namespace ash |
| 99 | 99 |
| 100 #endif // ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ | 100 #endif // ASH_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ |
| OLD | NEW |