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" |
11 #include "mash/wm/shadow.h" | 11 #include "mash/wm/shadow.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
14 | 14 |
15 namespace mash { | 15 namespace mash { |
16 namespace wm { | 16 namespace wm { |
17 namespace { | 17 namespace { |
18 | 18 |
19 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Shadow*, kLocalShadowProperty, nullptr); | 19 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(Shadow*, kLocalShadowProperty, nullptr); |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) { | 23 mus::mojom::ShowState GetWindowShowState(const mus::Window* window) { |
24 if (window->HasSharedProperty( | 24 if (window->HasSharedProperty( |
25 mus::mojom::WindowManager::kShowState_Property)) { | 25 mus::mojom::WindowManager::kShowState_Property)) { |
26 return static_cast<mus::mojom::ShowState>( | 26 return static_cast<mus::mojom::ShowState>( |
27 window->GetSharedProperty<int32_t>( | 27 window->GetSharedProperty<int32_t>( |
28 mus::mojom::WindowManager::kShowState_Property)); | 28 mus::mojom::WindowManager::kShowState_Property)); |
29 } | 29 } |
30 return mus::mojom::SHOW_STATE_RESTORED; | 30 return mus::mojom::ShowState::RESTORED; |
31 } | 31 } |
32 | 32 |
33 void SetWindowUserSetBounds(mus::Window* window, const gfx::Rect& bounds) { | 33 void SetWindowUserSetBounds(mus::Window* window, const gfx::Rect& bounds) { |
34 if (bounds.IsEmpty()) { | 34 if (bounds.IsEmpty()) { |
35 window->ClearSharedProperty( | 35 window->ClearSharedProperty( |
36 mus::mojom::WindowManager::kUserSetBounds_Property); | 36 mus::mojom::WindowManager::kUserSetBounds_Property); |
37 } else { | 37 } else { |
38 window->SetSharedProperty<gfx::Rect>( | 38 window->SetSharedProperty<gfx::Rect>( |
39 mus::mojom::WindowManager::kUserSetBounds_Property, bounds); | 39 mus::mojom::WindowManager::kUserSetBounds_Property, bounds); |
40 } | 40 } |
(...skipping 20 matching lines...) Expand all Loading... |
61 mus::mojom::WindowManager::kPreferredSize_Property); | 61 mus::mojom::WindowManager::kPreferredSize_Property); |
62 } | 62 } |
63 return gfx::Size(); | 63 return gfx::Size(); |
64 } | 64 } |
65 | 65 |
66 mojom::Container GetRequestedContainer(const mus::Window* window) { | 66 mojom::Container GetRequestedContainer(const mus::Window* window) { |
67 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { | 67 if (window->HasSharedProperty(mojom::kWindowContainer_Property)) { |
68 return static_cast<mojom::Container>( | 68 return static_cast<mojom::Container>( |
69 window->GetSharedProperty<int32_t>(mojom::kWindowContainer_Property)); | 69 window->GetSharedProperty<int32_t>(mojom::kWindowContainer_Property)); |
70 } | 70 } |
71 return mojom::CONTAINER_USER_WINDOWS; | 71 return mojom::Container::USER_WINDOWS; |
72 } | 72 } |
73 | 73 |
74 mus::mojom::ResizeBehavior GetResizeBehavior(const mus::Window* window) { | 74 int32_t GetResizeBehavior(const mus::Window* window) { |
75 if (window->HasSharedProperty( | 75 if (window->HasSharedProperty( |
76 mus::mojom::WindowManager::kResizeBehavior_Property)) { | 76 mus::mojom::WindowManager::kResizeBehavior_Property)) { |
77 return static_cast<mus::mojom::ResizeBehavior>( | 77 return window->GetSharedProperty<int32_t>( |
78 window->GetSharedProperty<int32_t>( | 78 mus::mojom::WindowManager::kResizeBehavior_Property); |
79 mus::mojom::WindowManager::kResizeBehavior_Property)); | |
80 } | 79 } |
81 return mus::mojom::RESIZE_BEHAVIOR_NONE; | 80 return mus::mojom::kResizeBehaviorNone; |
82 } | 81 } |
83 | 82 |
84 void SetRestoreBounds(mus::Window* window, const gfx::Rect& bounds) { | 83 void SetRestoreBounds(mus::Window* window, const gfx::Rect& bounds) { |
85 window->SetSharedProperty<gfx::Rect>( | 84 window->SetSharedProperty<gfx::Rect>( |
86 mus::mojom::WindowManager::kRestoreBounds_Property, bounds); | 85 mus::mojom::WindowManager::kRestoreBounds_Property, bounds); |
87 } | 86 } |
88 | 87 |
89 gfx::Rect GetRestoreBounds(const mus::Window* window) { | 88 gfx::Rect GetRestoreBounds(const mus::Window* window) { |
90 if (window->HasSharedProperty( | 89 if (window->HasSharedProperty( |
91 mus::mojom::WindowManager::kRestoreBounds_Property)) { | 90 mus::mojom::WindowManager::kRestoreBounds_Property)) { |
(...skipping 17 matching lines...) Expand all Loading... |
109 | 108 |
110 mus::mojom::WindowType GetWindowType( | 109 mus::mojom::WindowType GetWindowType( |
111 const mus::Window::SharedProperties& properties) { | 110 const mus::Window::SharedProperties& properties) { |
112 const auto iter = | 111 const auto iter = |
113 properties.find(mus::mojom::WindowManager::kWindowType_Property); | 112 properties.find(mus::mojom::WindowManager::kWindowType_Property); |
114 if (iter != properties.end()) { | 113 if (iter != properties.end()) { |
115 return static_cast<mus::mojom::WindowType>( | 114 return static_cast<mus::mojom::WindowType>( |
116 mojo::TypeConverter<int32_t, const std::vector<uint8_t>>::Convert( | 115 mojo::TypeConverter<int32_t, const std::vector<uint8_t>>::Convert( |
117 iter->second)); | 116 iter->second)); |
118 } | 117 } |
119 return mus::mojom::WINDOW_TYPE_POPUP; | 118 return mus::mojom::WindowType::POPUP; |
120 } | 119 } |
121 | 120 |
122 } // namespace wm | 121 } // namespace wm |
123 } // namespace mash | 122 } // namespace mash |
OLD | NEW |