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

Unified Diff: ash/aura/wm_window_aura.cc

Issue 2625873007: Promotes WmWindowMus functions to WmWindowAura and nukes WmWindowMus (Closed)
Patch Set: merge 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 | « ash/aura/wm_window_aura.h ('k') | ash/mus/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/aura/wm_window_aura.cc
diff --git a/ash/aura/wm_window_aura.cc b/ash/aura/wm_window_aura.cc
index e127dc8e9c1f2dc1086e3b78a091ce96c5a6bdae..0b23a4b84b0d7f544ee18c8025302120d9482b26 100644
--- a/ash/aura/wm_window_aura.cc
+++ b/ash/aura/wm_window_aura.cc
@@ -31,6 +31,9 @@
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/env.h"
#include "ui/aura/layout_manager.h"
+#include "ui/aura/mus/window_manager_delegate.h"
+#include "ui/aura/mus/window_mus.h"
+#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_property.h"
@@ -97,14 +100,13 @@ WmWindowAura::~WmWindowAura() {
}
// static
-const WmWindow* WmWindowAura::Get(const aura::Window* window) {
+const WmWindowAura* WmWindowAura::Get(const aura::Window* window) {
if (!window)
return nullptr;
- const WmWindow* wm_window = window->GetProperty(kWmWindowKey);
+ const WmWindowAura* wm_window = window->GetProperty(kWmWindowKey);
if (wm_window)
return wm_window;
- DCHECK_EQ(aura::Env::Mode::LOCAL, aura::Env::GetInstance()->mode());
// WmWindowAura is owned by the aura::Window.
// TODO(sky): fix constness.
return new WmWindowAura(const_cast<aura::Window*>(window));
@@ -721,6 +723,16 @@ views::Widget* WmWindowAura::GetInternalWidget() {
}
void WmWindowAura::CloseWidget() {
+ if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS &&
+ aura_window()->GetProperty(kWidgetCreationTypeKey) ==
+ WidgetCreationType::FOR_CLIENT) {
+ // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated
+ // with the window. Mash only creates widgets for top level windows if mash
+ // renders the non-client frame.
+ DCHECK(Shell::window_manager_client());
+ Shell::window_manager_client()->RequestClose(aura_window());
+ return;
+ }
DCHECK(GetInternalWidget());
GetInternalWidget()->Close();
}
@@ -867,7 +879,10 @@ void WmWindowAura::RemoveTransientWindowObserver(
}
void WmWindowAura::AddLimitedPreTargetHandler(ui::EventHandler* handler) {
- // This behaves differently from WmWindowMus for child and embedded windows.
+ // In mus AddPreTargetHandler() only works for windows created by this client.
+ DCHECK(aura::Env::GetInstance()->mode() == aura::Env::Mode::LOCAL ||
+ Shell::window_tree_client()->WasCreatedByThisClient(
+ aura::WindowMus::Get(window_)));
window_->AddPreTargetHandler(handler);
}
« no previous file with comments | « ash/aura/wm_window_aura.h ('k') | ash/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698