| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |