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

Side by Side Diff: mash/wm/property_util.cc

Issue 1954933002: Initial cut of ash/wm/common classes for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WmWindowMus::GetGlobals 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mash/wm/property_util.h" 5 #include "mash/wm/property_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window_property.h" 10 #include "components/mus/public/cpp/window_property.h"
(...skipping 15 matching lines...) Expand all
26 static_cast<uint32_t>(show_state)); 26 static_cast<uint32_t>(show_state));
27 } 27 }
28 28
29 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) { 29 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) {
30 if (window->HasSharedProperty( 30 if (window->HasSharedProperty(
31 mus::mojom::WindowManager::kShowState_Property)) { 31 mus::mojom::WindowManager::kShowState_Property)) {
32 return static_cast<mus::mojom::ShowState>( 32 return static_cast<mus::mojom::ShowState>(
33 window->GetSharedProperty<int32_t>( 33 window->GetSharedProperty<int32_t>(
34 mus::mojom::WindowManager::kShowState_Property)); 34 mus::mojom::WindowManager::kShowState_Property));
35 } 35 }
36 return mus::mojom::ShowState::RESTORED; 36 return mus::mojom::ShowState::DEFAULT;
37 } 37 }
38 38
39 void SetWindowUserSetBounds(mus::Window* window, const gfx::Rect& bounds) { 39 void SetWindowUserSetBounds(mus::Window* window, const gfx::Rect& bounds) {
40 if (bounds.IsEmpty()) { 40 if (bounds.IsEmpty()) {
41 window->ClearSharedProperty( 41 window->ClearSharedProperty(
42 mus::mojom::WindowManager::kUserSetBounds_Property); 42 mus::mojom::WindowManager::kUserSetBounds_Property);
43 } else { 43 } else {
44 window->SetSharedProperty<gfx::Rect>( 44 window->SetSharedProperty<gfx::Rect>(
45 mus::mojom::WindowManager::kUserSetBounds_Property, bounds); 45 mus::mojom::WindowManager::kUserSetBounds_Property, bounds);
46 } 46 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const mus::Window::SharedProperties& properties) { 122 const mus::Window::SharedProperties& properties) {
123 const auto iter = 123 const auto iter =
124 properties.find(mus::mojom::WindowManager::kWindowType_Property); 124 properties.find(mus::mojom::WindowManager::kWindowType_Property);
125 if (iter != properties.end()) { 125 if (iter != properties.end()) {
126 return static_cast<mus::mojom::WindowType>( 126 return static_cast<mus::mojom::WindowType>(
127 mojo::ConvertTo<int32_t>(iter->second)); 127 mojo::ConvertTo<int32_t>(iter->second));
128 } 128 }
129 return mus::mojom::WindowType::POPUP; 129 return mus::mojom::WindowType::POPUP;
130 } 130 }
131 131
132 ui::wm::WindowType GetWmWindowType(const mus::Window* window) {
133 switch (GetWindowType(window)) {
134 case mus::mojom::WindowType::WINDOW:
135 return ui::wm::WINDOW_TYPE_NORMAL;
136
137 case mus::mojom::WindowType::PANEL:
138 return ui::wm::WINDOW_TYPE_PANEL;
139
140 case mus::mojom::WindowType::CONTROL:
141 return ui::wm::WINDOW_TYPE_CONTROL;
142
143 case mus::mojom::WindowType::WINDOW_FRAMELESS:
144 case mus::mojom::WindowType::POPUP:
145 case mus::mojom::WindowType::BUBBLE:
146 case mus::mojom::WindowType::DRAG:
147 return ui::wm::WINDOW_TYPE_POPUP;
148
149 case mus::mojom::WindowType::MENU:
150 return ui::wm::WINDOW_TYPE_MENU;
151
152 case mus::mojom::WindowType::TOOLTIP:
153 return ui::wm::WINDOW_TYPE_TOOLTIP;
154 }
155
156 return ui::wm::WINDOW_TYPE_UNKNOWN;
157 }
158
132 base::string16 GetWindowTitle(const mus::Window* window) { 159 base::string16 GetWindowTitle(const mus::Window* window) {
133 if (!window->HasSharedProperty( 160 if (!window->HasSharedProperty(
134 mus::mojom::WindowManager::kWindowTitle_Property)) { 161 mus::mojom::WindowManager::kWindowTitle_Property)) {
135 return base::string16(); 162 return base::string16();
136 } 163 }
137 164
138 return window->GetSharedProperty<base::string16>( 165 return window->GetSharedProperty<base::string16>(
139 mus::mojom::WindowManager::kWindowTitle_Property); 166 mus::mojom::WindowManager::kWindowTitle_Property);
140 } 167 }
141 168
(...skipping 15 matching lines...) Expand all
157 base::string16 GetAppID(const mus::Window* window) { 184 base::string16 GetAppID(const mus::Window* window) {
158 if (!window->HasSharedProperty(mus::mojom::WindowManager::kAppID_Property)) 185 if (!window->HasSharedProperty(mus::mojom::WindowManager::kAppID_Property))
159 return base::string16(); 186 return base::string16();
160 187
161 return window->GetSharedProperty<base::string16>( 188 return window->GetSharedProperty<base::string16>(
162 mus::mojom::WindowManager::kAppID_Property); 189 mus::mojom::WindowManager::kAppID_Property);
163 } 190 }
164 191
165 } // namespace wm 192 } // namespace wm
166 } // namespace mash 193 } // namespace mash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698