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

Unified Diff: ash/wm/window_util.cc

Issue 2908793002: [mus+ash] Removes WmWindow from ash/wm/overview and ash/wm/workspace (Closed)
Patch Set: Created 3 years, 7 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/wm/window_util.h ('k') | ash/wm/workspace/backdrop_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 0ef0d81a32894269625db5bb00f20bbf9cfaedcf..6c033a6bf7bccd6448e867c3f6eb7101fdaa6715 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -7,16 +7,21 @@
#include <vector>
#include "ash/ash_constants.h"
+#include "ash/public/cpp/config.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
+#include "ash/wm/widget_finder.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
#include "ash/wm/wm_event.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/mus/window_manager_delegate.h"
+#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_delegate.h"
#include "ui/aura/window_event_dispatcher.h"
@@ -140,5 +145,35 @@ int GetNonClientComponent(aura::Window* window, const gfx::Point& location) {
: HTNOWHERE;
}
+void CloseWidgetForWindow(aura::Window* window) {
+ if (Shell::GetAshConfig() == Config::MASH &&
+ 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(window);
+ return;
+ }
+ views::Widget* widget = GetInternalWidgetForWindow(window);
+ DCHECK(widget);
+ widget->Close();
+}
+
+void AddLimitedPreTargetHandlerForWindow(ui::EventHandler* handler,
+ aura::Window* window) {
+ // In mus AddPreTargetHandler() only works for windows created by this client.
+ DCHECK(Shell::GetAshConfig() != Config::MASH ||
+ Shell::window_tree_client()->WasCreatedByThisClient(
+ aura::WindowMus::Get(window)));
+ window->AddPreTargetHandler(handler);
+}
+
+void RemoveLimitedPreTargetHandlerForWindow(ui::EventHandler* handler,
+ aura::Window* window) {
+ window->RemovePreTargetHandler(handler);
+}
+
} // namespace wm
} // namespace ash
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/backdrop_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698