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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus.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/views/mus/desktop_window_tree_host_mus.h ('k') | ui/views/mus/desktop_window_tree_host_mus_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/desktop_window_tree_host_mus.cc
diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc
index c5a677a40ca0811f84957db15681829173cc25e2..805504b11e088c7029f6df10be823f13de63a0c0 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -14,8 +14,9 @@
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/transient_window_client.h"
-#include "ui/aura/env.h"
+#include "ui/aura/mus/focus_synchronizer.h"
#include "ui/aura/mus/window_port_mus.h"
+#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
@@ -193,8 +194,9 @@ DesktopWindowTreeHostMus::DesktopWindowTreeHostMus(
native_widget_delegate_(native_widget_delegate),
desktop_native_widget_aura_(desktop_native_widget_aura),
close_widget_factory_(this) {
- aura::Env::GetInstance()->AddObserver(this);
MusClient::Get()->AddObserver(this);
+ MusClient::Get()->window_tree_client()->focus_synchronizer()->AddObserver(
+ this);
native_widget_delegate_->AsWidget()->AddObserver(this);
desktop_native_widget_aura_->content_window()->AddObserver(this);
// DesktopNativeWidgetAura registers the association between |content_window_|
@@ -214,7 +216,8 @@ DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() {
desktop_native_widget_aura_->content_window()->RemoveObserver(this);
native_widget_delegate_->AsWidget()->RemoveObserver(this);
MusClient::Get()->RemoveObserver(this);
- aura::Env::GetInstance()->RemoveObserver(this);
+ MusClient::Get()->window_tree_client()->focus_synchronizer()->RemoveObserver(
+ this);
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
}
@@ -531,8 +534,10 @@ void DesktopWindowTreeHostMus::Activate() {
// This should result in OnActiveFocusClientChanged() being called, which
// triggers a call to DesktopNativeWidgetAura::HandleActivationChanged(),
// which focuses the right window.
- aura::Env::GetInstance()->SetActiveFocusClient(
- aura::client::GetFocusClient(window()), window());
+ MusClient::Get()
+ ->window_tree_client()
+ ->focus_synchronizer()
+ ->SetActiveFocusClient(aura::client::GetFocusClient(window()), window());
if (is_active_)
window()->SetProperty(aura::client::kDrawAttentionKey, false);
}
@@ -737,6 +742,16 @@ void DesktopWindowTreeHostMus::OnWidgetActivationChanged(Widget* widget,
is_active_ = active;
}
+void DesktopWindowTreeHostMus::OnActiveFocusClientChanged(
+ aura::client::FocusClient* focus_client,
+ aura::Window* focus_client_root) {
+ if (focus_client_root == this->window()) {
+ desktop_native_widget_aura_->HandleActivationChanged(true);
+ } else if (is_active_) {
+ desktop_native_widget_aura_->HandleActivationChanged(false);
+ }
+}
+
void DesktopWindowTreeHostMus::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
@@ -789,16 +804,4 @@ void DesktopWindowTreeHostMus::SetBoundsInPixels(
}
}
-void DesktopWindowTreeHostMus::OnWindowInitialized(aura::Window* window) {}
-
-void DesktopWindowTreeHostMus::OnActiveFocusClientChanged(
- aura::client::FocusClient* focus_client,
- aura::Window* window) {
- if (window == this->window()) {
- desktop_native_widget_aura_->HandleActivationChanged(true);
- } else if (is_active_) {
- desktop_native_widget_aura_->HandleActivationChanged(false);
- }
-}
-
} // namespace views
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | ui/views/mus/desktop_window_tree_host_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698