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 "ash/public/cpp/window_style.h" |
| 8 #include "ash/public/interfaces/window_style.mojom.h" |
7 #include "services/ui/public/cpp/property_type_converters.h" | 9 #include "services/ui/public/cpp/property_type_converters.h" |
8 #include "services/ui/public/interfaces/window_manager.mojom.h" | 10 #include "services/ui/public/interfaces/window_manager.mojom.h" |
9 #include "ui/aura/mus/property_converter.h" | 11 #include "ui/aura/mus/property_converter.h" |
10 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
11 #include "ui/display/types/display_constants.h" | 13 #include "ui/display/types/display_constants.h" |
12 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
14 | 16 |
15 namespace ash { | 17 namespace ash { |
16 namespace mus { | 18 namespace mus { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ui::mojom::WindowManager::kRemoveStandardFrame_InitProperty); | 59 ui::mojom::WindowManager::kRemoveStandardFrame_InitProperty); |
58 return iter != properties.end() && mojo::ConvertTo<bool>(iter->second); | 60 return iter != properties.end() && mojo::ConvertTo<bool>(iter->second); |
59 } | 61 } |
60 | 62 |
61 bool ShouldEnableImmersive(const InitProperties& properties) { | 63 bool ShouldEnableImmersive(const InitProperties& properties) { |
62 auto iter = | 64 auto iter = |
63 properties.find(ui::mojom::WindowManager::kDisableImmersive_InitProperty); | 65 properties.find(ui::mojom::WindowManager::kDisableImmersive_InitProperty); |
64 return iter == properties.end() || !mojo::ConvertTo<bool>(iter->second); | 66 return iter == properties.end() || !mojo::ConvertTo<bool>(iter->second); |
65 } | 67 } |
66 | 68 |
| 69 mojom::WindowStyle GetWindowStyle(const InitProperties& properties) { |
| 70 auto iter = properties.find(mojom::kAshWindowStyle_InitProperty); |
| 71 if (iter == properties.end()) |
| 72 return mojom::WindowStyle::DEFAULT; |
| 73 |
| 74 const int32_t value = mojo::ConvertTo<int32_t>(iter->second); |
| 75 return IsValidWindowStyle(value) ? static_cast<mojom::WindowStyle>(value) |
| 76 : mojom::WindowStyle::DEFAULT; |
| 77 } |
| 78 |
67 void ApplyProperties( | 79 void ApplyProperties( |
68 aura::Window* window, | 80 aura::Window* window, |
69 aura::PropertyConverter* property_converter, | 81 aura::PropertyConverter* property_converter, |
70 const std::map<std::string, std::vector<uint8_t>>& properties) { | 82 const std::map<std::string, std::vector<uint8_t>>& properties) { |
71 for (auto& property_pair : properties) { | 83 for (auto& property_pair : properties) { |
72 property_converter->SetPropertyFromTransportValue( | 84 property_converter->SetPropertyFromTransportValue( |
73 window, property_pair.first, &property_pair.second); | 85 window, property_pair.first, &property_pair.second); |
74 } | 86 } |
75 } | 87 } |
76 | 88 |
77 } // namespace mus | 89 } // namespace mus |
78 } // namespace ash | 90 } // namespace ash |
OLD | NEW |