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

Unified Diff: ash/mus/window_manager.cc

Issue 2625873007: Promotes WmWindowMus functions to WmWindowAura and nukes WmWindowMus (Closed)
Patch Set: cleanup 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
Index: ash/mus/window_manager.cc
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index 569c4691535bb68d2f781da5c5c525e3894063bc..d70c80c86f7c654f847848b4aa3957590083eaf2 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/wm/container_finder.h"
#include "ash/common/wm/window_state.h"
#include "ash/display/screen_position_controller.h"
@@ -15,7 +16,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"
@@ -95,8 +95,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(
@@ -109,8 +109,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_);
@@ -158,7 +156,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]));
@@ -311,7 +309,7 @@ void WindowManager::Shutdown() {
RootWindowController* WindowManager::GetPrimaryRootWindowController() {
return RootWindowController::ForWindow(
- static_cast<WmWindowMus*>(
+ static_cast<WmWindowAura*>(
WmShell::Get()->GetPrimaryRootWindowController()->GetWindow())
->aura_window());
}
@@ -327,7 +325,8 @@ WindowManager::GetRootWindowControllerForNewTopLevelWindow(
}
return RootWindowController::ForWindow(
- static_cast<WmWindowMus*>(WmShellMus::Get()->GetRootWindowForNewWindows())
+ static_cast<WmWindowAura*>(
+ WmShellMus::Get()->GetRootWindowForNewWindows())
->aura_window());
}
@@ -365,12 +364,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;
}
@@ -381,8 +381,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.
@@ -468,7 +467,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);
@@ -484,7 +483,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();
@@ -510,12 +509,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

Powered by Google App Engine
This is Rietveld 408576698