| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/aura/mus/property_converter.h" | 5 #include "ui/aura/mus/property_converter.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "mojo/public/cpp/bindings/type_converter.h" | 8 #include "mojo/public/cpp/bindings/type_converter.h" |
| 9 #include "services/ui/public/cpp/property_type_converters.h" | 9 #include "services/ui/public/cpp/property_type_converters.h" |
| 10 #include "services/ui/public/interfaces/window_manager.mojom.h" | 10 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ui::mojom::WindowManager::kImmersiveFullscreen_Property); | 41 ui::mojom::WindowManager::kImmersiveFullscreen_Property); |
| 42 RegisterProperty(client::kNameKey, ui::mojom::WindowManager::kName_Property); | 42 RegisterProperty(client::kNameKey, ui::mojom::WindowManager::kName_Property); |
| 43 RegisterProperty(client::kPreferredSize, | 43 RegisterProperty(client::kPreferredSize, |
| 44 ui::mojom::WindowManager::kPreferredSize_Property); | 44 ui::mojom::WindowManager::kPreferredSize_Property); |
| 45 RegisterProperty(client::kResizeBehaviorKey, | 45 RegisterProperty(client::kResizeBehaviorKey, |
| 46 ui::mojom::WindowManager::kResizeBehavior_Property); | 46 ui::mojom::WindowManager::kResizeBehavior_Property); |
| 47 RegisterProperty(client::kRestoreBoundsKey, | 47 RegisterProperty(client::kRestoreBoundsKey, |
| 48 ui::mojom::WindowManager::kRestoreBounds_Property); | 48 ui::mojom::WindowManager::kRestoreBounds_Property); |
| 49 RegisterProperty(client::kShowStateKey, | 49 RegisterProperty(client::kShowStateKey, |
| 50 ui::mojom::WindowManager::kShowState_Property); | 50 ui::mojom::WindowManager::kShowState_Property); |
| 51 RegisterProperty(client::kWindowIconKey, |
| 52 ui::mojom::WindowManager::kWindowIcon_Property); |
| 51 RegisterProperty(client::kTitleKey, | 53 RegisterProperty(client::kTitleKey, |
| 52 ui::mojom::WindowManager::kWindowTitle_Property); | 54 ui::mojom::WindowManager::kWindowTitle_Property); |
| 53 RegisterProperty(client::kWindowIconKey, | |
| 54 ui::mojom::WindowManager::kWindowIcon_Property); | |
| 55 } | 55 } |
| 56 | 56 |
| 57 PropertyConverter::~PropertyConverter() {} | 57 PropertyConverter::~PropertyConverter() {} |
| 58 | 58 |
| 59 bool PropertyConverter::IsTransportNameRegistered( |
| 60 const std::string& name) const { |
| 61 return transport_names_.count(name) > 0; |
| 62 } |
| 63 |
| 59 bool PropertyConverter::ConvertPropertyForTransport( | 64 bool PropertyConverter::ConvertPropertyForTransport( |
| 60 Window* window, | 65 Window* window, |
| 61 const void* key, | 66 const void* key, |
| 62 std::string* transport_name, | 67 std::string* transport_name, |
| 63 std::unique_ptr<std::vector<uint8_t>>* transport_value) { | 68 std::unique_ptr<std::vector<uint8_t>>* transport_value) { |
| 64 *transport_name = GetTransportNameForPropertyKey(key); | 69 *transport_name = GetTransportNameForPropertyKey(key); |
| 65 if (transport_name->empty()) | 70 if (transport_name->empty()) |
| 66 return false; | 71 return false; |
| 67 | 72 |
| 68 auto image_key = static_cast<const WindowProperty<gfx::ImageSkia*>*>(key); | 73 auto image_key = static_cast<const WindowProperty<gfx::ImageSkia*>*>(key); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return true; | 237 return true; |
| 233 } | 238 } |
| 234 } | 239 } |
| 235 return false; | 240 return false; |
| 236 } | 241 } |
| 237 | 242 |
| 238 void PropertyConverter::RegisterProperty( | 243 void PropertyConverter::RegisterProperty( |
| 239 const WindowProperty<gfx::ImageSkia*>* property, | 244 const WindowProperty<gfx::ImageSkia*>* property, |
| 240 const char* transport_name) { | 245 const char* transport_name) { |
| 241 image_properties_[property] = transport_name; | 246 image_properties_[property] = transport_name; |
| 247 transport_names_.insert(transport_name); |
| 242 } | 248 } |
| 243 | 249 |
| 244 void PropertyConverter::RegisterProperty( | 250 void PropertyConverter::RegisterProperty( |
| 245 const WindowProperty<gfx::Rect*>* property, | 251 const WindowProperty<gfx::Rect*>* property, |
| 246 const char* transport_name) { | 252 const char* transport_name) { |
| 247 rect_properties_[property] = transport_name; | 253 rect_properties_[property] = transport_name; |
| 254 transport_names_.insert(transport_name); |
| 248 } | 255 } |
| 249 | 256 |
| 250 void PropertyConverter::RegisterProperty( | 257 void PropertyConverter::RegisterProperty( |
| 251 const WindowProperty<gfx::Size*>* property, | 258 const WindowProperty<gfx::Size*>* property, |
| 252 const char* transport_name) { | 259 const char* transport_name) { |
| 253 size_properties_[property] = transport_name; | 260 size_properties_[property] = transport_name; |
| 261 transport_names_.insert(transport_name); |
| 254 } | 262 } |
| 255 | 263 |
| 256 void PropertyConverter::RegisterProperty( | 264 void PropertyConverter::RegisterProperty( |
| 257 const WindowProperty<std::string*>* property, | 265 const WindowProperty<std::string*>* property, |
| 258 const char* transport_name) { | 266 const char* transport_name) { |
| 259 string_properties_[property] = transport_name; | 267 string_properties_[property] = transport_name; |
| 268 transport_names_.insert(transport_name); |
| 260 } | 269 } |
| 261 | 270 |
| 262 void PropertyConverter::RegisterProperty( | 271 void PropertyConverter::RegisterProperty( |
| 263 const WindowProperty<base::string16*>* property, | 272 const WindowProperty<base::string16*>* property, |
| 264 const char* transport_name) { | 273 const char* transport_name) { |
| 265 string16_properties_[property] = transport_name; | 274 string16_properties_[property] = transport_name; |
| 275 transport_names_.insert(transport_name); |
| 266 } | 276 } |
| 267 | 277 |
| 268 } // namespace aura | 278 } // namespace aura |
| OLD | NEW |