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

Unified Diff: ash/mus/property_util.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/property_util.h ('k') | ash/mus/resources/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/property_util.cc
diff --git a/mash/wm/property_util.cc b/ash/mus/property_util.cc
similarity index 35%
rename from mash/wm/property_util.cc
rename to ash/mus/property_util.cc
index 0efdb7645d5c71f1612cd14484a5f1290cc2b331..9d1922ea9a65b1d86192092ed192ab56a4518482 100644
--- a/mash/wm/property_util.cc
+++ b/ash/mus/property_util.cc
@@ -2,215 +2,218 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mash/wm/property_util.h"
+#include "ash/mus/property_util.h"
#include <stdint.h>
+#include "ash/mus/shadow.h"
#include "components/mus/public/cpp/property_type_converters.h"
#include "components/mus/public/cpp/window_property.h"
-#include "mash/wm/shadow.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
-namespace mash {
-namespace wm {
namespace {
-MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Shadow*, kLocalShadowProperty, nullptr);
+MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::Shadow*,
+ kLocalShadowProperty,
+ nullptr);
MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kWindowIsJankyProperty, false);
} // namespace
-void SetWindowShowState(mus::Window* window, mus::mojom::ShowState show_state) {
+namespace ash {
+namespace mus {
+
+void SetWindowShowState(::mus::Window* window,
+ ::mus::mojom::ShowState show_state) {
window->SetSharedProperty<int32_t>(
- mus::mojom::WindowManager::kShowState_Property,
+ ::mus::mojom::WindowManager::kShowState_Property,
static_cast<uint32_t>(show_state));
}
-mus::mojom::ShowState GetWindowShowState(const mus::Window* window) {
+::mus::mojom::ShowState GetWindowShowState(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kShowState_Property)) {
- return static_cast<mus::mojom::ShowState>(
+ ::mus::mojom::WindowManager::kShowState_Property)) {
+ return static_cast<::mus::mojom::ShowState>(
window->GetSharedProperty<int32_t>(
- mus::mojom::WindowManager::kShowState_Property));
+ ::mus::mojom::WindowManager::kShowState_Property));
}
- return mus::mojom::ShowState::DEFAULT;
+ return ::mus::mojom::ShowState::DEFAULT;
}
-void SetWindowUserSetBounds(mus::Window* window, const gfx::Rect& bounds) {
+void SetWindowUserSetBounds(::mus::Window* window, const gfx::Rect& bounds) {
if (bounds.IsEmpty()) {
window->ClearSharedProperty(
- mus::mojom::WindowManager::kUserSetBounds_Property);
+ ::mus::mojom::WindowManager::kUserSetBounds_Property);
} else {
window->SetSharedProperty<gfx::Rect>(
- mus::mojom::WindowManager::kUserSetBounds_Property, bounds);
+ ::mus::mojom::WindowManager::kUserSetBounds_Property, bounds);
}
}
-gfx::Rect GetWindowUserSetBounds(const mus::Window* window) {
+gfx::Rect GetWindowUserSetBounds(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kUserSetBounds_Property)) {
+ ::mus::mojom::WindowManager::kUserSetBounds_Property)) {
return window->GetSharedProperty<gfx::Rect>(
- mus::mojom::WindowManager::kUserSetBounds_Property);
+ ::mus::mojom::WindowManager::kUserSetBounds_Property);
}
return gfx::Rect();
}
-void SetWindowPreferredSize(mus::Window* window, const gfx::Size& size) {
+void SetWindowPreferredSize(::mus::Window* window, const gfx::Size& size) {
window->SetSharedProperty<gfx::Size>(
- mus::mojom::WindowManager::kPreferredSize_Property, size);
+ ::mus::mojom::WindowManager::kPreferredSize_Property, size);
}
-gfx::Size GetWindowPreferredSize(const mus::Window* window) {
+gfx::Size GetWindowPreferredSize(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kPreferredSize_Property)) {
+ ::mus::mojom::WindowManager::kPreferredSize_Property)) {
return window->GetSharedProperty<gfx::Size>(
- mus::mojom::WindowManager::kPreferredSize_Property);
+ ::mus::mojom::WindowManager::kPreferredSize_Property);
}
return gfx::Size();
}
-ash::mojom::Container GetRequestedContainer(const mus::Window* window) {
- if (window->HasSharedProperty(ash::mojom::kWindowContainer_Property)) {
- return static_cast<ash::mojom::Container>(
- window->GetSharedProperty<int32_t>(
- ash::mojom::kWindowContainer_Property));
+mojom::Container GetRequestedContainer(const ::mus::Window* window) {
+ if (window->HasSharedProperty(mojom::kWindowContainer_Property)) {
+ return static_cast<mojom::Container>(
+ window->GetSharedProperty<int32_t>(mojom::kWindowContainer_Property));
}
- return ash::mojom::Container::USER_PRIVATE_WINDOWS;
+ return mojom::Container::USER_PRIVATE_WINDOWS;
}
-int32_t GetResizeBehavior(const mus::Window* window) {
+int32_t GetResizeBehavior(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kResizeBehavior_Property)) {
+ ::mus::mojom::WindowManager::kResizeBehavior_Property)) {
return window->GetSharedProperty<int32_t>(
- mus::mojom::WindowManager::kResizeBehavior_Property);
+ ::mus::mojom::WindowManager::kResizeBehavior_Property);
}
- return mus::mojom::kResizeBehaviorNone;
+ return ::mus::mojom::kResizeBehaviorNone;
}
-void SetRestoreBounds(mus::Window* window, const gfx::Rect& bounds) {
+void SetRestoreBounds(::mus::Window* window, const gfx::Rect& bounds) {
window->SetSharedProperty<gfx::Rect>(
- mus::mojom::WindowManager::kRestoreBounds_Property, bounds);
+ ::mus::mojom::WindowManager::kRestoreBounds_Property, bounds);
}
-gfx::Rect GetRestoreBounds(const mus::Window* window) {
+gfx::Rect GetRestoreBounds(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kRestoreBounds_Property)) {
+ ::mus::mojom::WindowManager::kRestoreBounds_Property)) {
return window->GetSharedProperty<gfx::Rect>(
- mus::mojom::WindowManager::kRestoreBounds_Property);
+ ::mus::mojom::WindowManager::kRestoreBounds_Property);
}
return gfx::Rect();
}
-void SetShadow(mus::Window* window, Shadow* shadow) {
+void SetShadow(::mus::Window* window, Shadow* shadow) {
window->SetLocalProperty(kLocalShadowProperty, shadow);
}
-Shadow* GetShadow(const mus::Window* window) {
+Shadow* GetShadow(const ::mus::Window* window) {
return window->GetLocalProperty(kLocalShadowProperty);
}
-mus::mojom::WindowType GetWindowType(const mus::Window* window) {
+::mus::mojom::WindowType GetWindowType(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kWindowType_Property)) {
- return static_cast<mus::mojom::WindowType>(
+ ::mus::mojom::WindowManager::kWindowType_Property)) {
+ return static_cast<::mus::mojom::WindowType>(
window->GetSharedProperty<int32_t>(
- mus::mojom::WindowManager::kWindowType_Property));
+ ::mus::mojom::WindowManager::kWindowType_Property));
}
- return mus::mojom::WindowType::POPUP;
+ return ::mus::mojom::WindowType::POPUP;
}
-mus::mojom::WindowType GetWindowType(
- const mus::Window::SharedProperties& properties) {
+::mus::mojom::WindowType GetWindowType(
+ const ::mus::Window::SharedProperties& properties) {
const auto iter =
- properties.find(mus::mojom::WindowManager::kWindowType_Property);
+ properties.find(::mus::mojom::WindowManager::kWindowType_Property);
if (iter != properties.end()) {
- return static_cast<mus::mojom::WindowType>(
+ return static_cast<::mus::mojom::WindowType>(
mojo::ConvertTo<int32_t>(iter->second));
}
- return mus::mojom::WindowType::POPUP;
+ return ::mus::mojom::WindowType::POPUP;
}
-ui::wm::WindowType GetWmWindowType(const mus::Window* window) {
+ui::wm::WindowType GetWmWindowType(const ::mus::Window* window) {
switch (GetWindowType(window)) {
- case mus::mojom::WindowType::WINDOW:
+ case ::mus::mojom::WindowType::WINDOW:
return ui::wm::WINDOW_TYPE_NORMAL;
- case mus::mojom::WindowType::PANEL:
+ case ::mus::mojom::WindowType::PANEL:
return ui::wm::WINDOW_TYPE_PANEL;
- case mus::mojom::WindowType::CONTROL:
+ case ::mus::mojom::WindowType::CONTROL:
return ui::wm::WINDOW_TYPE_CONTROL;
- case mus::mojom::WindowType::WINDOW_FRAMELESS:
- case mus::mojom::WindowType::POPUP:
- case mus::mojom::WindowType::BUBBLE:
- case mus::mojom::WindowType::DRAG:
+ case ::mus::mojom::WindowType::WINDOW_FRAMELESS:
+ case ::mus::mojom::WindowType::POPUP:
+ case ::mus::mojom::WindowType::BUBBLE:
+ case ::mus::mojom::WindowType::DRAG:
return ui::wm::WINDOW_TYPE_POPUP;
- case mus::mojom::WindowType::MENU:
+ case ::mus::mojom::WindowType::MENU:
return ui::wm::WINDOW_TYPE_MENU;
- case mus::mojom::WindowType::TOOLTIP:
+ case ::mus::mojom::WindowType::TOOLTIP:
return ui::wm::WINDOW_TYPE_TOOLTIP;
}
return ui::wm::WINDOW_TYPE_UNKNOWN;
}
-ash::mojom::AshWindowType GetAshWindowType(const mus::Window* window) {
- if (!window->HasSharedProperty(ash::mojom::kAshWindowType_Property))
- return ash::mojom::AshWindowType::COUNT;
+mojom::AshWindowType GetAshWindowType(const ::mus::Window* window) {
+ if (!window->HasSharedProperty(mojom::kAshWindowType_Property))
+ return mojom::AshWindowType::COUNT;
- return static_cast<ash::mojom::AshWindowType>(
- window->GetSharedProperty<int32_t>(ash::mojom::kAshWindowType_Property));
+ return static_cast<mojom::AshWindowType>(
+ window->GetSharedProperty<int32_t>(mojom::kAshWindowType_Property));
}
-base::string16 GetWindowTitle(const mus::Window* window) {
+base::string16 GetWindowTitle(const ::mus::Window* window) {
if (!window->HasSharedProperty(
- mus::mojom::WindowManager::kWindowTitle_Property)) {
+ ::mus::mojom::WindowManager::kWindowTitle_Property)) {
return base::string16();
}
return window->GetSharedProperty<base::string16>(
- mus::mojom::WindowManager::kWindowTitle_Property);
+ ::mus::mojom::WindowManager::kWindowTitle_Property);
}
-mojo::Array<uint8_t> GetWindowAppIcon(const mus::Window* window) {
+mojo::Array<uint8_t> GetWindowAppIcon(const ::mus::Window* window) {
if (window->HasSharedProperty(
- mus::mojom::WindowManager::kWindowAppIcon_Property)) {
+ ::mus::mojom::WindowManager::kWindowAppIcon_Property)) {
return mojo::Array<uint8_t>::From(
window->GetSharedProperty<std::vector<uint8_t>>(
- mus::mojom::WindowManager::kWindowAppIcon_Property));
+ ::mus::mojom::WindowManager::kWindowAppIcon_Property));
}
return mojo::Array<uint8_t>();
}
-void SetAppID(mus::Window* window, const base::string16& app_id) {
+void SetAppID(::mus::Window* window, const base::string16& app_id) {
window->SetSharedProperty<base::string16>(
- mus::mojom::WindowManager::kAppID_Property, app_id);
+ ::mus::mojom::WindowManager::kAppID_Property, app_id);
}
-base::string16 GetAppID(const mus::Window* window) {
- if (!window->HasSharedProperty(mus::mojom::WindowManager::kAppID_Property))
+base::string16 GetAppID(const ::mus::Window* window) {
+ if (!window->HasSharedProperty(::mus::mojom::WindowManager::kAppID_Property))
return base::string16();
return window->GetSharedProperty<base::string16>(
- mus::mojom::WindowManager::kAppID_Property);
+ ::mus::mojom::WindowManager::kAppID_Property);
}
-bool GetWindowIgnoredByShelf(mus::Window* window) {
+bool GetWindowIgnoredByShelf(::mus::Window* window) {
return window->HasSharedProperty(
- mus::mojom::WindowManager::kWindowIgnoredByShelf_Property) &&
+ ::mus::mojom::WindowManager::kWindowIgnoredByShelf_Property) &&
window->GetSharedProperty<bool>(
- mus::mojom::WindowManager::kWindowIgnoredByShelf_Property);
+ ::mus::mojom::WindowManager::kWindowIgnoredByShelf_Property);
}
-void SetWindowIsJanky(mus::Window* window, bool janky) {
+void SetWindowIsJanky(::mus::Window* window, bool janky) {
window->SetLocalProperty(kWindowIsJankyProperty, janky);
}
-bool IsWindowJanky(mus::Window* window) {
+bool IsWindowJanky(::mus::Window* window) {
return window->GetLocalProperty(kWindowIsJankyProperty);
}
@@ -218,17 +221,17 @@ bool IsWindowJankyProperty(const void* key) {
return key == kWindowIsJankyProperty;
}
-void SetAlwaysOnTop(mus::Window* window, bool value) {
+void SetAlwaysOnTop(::mus::Window* window, bool value) {
window->SetSharedProperty<bool>(
- mus::mojom::WindowManager::kAlwaysOnTop_Property, value);
+ ::mus::mojom::WindowManager::kAlwaysOnTop_Property, value);
}
-bool IsAlwaysOnTop(mus::Window* window) {
+bool IsAlwaysOnTop(::mus::Window* window) {
return window->HasSharedProperty(
- mus::mojom::WindowManager::kAlwaysOnTop_Property) &&
+ ::mus::mojom::WindowManager::kAlwaysOnTop_Property) &&
window->GetSharedProperty<bool>(
- mus::mojom::WindowManager::kAlwaysOnTop_Property);
+ ::mus::mojom::WindowManager::kAlwaysOnTop_Property);
}
-} // namespace wm
-} // namespace mash
+} // namespace mus
+} // namespace ash
« no previous file with comments | « ash/mus/property_util.h ('k') | ash/mus/resources/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698