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

Unified Diff: ui/aura/env.cc

Issue 2714763002: Change FocusSynchronizer to maintain active focus client and window. (Closed)
Patch Set: test Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/env_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 9436b2be50f4a95bc40322d8bef9a0a43b4b202c..115f7e5f18809bec56953dc354c0659d54fff79e 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -9,7 +9,6 @@
#include "base/memory/ptr_util.h"
#include "base/threading/thread_local.h"
#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/client/focus_client.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/input_state_lookup.h"
#include "ui/aura/mus/mus_types.h"
@@ -17,7 +16,6 @@
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
#include "ui/aura/window_port_local.h"
#include "ui/events/event_target_iterator.h"
#include "ui/events/platform/platform_event_source.h"
@@ -42,36 +40,6 @@ bool RunningInsideMus() {
} // namespace
-// Observes destruction and changes of the FocusClient for a window.
-// ActiveFocusClientWindowObserver is created for the window the FocusClient is
-// associated with.
-class Env::ActiveFocusClientWindowObserver : public WindowObserver {
- public:
- explicit ActiveFocusClientWindowObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~ActiveFocusClientWindowObserver() override { window_->RemoveObserver(this); }
-
- // WindowObserver:
- void OnWindowDestroying(Window* window) override {
- Env::GetInstance()->OnActiveFocusClientWindowDestroying();
- }
- void OnWindowPropertyChanged(Window* window,
- const void* key,
- intptr_t old) override {
- if (key != client::kFocusClientKey)
- return;
-
- // Assume if the focus client changes the window is being destroyed.
- Env::GetInstance()->OnActiveFocusClientWindowDestroying();
- }
-
- private:
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(ActiveFocusClientWindowObserver);
-};
-
////////////////////////////////////////////////////////////////////////////////
// Env, public:
@@ -162,24 +130,6 @@ void Env::SetWindowTreeClient(WindowTreeClient* window_tree_client) {
window_tree_client_ = window_tree_client;
}
-void Env::SetActiveFocusClient(client::FocusClient* focus_client,
- Window* focus_client_root) {
- if (focus_client == active_focus_client_ &&
- focus_client_root == active_focus_client_root_) {
- return;
- }
-
- active_focus_client_window_observer_.reset();
- active_focus_client_ = focus_client;
- active_focus_client_root_ = focus_client_root;
- if (focus_client_root) {
- active_focus_client_window_observer_ =
- base::MakeUnique<ActiveFocusClientWindowObserver>(focus_client_root);
- }
- for (EnvObserver& observer : observers_)
- observer.OnActiveFocusClientChanged(focus_client, focus_client_root);
-}
-
////////////////////////////////////////////////////////////////////////////////
// Env, private:
@@ -233,10 +183,6 @@ void Env::NotifyHostActivated(WindowTreeHost* host) {
observer.OnHostActivated(host);
}
-void Env::OnActiveFocusClientWindowDestroying() {
- SetActiveFocusClient(nullptr, nullptr);
-}
-
////////////////////////////////////////////////////////////////////////////////
// Env, ui::EventTarget implementation:
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/env_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698