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

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: merge to trunk 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
« no previous file with comments | « mash/wm/property_util.h ('k') | mash/wm/public/interfaces/container.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 mojom::AshWindowType GetAshWindowType(const mus::Window* window) { 159 mojom::AshWindowType GetAshWindowType(const mus::Window* window) {
133 if (!window->HasSharedProperty(mojom::kAshWindowType_Property)) 160 if (!window->HasSharedProperty(mojom::kAshWindowType_Property))
134 return mojom::AshWindowType::COUNT; 161 return mojom::AshWindowType::COUNT;
135 162
136 return static_cast<mojom::AshWindowType>( 163 return static_cast<mojom::AshWindowType>(
137 window->GetSharedProperty<int32_t>(mojom::kAshWindowType_Property)); 164 window->GetSharedProperty<int32_t>(mojom::kAshWindowType_Property));
138 } 165 }
139 166
140 base::string16 GetWindowTitle(const mus::Window* window) { 167 base::string16 GetWindowTitle(const mus::Window* window) {
141 if (!window->HasSharedProperty( 168 if (!window->HasSharedProperty(
(...skipping 30 matching lines...) Expand all
172 199
173 bool GetWindowIgnoredByShelf(mus::Window* window) { 200 bool GetWindowIgnoredByShelf(mus::Window* window) {
174 return window->HasSharedProperty( 201 return window->HasSharedProperty(
175 mus::mojom::WindowManager::kWindowIgnoredByShelf_Property) && 202 mus::mojom::WindowManager::kWindowIgnoredByShelf_Property) &&
176 window->GetSharedProperty<bool>( 203 window->GetSharedProperty<bool>(
177 mus::mojom::WindowManager::kWindowIgnoredByShelf_Property); 204 mus::mojom::WindowManager::kWindowIgnoredByShelf_Property);
178 } 205 }
179 206
180 } // namespace wm 207 } // namespace wm
181 } // namespace mash 208 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/property_util.h ('k') | mash/wm/public/interfaces/container.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698