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

Unified Diff: ash/mus/bridge/wm_window_mus.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/bridge/wm_window_mus.h ('k') | ash/mus/container_ids.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/bridge/wm_window_mus.cc
diff --git a/mash/wm/bridge/wm_window_mus.cc b/ash/mus/bridge/wm_window_mus.cc
similarity index 74%
rename from mash/wm/bridge/wm_window_mus.cc
rename to ash/mus/bridge/wm_window_mus.cc
index 8def7d1233bee7ebc709a26ec89e10b7781d179f..1eb11030e07dcec68a77887a1a573a711d6dbdbd 100644
--- a/mash/wm/bridge/wm_window_mus.cc
+++ b/ash/mus/bridge/wm_window_mus.cc
@@ -2,70 +2,74 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mash/wm/bridge/wm_window_mus.h"
+#include "ash/mus/bridge/wm_window_mus.h"
#include "ash/common/wm/container_finder.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm/wm_layout_manager.h"
#include "ash/common/wm/wm_window_observer.h"
#include "ash/common/wm/wm_window_property.h"
+#include "ash/mus/bridge/mus_layout_manager_adapter.h"
+#include "ash/mus/bridge/wm_globals_mus.h"
+#include "ash/mus/bridge/wm_root_window_controller_mus.h"
+#include "ash/mus/property_util.h"
#include "components/mus/public/cpp/property_type_converters.h"
#include "components/mus/public/cpp/window.h"
#include "components/mus/public/cpp/window_property.h"
#include "components/mus/public/cpp/window_tree_client.h"
#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "mash/wm/bridge/mus_layout_manager_adapter.h"
-#include "mash/wm/bridge/wm_globals_mus.h"
-#include "mash/wm/bridge/wm_root_window_controller_mus.h"
-#include "mash/wm/property_util.h"
#include "ui/aura/mus/mus_util.h"
#include "ui/base/hit_test.h"
#include "ui/display/display.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
-MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmWindowMus*);
+MUS_DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmWindowMus*);
// TODO(sky): fully implement this. Making DVLOG as too spammy to be useful.
#undef NOTIMPLEMENTED
#define NOTIMPLEMENTED() DVLOG(1) << "notimplemented"
-namespace mash {
-namespace wm {
+namespace {
-MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(mash::wm::WmWindowMus,
+MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::mus::WmWindowMus,
kWmWindowKey,
nullptr);
+
+} // namespace
+
+namespace ash {
+namespace mus {
+
namespace {
// This classes is used so that the WindowState constructor can be made
// protected. GetWindowState() is the only place that should be creating
// WindowState.
-class WindowStateMus : public ash::wm::WindowState {
+class WindowStateMus : public wm::WindowState {
public:
- explicit WindowStateMus(ash::wm::WmWindow* window)
- : ash::wm::WindowState(window) {}
+ explicit WindowStateMus(wm::WmWindow* window) : wm::WindowState(window) {}
~WindowStateMus() override {}
private:
DISALLOW_COPY_AND_ASSIGN(WindowStateMus);
};
-ui::WindowShowState UIWindowShowStateFromMojom(mus::mojom::ShowState state) {
+ui::WindowShowState UIWindowShowStateFromMojom(::mus::mojom::ShowState state) {
switch (state) {
- case mus::mojom::ShowState::DEFAULT:
+ case ::mus::mojom::ShowState::DEFAULT:
return ui::SHOW_STATE_DEFAULT;
- case mus::mojom::ShowState::NORMAL:
+ case ::mus::mojom::ShowState::NORMAL:
return ui::SHOW_STATE_NORMAL;
- case mus::mojom::ShowState::MINIMIZED:
+ case ::mus::mojom::ShowState::MINIMIZED:
return ui::SHOW_STATE_MINIMIZED;
- case mus::mojom::ShowState::MAXIMIZED:
+ case ::mus::mojom::ShowState::MAXIMIZED:
return ui::SHOW_STATE_MAXIMIZED;
- case mus::mojom::ShowState::INACTIVE:
+ case ::mus::mojom::ShowState::INACTIVE:
return ui::SHOW_STATE_INACTIVE;
- case mus::mojom::ShowState::FULLSCREEN:
+ case ::mus::mojom::ShowState::FULLSCREEN:
return ui::SHOW_STATE_FULLSCREEN;
- case mus::mojom::ShowState::DOCKED:
+ case ::mus::mojom::ShowState::DOCKED:
return ui::SHOW_STATE_DOCKED;
default:
break;
@@ -73,35 +77,35 @@ ui::WindowShowState UIWindowShowStateFromMojom(mus::mojom::ShowState state) {
return ui::SHOW_STATE_DEFAULT;
}
-mus::mojom::ShowState MojomWindowShowStateFromUI(ui::WindowShowState state) {
+::mus::mojom::ShowState MojomWindowShowStateFromUI(ui::WindowShowState state) {
switch (state) {
case ui::SHOW_STATE_DEFAULT:
- return mus::mojom::ShowState::DEFAULT;
+ return ::mus::mojom::ShowState::DEFAULT;
case ui::SHOW_STATE_NORMAL:
- return mus::mojom::ShowState::NORMAL;
+ return ::mus::mojom::ShowState::NORMAL;
case ui::SHOW_STATE_MINIMIZED:
- return mus::mojom::ShowState::MINIMIZED;
+ return ::mus::mojom::ShowState::MINIMIZED;
case ui::SHOW_STATE_MAXIMIZED:
- return mus::mojom::ShowState::MAXIMIZED;
+ return ::mus::mojom::ShowState::MAXIMIZED;
case ui::SHOW_STATE_INACTIVE:
- return mus::mojom::ShowState::INACTIVE;
+ return ::mus::mojom::ShowState::INACTIVE;
case ui::SHOW_STATE_FULLSCREEN:
- return mus::mojom::ShowState::FULLSCREEN;
+ return ::mus::mojom::ShowState::FULLSCREEN;
case ui::SHOW_STATE_DOCKED:
- return mus::mojom::ShowState::DOCKED;
+ return ::mus::mojom::ShowState::DOCKED;
default:
break;
}
- return mus::mojom::ShowState::DEFAULT;
+ return ::mus::mojom::ShowState::DEFAULT;
}
} // namespace
-WmWindowMus::WmWindowMus(mus::Window* window)
+WmWindowMus::WmWindowMus(::mus::Window* window)
: window_(window),
// Matches aura, see aura::Window for details.
observers_(
- base::ObserverList<ash::wm::WmWindowObserver>::NOTIFY_EXISTING_ONLY) {
+ base::ObserverList<wm::WmWindowObserver>::NOTIFY_EXISTING_ONLY) {
window_->AddObserver(this);
window_->SetLocalProperty(kWmWindowKey, this);
window_state_.reset(new WindowStateMus(this));
@@ -112,11 +116,11 @@ WmWindowMus::~WmWindowMus() {
}
// static
-WmWindowMus* WmWindowMus::Get(mus::Window* window) {
+WmWindowMus* WmWindowMus::Get(::mus::Window* window) {
if (!window)
return nullptr;
- wm::WmWindowMus* wm_window = window->GetLocalProperty(kWmWindowKey);
+ WmWindowMus* wm_window = window->GetLocalProperty(kWmWindowKey);
if (wm_window)
return wm_window;
// WmWindowMus is owned by the mus::Window.
@@ -129,15 +133,14 @@ WmWindowMus* WmWindowMus::Get(views::Widget* widget) {
}
// static
-const mus::Window* WmWindowMus::GetMusWindow(
- const ash::wm::WmWindow* wm_window) {
+const ::mus::Window* WmWindowMus::GetMusWindow(const wm::WmWindow* wm_window) {
return static_cast<const WmWindowMus*>(wm_window)->mus_window();
}
// static
-std::vector<ash::wm::WmWindow*> WmWindowMus::FromMusWindows(
- const std::vector<mus::Window*>& mus_windows) {
- std::vector<ash::wm::WmWindow*> result(mus_windows.size());
+std::vector<wm::WmWindow*> WmWindowMus::FromMusWindows(
+ const std::vector<::mus::Window*>& mus_windows) {
+ std::vector<wm::WmWindow*> result(mus_windows.size());
for (size_t i = 0; i < mus_windows.size(); ++i)
result[i] = Get(mus_windows[i]);
return result;
@@ -153,24 +156,24 @@ bool WmWindowMus::ShouldUseExtendedHitRegion() const {
return parent && parent->children_use_extended_hit_region_;
}
-const ash::wm::WmWindow* WmWindowMus::GetRootWindow() const {
+const wm::WmWindow* WmWindowMus::GetRootWindow() const {
return Get(window_->GetRoot());
}
-ash::wm::WmRootWindowController* WmWindowMus::GetRootWindowController() {
+wm::WmRootWindowController* WmWindowMus::GetRootWindowController() {
return GetRootWindowControllerMus();
}
-ash::wm::WmGlobals* WmWindowMus::GetGlobals() const {
+wm::WmGlobals* WmWindowMus::GetGlobals() const {
return WmGlobalsMus::Get();
}
void WmWindowMus::SetName(const char* name) {
if (name) {
window_->SetSharedProperty<std::string>(
- mus::mojom::WindowManager::kName_Property, std::string(name));
+ ::mus::mojom::WindowManager::kName_Property, std::string(name));
} else {
- window_->ClearSharedProperty(mus::mojom::WindowManager::kName_Property);
+ window_->ClearSharedProperty(::mus::mojom::WindowManager::kName_Property);
}
}
@@ -211,10 +214,10 @@ int WmWindowMus::GetNonClientComponent(const gfx::Point& location) {
gfx::Point WmWindowMus::ConvertPointToTarget(const WmWindow* target,
const gfx::Point& point) const {
- const mus::Window* target_window = GetMusWindow(target);
+ const ::mus::Window* target_window = GetMusWindow(target);
if (target_window->Contains(window_)) {
gfx::Point result(point);
- const mus::Window* window = window_;
+ const ::mus::Window* window = window_;
while (window != target_window) {
result += window->bounds().origin().OffsetFromOrigin();
window = window->parent();
@@ -293,12 +296,12 @@ bool WmWindowMus::IsSystemModal() const {
return false;
}
-bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) {
+bool WmWindowMus::GetBoolProperty(wm::WmWindowProperty key) {
switch (key) {
- case ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
+ case wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
return snap_children_to_pixel_boundary_;
- case ash::wm::WmWindowProperty::ALWAYS_ON_TOP:
+ case wm::WmWindowProperty::ALWAYS_ON_TOP:
return IsAlwaysOnTop();
default:
@@ -310,13 +313,13 @@ bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) {
return false;
}
-int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) {
- if (key == ash::wm::WmWindowProperty::SHELF_ID) {
+int WmWindowMus::GetIntProperty(wm::WmWindowProperty key) {
+ if (key == wm::WmWindowProperty::SHELF_ID) {
NOTIMPLEMENTED();
return 0;
}
- if (key == ash::wm::WmWindowProperty::TOP_VIEW_INSET) {
+ if (key == wm::WmWindowProperty::TOP_VIEW_INSET) {
// TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100.
NOTIMPLEMENTED();
return 0;
@@ -326,11 +329,11 @@ int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) {
return 0;
}
-const ash::wm::WindowState* WmWindowMus::GetWindowState() const {
+const wm::WindowState* WmWindowMus::GetWindowState() const {
return window_state_.get();
}
-ash::wm::WmWindow* WmWindowMus::GetToplevelWindow() {
+wm::WmWindow* WmWindowMus::GetToplevelWindow() {
return WmGlobalsMus::GetToplevelAncestor(window_);
}
@@ -343,20 +346,20 @@ void WmWindowMus::AddChild(WmWindow* window) {
window_->AddChild(GetMusWindow(window));
}
-ash::wm::WmWindow* WmWindowMus::GetParent() {
+wm::WmWindow* WmWindowMus::GetParent() {
return Get(window_->parent());
}
-const ash::wm::WmWindow* WmWindowMus::GetTransientParent() const {
+const wm::WmWindow* WmWindowMus::GetTransientParent() const {
return Get(window_->transient_parent());
}
-std::vector<ash::wm::WmWindow*> WmWindowMus::GetTransientChildren() {
+std::vector<wm::WmWindow*> WmWindowMus::GetTransientChildren() {
return FromMusWindows(window_->transient_children());
}
void WmWindowMus::SetLayoutManager(
- std::unique_ptr<ash::wm::WmLayoutManager> layout_manager) {
+ std::unique_ptr<wm::WmLayoutManager> layout_manager) {
if (layout_manager) {
layout_manager_adapter_.reset(
new MusLayoutManagerAdapter(window_, std::move(layout_manager)));
@@ -365,7 +368,7 @@ void WmWindowMus::SetLayoutManager(
}
}
-ash::wm::WmLayoutManager* WmWindowMus::GetLayoutManager() {
+wm::WmLayoutManager* WmWindowMus::GetLayoutManager() {
return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager()
: nullptr;
}
@@ -477,7 +480,7 @@ gfx::Rect WmWindowMus::GetRestoreBoundsInScreen() const {
return *restore_bounds_in_screen_;
}
-bool WmWindowMus::Contains(const ash::wm::WmWindow* other) const {
+bool WmWindowMus::Contains(const wm::WmWindow* other) const {
return other
? window_->Contains(
static_cast<const WmWindowMus*>(other)->window_)
@@ -535,31 +538,30 @@ bool WmWindowMus::CanActivate() const {
return widget_ != nullptr;
}
-void WmWindowMus::StackChildAtTop(ash::wm::WmWindow* child) {
+void WmWindowMus::StackChildAtTop(wm::WmWindow* child) {
GetMusWindow(child)->MoveToFront();
}
-void WmWindowMus::StackChildAtBottom(ash::wm::WmWindow* child) {
+void WmWindowMus::StackChildAtBottom(wm::WmWindow* child) {
GetMusWindow(child)->MoveToBack();
}
-void WmWindowMus::StackChildAbove(ash::wm::WmWindow* child,
- ash::wm::WmWindow* target) {
+void WmWindowMus::StackChildAbove(wm::WmWindow* child, wm::WmWindow* target) {
GetMusWindow(child)->Reorder(GetMusWindow(target),
- mus::mojom::OrderDirection::ABOVE);
+ ::mus::mojom::OrderDirection::ABOVE);
}
void WmWindowMus::StackChildBelow(WmWindow* child, WmWindow* target) {
GetMusWindow(child)->Reorder(GetMusWindow(target),
- mus::mojom::OrderDirection::BELOW);
+ ::mus::mojom::OrderDirection::BELOW);
}
void WmWindowMus::SetAlwaysOnTop(bool value) {
- mash::wm::SetAlwaysOnTop(window_, value);
+ mus::SetAlwaysOnTop(window_, value);
}
bool WmWindowMus::IsAlwaysOnTop() const {
- return mash::wm::IsAlwaysOnTop(window_);
+ return mus::IsAlwaysOnTop(window_);
}
void WmWindowMus::Hide() {
@@ -584,13 +586,13 @@ bool WmWindowMus::IsFocused() const {
}
bool WmWindowMus::IsActive() const {
- mus::Window* focused = window_->window_tree()->GetFocusedWindow();
+ ::mus::Window* focused = window_->window_tree()->GetFocusedWindow();
return focused && window_->Contains(focused);
}
void WmWindowMus::Activate() {
window_->SetFocus();
- ash::wm::WmWindow* top_level = GetToplevelWindow();
+ wm::WmWindow* top_level = GetToplevelWindow();
if (!top_level)
return;
@@ -604,15 +606,15 @@ void WmWindowMus::Deactivate() {
}
void WmWindowMus::SetFullscreen() {
- SetWindowShowState(window_, mus::mojom::ShowState::FULLSCREEN);
+ SetWindowShowState(window_, ::mus::mojom::ShowState::FULLSCREEN);
}
void WmWindowMus::Maximize() {
- SetWindowShowState(window_, mus::mojom::ShowState::MAXIMIZED);
+ SetWindowShowState(window_, ::mus::mojom::ShowState::MAXIMIZED);
}
void WmWindowMus::Minimize() {
- SetWindowShowState(window_, mus::mojom::ShowState::MINIMIZED);
+ SetWindowShowState(window_, ::mus::mojom::ShowState::MINIMIZED);
}
void WmWindowMus::Unminimize() {
@@ -620,15 +622,15 @@ void WmWindowMus::Unminimize() {
restore_show_state_ = ui::SHOW_STATE_DEFAULT;
}
-std::vector<ash::wm::WmWindow*> WmWindowMus::GetChildren() {
+std::vector<wm::WmWindow*> WmWindowMus::GetChildren() {
return FromMusWindows(window_->children());
}
-ash::wm::WmWindow* WmWindowMus::GetChildByShellWindowId(int id) {
+wm::WmWindow* WmWindowMus::GetChildByShellWindowId(int id) {
if (id == shell_window_id_)
return this;
- for (mus::Window* child : window_->children()) {
- ash::wm::WmWindow* result = Get(child)->GetChildByShellWindowId(id);
+ for (::mus::Window* child : window_->children()) {
+ wm::WmWindow* result = Get(child)->GetChildByShellWindowId(id);
if (result)
return result;
}
@@ -644,7 +646,7 @@ void WmWindowMus::HideResizeShadow() {
}
void WmWindowMus::SetBoundsInScreenBehaviorForChildren(
- ash::wm::WmWindow::BoundsInScreenBehavior behavior) {
+ wm::WmWindow::BoundsInScreenBehavior behavior) {
// TODO: SetBoundsInScreen isn't fully implemented yet,
// http://crbug.com/615552.
NOTIMPLEMENTED();
@@ -656,9 +658,9 @@ void WmWindowMus::SetSnapsChildrenToPhysicalPixelBoundary() {
snap_children_to_pixel_boundary_ = true;
FOR_EACH_OBSERVER(
- ash::wm::WmWindowObserver, observers_,
+ wm::WmWindowObserver, observers_,
OnWindowPropertyChanged(
- this, ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY));
+ this, wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY));
}
void WmWindowMus::SnapToPixelBoundaryIfNecessary() {
@@ -679,43 +681,43 @@ void WmWindowMus::SetDescendantsStayInSameRootWindow(bool value) {
NOTIMPLEMENTED();
}
-void WmWindowMus::AddObserver(ash::wm::WmWindowObserver* observer) {
+void WmWindowMus::AddObserver(wm::WmWindowObserver* observer) {
observers_.AddObserver(observer);
}
-void WmWindowMus::RemoveObserver(ash::wm::WmWindowObserver* observer) {
+void WmWindowMus::RemoveObserver(wm::WmWindowObserver* observer) {
observers_.RemoveObserver(observer);
}
void WmWindowMus::OnTreeChanged(const TreeChangeParams& params) {
- ash::wm::WmWindowObserver::TreeChangeParams wm_params;
+ wm::WmWindowObserver::TreeChangeParams wm_params;
wm_params.target = Get(params.target);
wm_params.new_parent = Get(params.new_parent);
wm_params.old_parent = Get(params.old_parent);
- FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_,
+ FOR_EACH_OBSERVER(wm::WmWindowObserver, observers_,
OnWindowTreeChanged(this, wm_params));
}
-void WmWindowMus::OnWindowReordered(mus::Window* window,
- mus::Window* relative_window,
- mus::mojom::OrderDirection direction) {
- FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_,
+void WmWindowMus::OnWindowReordered(::mus::Window* window,
+ ::mus::Window* relative_window,
+ ::mus::mojom::OrderDirection direction) {
+ FOR_EACH_OBSERVER(wm::WmWindowObserver, observers_,
OnWindowStackingChanged(this));
}
void WmWindowMus::OnWindowSharedPropertyChanged(
- mus::Window* window,
+ ::mus::Window* window,
const std::string& name,
const std::vector<uint8_t>* old_data,
const std::vector<uint8_t>* new_data) {
- if (name == mus::mojom::WindowManager::kShowState_Property) {
+ if (name == ::mus::mojom::WindowManager::kShowState_Property) {
GetWindowState()->OnWindowShowStateChanged();
return;
}
- if (name == mus::mojom::WindowManager::kAlwaysOnTop_Property) {
- FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_,
- OnWindowPropertyChanged(
- this, ash::wm::WmWindowProperty::ALWAYS_ON_TOP));
+ if (name == ::mus::mojom::WindowManager::kAlwaysOnTop_Property) {
+ FOR_EACH_OBSERVER(
+ wm::WmWindowObserver, observers_,
+ OnWindowPropertyChanged(this, wm::WmWindowProperty::ALWAYS_ON_TOP));
return;
}
@@ -723,17 +725,16 @@ void WmWindowMus::OnWindowSharedPropertyChanged(
NOTIMPLEMENTED();
}
-void WmWindowMus::OnWindowBoundsChanged(mus::Window* window,
+void WmWindowMus::OnWindowBoundsChanged(::mus::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
- FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_,
+ FOR_EACH_OBSERVER(wm::WmWindowObserver, observers_,
OnWindowBoundsChanged(this, old_bounds, new_bounds));
}
-void WmWindowMus::OnWindowDestroying(mus::Window* window) {
- FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_,
- OnWindowDestroying(this));
+void WmWindowMus::OnWindowDestroying(::mus::Window* window) {
+ FOR_EACH_OBSERVER(wm::WmWindowObserver, observers_, OnWindowDestroying(this));
}
-} // namespace wm
-} // namespace mash
+} // namespace mus
+} // namespace ash
« no previous file with comments | « ash/mus/bridge/wm_window_mus.h ('k') | ash/mus/container_ids.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698