Commit 76623b6a authored by Jun Mukai's avatar Jun Mukai Committed by Commit Bot

Remove the use of aura::Window::env() from components/ui_devtools

Bug: 958467
Test: trybot
Change-Id: I10b01e432d6f2301931852b31f6ef76412f4e933
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614685Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Jun Mukai <mukai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660553}
parent 70a88c23
......@@ -17,8 +17,6 @@
#if defined(USE_AURA)
#include "components/ui_devtools/views/dom_agent_aura.h"
#include "components/ui_devtools/views/overlay_agent_aura.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#endif
namespace ui_devtools {
......@@ -44,8 +42,6 @@ std::unique_ptr<UiDevToolsServer> CreateUiDevToolsServerForViews(
#if defined(USE_AURA)
void RegisterAdditionalRootWindowsAndEnv(std::vector<aura::Window*> roots) {
DCHECK(!roots.empty());
OverlayAgentAura::GetInstance()->RegisterEnv(roots[0]->env());
DOMAgentAura::GetInstance()->RegisterEnv(roots[0]->env());
for (auto* root : roots)
DOMAgentAura::GetInstance()->RegisterRootWindow(root);
}
......
......@@ -23,21 +23,15 @@ DOMAgentAura* DOMAgentAura::dom_agent_aura_ = nullptr;
DOMAgentAura::DOMAgentAura() {
DCHECK(!dom_agent_aura_);
dom_agent_aura_ = this;
RegisterEnv(aura::Env::GetInstance());
aura::Env::GetInstance()->AddObserver(this);
}
DOMAgentAura::~DOMAgentAura() {
for (aura::Window* window : roots_)
window->RemoveObserver(this);
for (auto* env : envs_)
env->RemoveObserver(this);
aura::Env::GetInstance()->RemoveObserver(this);
dom_agent_aura_ = nullptr;
}
void DOMAgentAura::RegisterEnv(aura::Env* env) {
envs_.push_back(env);
env->AddObserver(this);
}
void DOMAgentAura::RegisterRootWindow(aura::Window* root) {
roots_.push_back(root);
root->AddObserver(this);
......
......@@ -11,7 +11,6 @@
#include "ui/aura/window_observer.h"
namespace aura {
class Env;
class Window;
} // namespace aura
......@@ -25,7 +24,6 @@ class DOMAgentAura : public DOMAgentViews,
~DOMAgentAura() override;
static DOMAgentAura* GetInstance() { return dom_agent_aura_; }
void RegisterEnv(aura::Env* env);
void RegisterRootWindow(aura::Window* root);
// DOMAgent
......@@ -44,7 +42,6 @@ class DOMAgentAura : public DOMAgentViews,
private:
static DOMAgentAura* dom_agent_aura_;
std::vector<aura::Env*> envs_;
std::vector<aura::Window*> roots_;
DISALLOW_COPY_AND_ASSIGN(DOMAgentAura);
......
......@@ -17,7 +17,6 @@ OverlayAgentAura* OverlayAgentAura::overlay_agent_aura_ = nullptr;
OverlayAgentAura::OverlayAgentAura(DOMAgent* dom_agent)
: OverlayAgentViews(dom_agent) {
DCHECK(!overlay_agent_aura_);
RegisterEnv(aura::Env::GetInstance());
overlay_agent_aura_ = this;
}
......@@ -25,18 +24,13 @@ OverlayAgentAura::~OverlayAgentAura() {
overlay_agent_aura_ = nullptr;
}
void OverlayAgentAura::RegisterEnv(aura::Env* env) {
envs_.push_back(env);
}
void OverlayAgentAura::InstallPreTargetHandler() {
for (auto* env : envs_)
env->AddPreTargetHandler(this, ui::EventTarget::Priority::kSystem);
aura::Env::GetInstance()->AddPreTargetHandler(
this, ui::EventTarget::Priority::kSystem);
}
void OverlayAgentAura::RemovePreTargetHandler() {
for (auto* env : envs_)
env->RemovePreTargetHandler(this);
aura::Env::GetInstance()->RemovePreTargetHandler(this);
}
int OverlayAgentAura::FindElementIdTargetedByPoint(
......
......@@ -30,7 +30,6 @@ class OverlayAgentAura : public OverlayAgentViews {
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightWindow);
FRIEND_TEST_ALL_PREFIXES(OverlayAgentTest, HighlightEmptyOrInvisibleWindow);
std::vector<aura::Env*> envs_;
static OverlayAgentAura* overlay_agent_aura_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment