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 "ash/mus/property_util.h" | 5 #include "ash/mus/property_util.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "ash/mus/shadow.h" | 9 #include "ash/mus/shadow.h" |
10 #include "services/ui/public/cpp/property_type_converters.h" | 10 #include "services/ui/public/cpp/property_type_converters.h" |
11 #include "services/ui/public/cpp/window_property.h" | 11 #include "services/ui/public/cpp/window_property.h" |
| 12 #include "services/ui/public/interfaces/window_manager.mojom.h" |
12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::Shadow*, | 18 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::Shadow*, |
18 kLocalShadowProperty, | 19 kLocalShadowProperty, |
19 nullptr); | 20 nullptr); |
20 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kWindowIsJankyProperty, false); | 21 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kWindowIsJankyProperty, false); |
21 | 22 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 gfx::Size GetWindowPreferredSize(const ui::Window* window) { | 67 gfx::Size GetWindowPreferredSize(const ui::Window* window) { |
67 if (window->HasSharedProperty( | 68 if (window->HasSharedProperty( |
68 ui::mojom::WindowManager::kPreferredSize_Property)) { | 69 ui::mojom::WindowManager::kPreferredSize_Property)) { |
69 return window->GetSharedProperty<gfx::Size>( | 70 return window->GetSharedProperty<gfx::Size>( |
70 ui::mojom::WindowManager::kPreferredSize_Property); | 71 ui::mojom::WindowManager::kPreferredSize_Property); |
71 } | 72 } |
72 return gfx::Size(); | 73 return gfx::Size(); |
73 } | 74 } |
74 | 75 |
75 bool GetRequestedContainer(const ui::Window* window, | 76 bool GetRequestedContainer(const ui::Window* window, int* container_id) { |
76 mojom::Container* container) { | 77 if (!window->HasSharedProperty( |
77 if (!window->HasSharedProperty(mojom::kWindowContainer_Property)) | 78 ui::mojom::WindowManager::kInitialContainerId_Property)) |
78 return false; | 79 return false; |
79 | 80 |
80 *container = static_cast<mojom::Container>( | 81 *container_id = window->GetSharedProperty<int32_t>( |
81 window->GetSharedProperty<int32_t>(mojom::kWindowContainer_Property)); | 82 ui::mojom::WindowManager::kInitialContainerId_Property); |
82 return true; | 83 return true; |
83 } | 84 } |
84 | 85 |
85 void SetResizeBehavior(ui::Window::SharedProperties* properties, | 86 void SetResizeBehavior(ui::Window::SharedProperties* properties, |
86 int32_t resize_behavior) { | 87 int32_t resize_behavior) { |
87 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] = | 88 (*properties)[ui::mojom::WindowManager::kResizeBehavior_Property] = |
88 mojo::ConvertTo<std::vector<uint8_t>>(resize_behavior); | 89 mojo::ConvertTo<std::vector<uint8_t>>(resize_behavior); |
89 } | 90 } |
90 | 91 |
91 int32_t GetResizeBehavior(const ui::Window* window) { | 92 int32_t GetResizeBehavior(const ui::Window* window) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 273 |
273 bool GetExcludeFromMru(const ui::Window* window) { | 274 bool GetExcludeFromMru(const ui::Window* window) { |
274 return window->HasSharedProperty( | 275 return window->HasSharedProperty( |
275 ui::mojom::WindowManager::kExcludeFromMru_Property) && | 276 ui::mojom::WindowManager::kExcludeFromMru_Property) && |
276 window->GetSharedProperty<bool>( | 277 window->GetSharedProperty<bool>( |
277 ui::mojom::WindowManager::kExcludeFromMru_Property); | 278 ui::mojom::WindowManager::kExcludeFromMru_Property); |
278 } | 279 } |
279 | 280 |
280 } // namespace mus | 281 } // namespace mus |
281 } // namespace ash | 282 } // namespace ash |
OLD | NEW |