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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2568303006: aura-mus: Implement Deactivate(). (Closed)
Patch Set: Add comment. Created 3 years, 11 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 87571a76b30d3abaca869fa53a465775f39b287a..bdec8679620c576ebe35c2f839049be5cfc582b3 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -181,6 +181,7 @@ DesktopWindowTreeHostMus::DesktopWindowTreeHostMus(
close_widget_factory_(this) {
aura::Env::GetInstance()->AddObserver(this);
MusClient::Get()->AddObserver(this);
+ native_widget_delegate_->AsWidget()->AddObserver(this);
// DesktopNativeWidgetAura registers the association between |content_window_|
// and Widget, but code may also want to go from the root (window()) to the
// Widget. This call enables that.
@@ -195,6 +196,7 @@ DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() {
// the cursor-client needs to be unset on the root-window before
// |cursor_manager_| is destroyed.
aura::client::SetCursorClient(window(), nullptr);
+ native_widget_delegate_->AsWidget()->RemoveObserver(this);
MusClient::Get()->RemoveObserver(this);
aura::Env::GetInstance()->RemoveObserver(this);
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
@@ -280,6 +282,13 @@ void DesktopWindowTreeHostMus::OnNativeWidgetCreated(
native_widget_delegate_->OnNativeWidgetCreated(true);
}
+void DesktopWindowTreeHostMus::OnNativeWidgetActivationChanged(bool active) {
+ // In Mus, when our aura Window receives an activation signal, it can be
+ // because of remote messages. We need to forward that to Widget so that
+ // Widget can notify everyone listening for that signal.
+ native_widget_delegate_->OnNativeWidgetActivationChanged(active);
+}
+
void DesktopWindowTreeHostMus::OnWidgetInitDone() {
// Because of construction order it's possible the bounds have changed before
// the NonClientView was created, which means we may not have sent the
@@ -492,9 +501,8 @@ void DesktopWindowTreeHostMus::Activate() {
}
void DesktopWindowTreeHostMus::Deactivate() {
- // TODO: Deactivate() means focus next window, that needs to go to mus.
- // http://crbug.com/663618.
- NOTIMPLEMENTED();
+ if (is_active_)
+ DeactivateWindow();
}
bool DesktopWindowTreeHostMus::IsActive() const {
@@ -669,6 +677,15 @@ void DesktopWindowTreeHostMus::OnWindowManagerFrameValuesChanged() {
SendHitTestMaskToServer();
}
+void DesktopWindowTreeHostMus::OnWidgetActivationChanged(Widget* widget,
+ bool active) {
+ // TODO(erg): Theoretically, this shouldn't be necessary. We should be able
+ // to just set |is_active_| in OnNativeWidgetActivationChanged() above,
+ // instead of asking the Widget to change the activation and have the widget
+ // then tell us the activation has changed. But if we do that, focus breaks.
+ is_active_ = active;
+}
+
void DesktopWindowTreeHostMus::ShowImpl() {
native_widget_delegate_->OnNativeWidgetVisibilityChanging(true);
// Using ui::SHOW_STATE_NORMAL matches that of DesktopWindowTreeHostX11.
@@ -711,10 +728,8 @@ void DesktopWindowTreeHostMus::OnActiveFocusClientChanged(
aura::client::FocusClient* focus_client,
aura::Window* window) {
if (window == this->window()) {
- is_active_ = true;
desktop_native_widget_aura_->HandleActivationChanged(true);
} else if (is_active_) {
- is_active_ = false;
desktop_native_widget_aura_->HandleActivationChanged(false);
}
}
« 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