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

Side by Side Diff: ash/devtools/ash_devtools_dom_agent.h

Issue 2903173002: Closing simulation window in chromeos sessions causes crash. (Closed)
Patch Set: use std::unique_ptr for window_element_root_. 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
« no previous file with comments | « no previous file | ash/devtools/ash_devtools_dom_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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_
OLDNEW
« no previous file with comments | « no previous file | ash/devtools/ash_devtools_dom_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698