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

Unified Diff: ash/mus/window_manager.cc

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment Created 4 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/mus/window_manager.h ('k') | ash/mus/window_manager_application.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/mash/wm/window_manager.cc b/ash/mus/window_manager.cc
similarity index 69%
rename from mash/wm/window_manager.cc
rename to ash/mus/window_manager.cc
index 3bc3c68eda75d124465a9a4eef045eaaec613eac..0e2db643ae1f4a0dae0a11e46be97488d2301b3b 100644
--- a/mash/wm/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -2,13 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mash/wm/window_manager.h"
+#include "ash/mus/window_manager.h"
#include <stdint.h>
#include <utility>
#include "ash/common/wm/container_finder.h"
+#include "ash/mus/bridge/wm_window_mus.h"
+#include "ash/mus/non_client_frame_controller.h"
+#include "ash/mus/property_util.h"
+#include "ash/mus/root_window_controller.h"
#include "ash/public/interfaces/container.mojom.h"
#include "components/mus/common/types.h"
#include "components/mus/public/cpp/property_type_converters.h"
@@ -18,35 +22,30 @@
#include "components/mus/public/interfaces/input_events.mojom.h"
#include "components/mus/public/interfaces/mus_constants.mojom.h"
#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "mash/wm/bridge/wm_window_mus.h"
-#include "mash/wm/non_client_frame_controller.h"
-#include "mash/wm/property_util.h"
-#include "mash/wm/root_window_controller.h"
-namespace mash {
-namespace wm {
+namespace ash {
+namespace mus {
WindowManager::WindowManager()
: root_controller_(nullptr),
window_manager_client_(nullptr),
binding_(this) {}
-WindowManager::~WindowManager() {
-}
+WindowManager::~WindowManager() {}
void WindowManager::Initialize(RootWindowController* root_controller,
- session::mojom::Session* session) {
+ mash::session::mojom::Session* session) {
DCHECK(root_controller);
DCHECK(!root_controller_);
root_controller_ = root_controller;
// Observe all the containers so that windows can be added to/removed from the
// |disconnected_app_handler_|.
- int count = static_cast<int>(ash::mojom::Container::COUNT);
- for (int id = static_cast<int>(ash::mojom::Container::ROOT) + 1; id < count;
+ int count = static_cast<int>(mojom::Container::COUNT);
+ for (int id = static_cast<int>(mojom::Container::ROOT) + 1; id < count;
++id) {
- mus::Window* container = root_controller_->GetWindowForContainer(
- static_cast<ash::mojom::Container>(id));
+ ::mus::Window* container = root_controller_->GetWindowForContainer(
+ static_cast<mojom::Container>(id));
Add(container);
// Add any pre-existing windows in the container to
@@ -60,8 +59,8 @@ void WindowManager::Initialize(RootWindowController* root_controller,
// The insets are roughly what is needed by CustomFrameView. The expectation
// is at some point we'll write our own NonClientFrameView and get the insets
// from it.
- mus::mojom::FrameDecorationValuesPtr frame_decoration_values =
- mus::mojom::FrameDecorationValues::New();
+ ::mus::mojom::FrameDecorationValuesPtr frame_decoration_values =
+ ::mus::mojom::FrameDecorationValues::New();
const gfx::Insets client_area_insets =
NonClientFrameController::GetPreferredClientAreaInsets();
frame_decoration_values->normal_client_area_insets = client_area_insets;
@@ -75,32 +74,32 @@ void WindowManager::Initialize(RootWindowController* root_controller,
session->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind());
}
-mus::Window* WindowManager::NewTopLevelWindow(
+::mus::Window* WindowManager::NewTopLevelWindow(
std::map<std::string, std::vector<uint8_t>>* properties) {
DCHECK(root_controller_);
- mus::Window* root = root_controller_->root();
+ ::mus::Window* root = root_controller_->root();
DCHECK(root);
// TODO(sky): panels need a different frame, http:://crbug.com/614362.
const bool provide_non_client_frame =
- GetWindowType(*properties) == mus::mojom::WindowType::WINDOW ||
- GetWindowType(*properties) == mus::mojom::WindowType::PANEL;
+ GetWindowType(*properties) == ::mus::mojom::WindowType::WINDOW ||
+ GetWindowType(*properties) == ::mus::mojom::WindowType::PANEL;
if (provide_non_client_frame)
- (*properties)[mus::mojom::kWaitForUnderlay_Property].clear();
+ (*properties)[::mus::mojom::kWaitForUnderlay_Property].clear();
// TODO(sky): constrain and validate properties before passing to server.
- mus::Window* window = root->window_tree()->NewWindow(properties);
+ ::mus::Window* window = root->window_tree()->NewWindow(properties);
window->SetBounds(CalculateDefaultBounds(window));
- mus::Window* container_window = nullptr;
- if (window->HasSharedProperty(ash::mojom::kWindowContainer_Property)) {
+ ::mus::Window* container_window = nullptr;
+ if (window->HasSharedProperty(mojom::kWindowContainer_Property)) {
container_window =
root_controller_->GetWindowForContainer(GetRequestedContainer(window));
} else {
// TODO(sky): window->bounds() isn't quite right.
container_window = WmWindowMus::GetMusWindow(
- ash::wm::GetDefaultParent(WmWindowMus::Get(root_controller_->root()),
- WmWindowMus::Get(window), window->bounds()));
+ wm::GetDefaultParent(WmWindowMus::Get(root_controller_->root()),
+ WmWindowMus::Get(window), window->bounds()));
}
DCHECK(root_controller_->WindowIsContainer(container_window));
@@ -117,17 +116,17 @@ mus::Window* WindowManager::NewTopLevelWindow(
return window;
}
-gfx::Rect WindowManager::CalculateDefaultBounds(mus::Window* window) const {
+gfx::Rect WindowManager::CalculateDefaultBounds(::mus::Window* window) const {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kInitialBounds_Property)) {
+ ::mus::mojom::WindowManager::kInitialBounds_Property)) {
return window->GetSharedProperty<gfx::Rect>(
- mus::mojom::WindowManager::kInitialBounds_Property);
+ ::mus::mojom::WindowManager::kInitialBounds_Property);
}
DCHECK(root_controller_);
int width, height;
const gfx::Size pref = GetWindowPreferredSize(window);
- const mus::Window* root = root_controller_->root();
+ const ::mus::Window* root = root_controller_->root();
if (pref.IsEmpty()) {
width = root->bounds().width() - 240;
height = root->bounds().height() - 240;
@@ -157,14 +156,14 @@ void WindowManager::OnTreeChanging(const TreeChangeParams& params) {
root_controller_->WindowIsContainer(params.new_parent))
disconnected_app_handler_.Add(params.target);
- mus::WindowTracker::OnTreeChanging(params);
+ ::mus::WindowTracker::OnTreeChanging(params);
}
-void WindowManager::SetWindowManagerClient(mus::WindowManagerClient* client) {
+void WindowManager::SetWindowManagerClient(::mus::WindowManagerClient* client) {
window_manager_client_ = client;
}
-bool WindowManager::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {
+bool WindowManager::OnWmSetBounds(::mus::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);
@@ -173,25 +172,25 @@ bool WindowManager::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {
}
bool WindowManager::OnWmSetProperty(
- mus::Window* window,
+ ::mus::Window* window,
const std::string& name,
std::unique_ptr<std::vector<uint8_t>>* new_data) {
// TODO(sky): constrain this to set of keys we know about, and allowed
// values.
- return name == mus::mojom::WindowManager::kShowState_Property ||
- name == mus::mojom::WindowManager::kPreferredSize_Property ||
- name == mus::mojom::WindowManager::kResizeBehavior_Property ||
- name == mus::mojom::WindowManager::kWindowAppIcon_Property ||
- name == mus::mojom::WindowManager::kWindowTitle_Property;
+ return name == ::mus::mojom::WindowManager::kShowState_Property ||
+ name == ::mus::mojom::WindowManager::kPreferredSize_Property ||
+ name == ::mus::mojom::WindowManager::kResizeBehavior_Property ||
+ name == ::mus::mojom::WindowManager::kWindowAppIcon_Property ||
+ name == ::mus::mojom::WindowManager::kWindowTitle_Property;
}
-mus::Window* WindowManager::OnWmCreateTopLevelWindow(
+::mus::Window* WindowManager::OnWmCreateTopLevelWindow(
std::map<std::string, std::vector<uint8_t>>* properties) {
return NewTopLevelWindow(properties);
}
void WindowManager::OnWmClientJankinessChanged(
- const std::set<mus::Window*>& client_windows,
+ const std::set<::mus::Window*>& client_windows,
bool janky) {
for (auto window : client_windows)
SetWindowIsJanky(window, janky);
@@ -203,10 +202,10 @@ void WindowManager::OnAccelerator(uint32_t id, const ui::Event& event) {
void WindowManager::ScreenlockStateChanged(bool locked) {
// Hide USER_PRIVATE_CONTAINER windows when the screen is locked.
- mus::Window* window = root_controller_->GetWindowForContainer(
- ash::mojom::Container::USER_PRIVATE);
+ ::mus::Window* window =
+ root_controller_->GetWindowForContainer(mojom::Container::USER_PRIVATE);
window->SetVisible(!locked);
}
-} // namespace wm
-} // namespace mash
+} // namespace mus
+} // namespace ash
« no previous file with comments | « ash/mus/window_manager.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698