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..8d6437c3160a1cc35b7484b73e391d214f27ad34 100644 |
--- a/ash/devtools/ash_devtools_dom_agent.cc |
+++ b/ash/devtools/ash_devtools_dom_agent.cc |
@@ -9,12 +9,13 @@ |
#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 +117,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 +213,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 +231,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 +345,11 @@ 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); |
+ params.parent = nullptr; |
+ if (!root_windows().empty()) { |
sadrul
2017/05/23 17:32:47
Can you DCHECK() here? i.e. can we ever reach here
thanhph
2017/05/24 15:15:21
Done.
|
+ params.parent = |
+ root_windows()[0]->GetChildById(kShellWindowId_OverlayContainer); |
sadrul
2017/05/23 17:32:47
Can you just use the root-window itself as the par
thanhph
2017/05/24 15:15:21
Done.
|
+ } |
params.keep_on_top = true; |
params.accept_events = false; |
widget_for_highlighting_->Init(params); |