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

Side by Side Diff: ash/common/devtools/ash_devtools_dom_agent.cc

Issue 2483653002: Update ash DOM agent so that widgets are direct children of windows (Closed)
Patch Set: Update ash DOM agent so that widgets are direct children of windows Created 4 years, 1 month 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/common/devtools/ash_devtools_unittest.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 #include "ash/common/devtools/ash_devtools_dom_agent.h" 5 #include "ash/common/devtools/ash_devtools_dom_agent.h"
6 6
7 #include "ash/common/wm_window.h" 7 #include "ash/common/wm_window.h"
8 #include "components/ui_devtools/devtools_server.h" 8 #include "components/ui_devtools/devtools_server.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void AshDevToolsDOMAgent::OnWindowStackingChanged(WmWindow* window) { 124 void AshDevToolsDOMAgent::OnWindowStackingChanged(WmWindow* window) {
125 RemoveWindowNode(window, window->GetParent()); 125 RemoveWindowNode(window, window->GetParent());
126 AddWindowNode(window); 126 AddWindowNode(window);
127 } 127 }
128 128
129 std::unique_ptr<DOM::Node> AshDevToolsDOMAgent::BuildTreeForWindow( 129 std::unique_ptr<DOM::Node> AshDevToolsDOMAgent::BuildTreeForWindow(
130 ash::WmWindow* window) { 130 ash::WmWindow* window) {
131 std::unique_ptr<Array<DOM::Node>> children = Array<DOM::Node>::create(); 131 std::unique_ptr<Array<DOM::Node>> children = Array<DOM::Node>::create();
132 views::Widget* widget = window->GetInternalWidget();
133 if (widget)
134 children->addItem(BuildTreeForRootWidget(widget));
132 for (ash::WmWindow* child : window->GetChildren()) { 135 for (ash::WmWindow* child : window->GetChildren()) {
133 children->addItem(BuildTreeForWindow(child)); 136 children->addItem(BuildTreeForWindow(child));
134 views::Widget* widget = child->GetInternalWidget();
135 if (widget)
136 children->addItem(BuildTreeForRootWidget(widget));
137 } 137 }
138 std::unique_ptr<ui::devtools::protocol::DOM::Node> node = 138 std::unique_ptr<ui::devtools::protocol::DOM::Node> node =
139 BuildNode("Window", GetAttributes(window), std::move(children)); 139 BuildNode("Window", GetAttributes(window), std::move(children));
140 // Only add as observer if window is not in map 140 // Only add as observer if window is not in map
141 if (!window_to_node_id_map_.count(window)) 141 if (!window_to_node_id_map_.count(window))
142 window->AddObserver(this); 142 window->AddObserver(this);
143 window_to_node_id_map_[window] = node->getNodeId(); 143 window_to_node_id_map_[window] = node->getNodeId();
144 return node; 144 return node;
145 } 145 }
146 146
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 void AshDevToolsDOMAgent::Reset() { 182 void AshDevToolsDOMAgent::Reset() {
183 RemoveObserverFromAllWindows(); 183 RemoveObserverFromAllWindows();
184 window_to_node_id_map_.clear(); 184 window_to_node_id_map_.clear();
185 node_ids = 1; 185 node_ids = 1;
186 } 186 }
187 187
188 } // namespace devtools 188 } // namespace devtools
189 } // namespace ash 189 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/devtools/ash_devtools_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698