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

Unified Diff: ash/mus/window_manager.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/mus/window_manager.h ('k') | ash/shell.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager.cc
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index bd3a4316057e455ea8e3ce282de08f5de735ecb2..589769b77be289e2ff70360d39c28678c16acf53 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -8,6 +8,7 @@
#include <utility>
+#include "ash/aura/wm_window_aura.h"
#include "ash/common/session/session_controller.h"
#include "ash/common/wm/container_finder.h"
#include "ash/common/wm/window_state.h"
@@ -16,7 +17,6 @@
#include "ash/mus/accelerators/accelerator_ids.h"
#include "ash/mus/bridge/wm_lookup_mus.h"
#include "ash/mus/bridge/wm_shell_mus.h"
-#include "ash/mus/bridge/wm_window_mus.h"
#include "ash/mus/move_event_handler.h"
#include "ash/mus/non_client_frame_controller.h"
#include "ash/mus/property_util.h"
@@ -96,8 +96,8 @@ WindowManager::WindowManager(service_manager::Connector* connector)
WindowManager::~WindowManager() {
Shutdown();
- aura::Env::GetInstance()->RemoveObserver(this);
ash::Shell::set_window_tree_client(nullptr);
+ ash::Shell::set_window_manager_client(nullptr);
}
void WindowManager::Init(
@@ -110,8 +110,6 @@ void WindowManager::Init(
DCHECK_EQ(nullptr, ash::Shell::window_tree_client());
ash::Shell::set_window_tree_client(window_tree_client_.get());
- aura::Env::GetInstance()->AddObserver(this);
-
// |connector_| will be null in some tests.
if (connector_)
connector_->BindInterface(ui::mojom::kServiceName, &display_controller_);
@@ -156,7 +154,7 @@ aura::Window* WindowManager::NewTopLevelWindow(
if (properties->count(
ui::mojom::WindowManager::kWindowIgnoredByShelf_Property)) {
wm::WindowState* window_state =
- static_cast<WmWindow*>(WmWindowMus::Get(window))->GetWindowState();
+ static_cast<WmWindow*>(WmWindowAura::Get(window))->GetWindowState();
window_state->set_ignored_by_shelf(mojo::ConvertTo<bool>(
(*properties)
[ui::mojom::WindowManager::kWindowIgnoredByShelf_Property]));
@@ -309,7 +307,7 @@ void WindowManager::Shutdown() {
RootWindowController* WindowManager::GetPrimaryRootWindowController() {
return RootWindowController::ForWindow(
- static_cast<WmWindowMus*>(
+ static_cast<WmWindowAura*>(
WmShell::Get()->GetPrimaryRootWindowController()->GetWindow())
->aura_window());
}
@@ -325,7 +323,8 @@ WindowManager::GetRootWindowControllerForNewTopLevelWindow(
}
return RootWindowController::ForWindow(
- static_cast<WmWindowMus*>(WmShellMus::Get()->GetRootWindowForNewWindows())
+ static_cast<WmWindowAura*>(
+ WmShellMus::Get()->GetRootWindowForNewWindows())
->aura_window());
}
@@ -363,12 +362,13 @@ aura::PropertyConverter* WindowManager::GetPropertyConverter() {
void WindowManager::SetWindowManagerClient(aura::WindowManagerClient* client) {
window_manager_client_ = client;
+ ash::Shell::set_window_manager_client(client);
}
bool WindowManager::OnWmSetBounds(aura::Window* window, gfx::Rect* bounds) {
// TODO(sky): this indirectly sets bounds, which is against what
// OnWmSetBounds() recommends doing. Remove that restriction, or fix this.
- WmWindowMus::Get(window)->SetBounds(*bounds);
+ WmWindowAura::Get(window)->SetBounds(*bounds);
*bounds = window->bounds();
return true;
}
@@ -379,8 +379,7 @@ bool WindowManager::OnWmSetProperty(
std::unique_ptr<std::vector<uint8_t>>* new_data) {
// TODO(sky): constrain this to set of keys we know about, and allowed values.
if (name == ui::mojom::WindowManager::kWindowIgnoredByShelf_Property) {
- wm::WindowState* window_state =
- static_cast<WmWindow*>(WmWindowMus::Get(window))->GetWindowState();
+ wm::WindowState* window_state = WmWindowAura::Get(window)->GetWindowState();
window_state->set_ignored_by_shelf(
new_data ? mojo::ConvertTo<bool>(**new_data) : false);
return false; // Won't attempt to map through property converter.
@@ -466,7 +465,7 @@ void WindowManager::OnWmPerformMoveLoop(
ui::mojom::MoveLoopSource source,
const gfx::Point& cursor_location,
const base::Callback<void(bool)>& on_done) {
- WmWindowMus* child_window = WmWindowMus::Get(window);
+ WmWindowAura* child_window = WmWindowAura::Get(window);
MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
if (!handler) {
on_done.Run(false);
@@ -482,7 +481,7 @@ void WindowManager::OnWmPerformMoveLoop(
}
void WindowManager::OnWmCancelMoveLoop(aura::Window* window) {
- WmWindowMus* child_window = WmWindowMus::Get(window);
+ WmWindowAura* child_window = WmWindowAura::Get(window);
MoveEventHandler* handler = MoveEventHandler::GetForWindow(child_window);
if (handler)
handler->RevertDrag();
@@ -508,12 +507,5 @@ void WindowManager::OnWmSetClientArea(
non_client_frame_controller->SetClientArea(insets, additional_client_areas);
}
-void WindowManager::OnWindowInitialized(aura::Window* window) {
- // This ensures WmWindowAura won't be called before WmWindowMus. This is
- // important as if WmWindowAura::Get() is called first, then WmWindowAura
- // would be created, not WmWindowMus.
- WmWindowMus::Get(window);
-}
-
} // namespace mus
} // namespace ash
« no previous file with comments | « ash/mus/window_manager.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698