Chromium Code Reviews| Index: ash/devtools/ash_devtools_dom_agent.cc |
| diff --git a/ash/devtools/ash_devtools_dom_agent.cc b/ash/devtools/ash_devtools_dom_agent.cc |
| index 24cac7f5ed0a1044d6839c703690e0e2a9ae3560..4b476785ffcfcae42c9c9b58946b435eb251e30a 100644 |
| --- a/ash/devtools/ash_devtools_dom_agent.cc |
| +++ b/ash/devtools/ash_devtools_dom_agent.cc |
| @@ -8,13 +8,13 @@ |
| #include "ash/devtools/view_element.h" |
| #include "ash/devtools/widget_element.h" |
| #include "ash/devtools/window_element.h" |
| -#include "ash/public/cpp/shell_window_ids.h" |
| -#include "ash/root_window_controller.h" |
| -#include "ash/shell.h" |
| #include "components/ui_devtools/devtools_server.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| +#include "ui/aura/env.h" |
| #include "ui/aura/window.h" |
| +#include "ui/aura/window_tree_host.h" |
| #include "ui/display/display.h" |
| +#include "ui/display/screen.h" |
| #include "ui/views/background.h" |
| #include "ui/views/border.h" |
| #include "ui/views/view.h" |
| @@ -116,9 +116,12 @@ std::unique_ptr<DOM::Node> BuildDomNodeFromUIElement(UIElement* root) { |
| } // namespace |
| -AshDevToolsDOMAgent::AshDevToolsDOMAgent() : is_building_tree_(false) {} |
| +AshDevToolsDOMAgent::AshDevToolsDOMAgent() : is_building_tree_(false) { |
| + aura::Env::GetInstance()->AddObserver(this); |
| +} |
| AshDevToolsDOMAgent::~AshDevToolsDOMAgent() { |
| + aura::Env::GetInstance()->RemoveObserver(this); |
| Reset(); |
| } |
| @@ -209,6 +212,10 @@ UIElement* AshDevToolsDOMAgent::GetElementFromNodeId(int node_id) { |
| return node_id_to_ui_element_[node_id]; |
| } |
| +void AshDevToolsDOMAgent::OnHostInitialized(aura::WindowTreeHost* host) { |
| + root_windows_.push_back(host->window()); |
| +} |
| + |
| void AshDevToolsDOMAgent::OnNodeBoundsChanged(int node_id) { |
| for (auto& observer : observers_) |
| observer.OnNodeBoundsChanged(node_id); |
| @@ -223,7 +230,7 @@ AshDevToolsDOMAgent::BuildInitialTree() { |
| // but maybe a new different element type. |
| window_element_root_ = new WindowElement(nullptr, this, nullptr); |
| - for (aura::Window* window : Shell::GetAllRootWindows()) { |
| + for (aura::Window* window : root_windows()) { |
| UIElement* window_element = |
| new WindowElement(window, this, window_element_root_); |
| @@ -337,10 +344,8 @@ void AshDevToolsDOMAgent::InitializeHighlightingWidget() { |
| params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| params.opacity = views::Widget::InitParams::WindowOpacity::TRANSLUCENT_WINDOW; |
| params.name = "HighlightingWidget"; |
| - Shell::GetPrimaryRootWindowController() |
| - ->ConfigureWidgetInitParamsForContainer(widget_for_highlighting_.get(), |
| - kShellWindowId_OverlayContainer, |
| - ¶ms); |
| + DCHECK(root_windows().size()); |
| + params.parent = root_windows()[0]; |
|
sadrul
2017/05/25 04:21:03
Add a TODO here that we would want to find the cor
thanhph
2017/05/28 00:04:25
We don't need this anymore.
|
| params.keep_on_top = true; |
| params.accept_events = false; |
| widget_for_highlighting_->Init(params); |