Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 | 42 |
| 43 bool ValidateShowState(int64_t value) { | 43 bool ValidateShowState(int64_t value) { |
| 44 return value == int64_t(ui::mojom::ShowState::DEFAULT) || | 44 return value == int64_t(ui::mojom::ShowState::DEFAULT) || |
| 45 value == int64_t(ui::mojom::ShowState::NORMAL) || | 45 value == int64_t(ui::mojom::ShowState::NORMAL) || |
| 46 value == int64_t(ui::mojom::ShowState::MINIMIZED) || | 46 value == int64_t(ui::mojom::ShowState::MINIMIZED) || |
| 47 value == int64_t(ui::mojom::ShowState::MAXIMIZED) || | 47 value == int64_t(ui::mojom::ShowState::MAXIMIZED) || |
| 48 value == int64_t(ui::mojom::ShowState::INACTIVE) || | 48 value == int64_t(ui::mojom::ShowState::INACTIVE) || |
| 49 value == int64_t(ui::mojom::ShowState::FULLSCREEN); | 49 value == int64_t(ui::mojom::ShowState::FULLSCREEN); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool ValidateWindowPinType(int64_t value) { | |
| 53 return value == int64_t(ui::mojom::WindowPinType::NONE) || | |
| 54 value == int64_t(ui::mojom::WindowPinType::PINNED) || | |
| 55 value == int64_t(ui::mojom::WindowPinType::TRUSTED_PINNED); | |
| 56 } | |
| 57 | |
| 52 } // namespace | 58 } // namespace |
| 53 | 59 |
| 54 PropertyConverter::PrimitiveProperty::PrimitiveProperty() {} | 60 PropertyConverter::PrimitiveProperty::PrimitiveProperty() {} |
| 55 | 61 |
| 56 PropertyConverter::PrimitiveProperty::PrimitiveProperty( | 62 PropertyConverter::PrimitiveProperty::PrimitiveProperty( |
| 57 const PrimitiveProperty& property) = default; | 63 const PrimitiveProperty& property) = default; |
| 58 | 64 |
| 59 PropertyConverter::PrimitiveProperty::~PrimitiveProperty() {} | 65 PropertyConverter::PrimitiveProperty::~PrimitiveProperty() {} |
| 60 | 66 |
| 61 // static | 67 // static |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 82 RegisterProperty(client::kResizeBehaviorKey, | 88 RegisterProperty(client::kResizeBehaviorKey, |
| 83 ui::mojom::WindowManager::kResizeBehavior_Property, | 89 ui::mojom::WindowManager::kResizeBehavior_Property, |
| 84 base::Bind(&ValidateResizeBehaviour)); | 90 base::Bind(&ValidateResizeBehaviour)); |
| 85 RegisterProperty(client::kRestoreBoundsKey, | 91 RegisterProperty(client::kRestoreBoundsKey, |
| 86 ui::mojom::WindowManager::kRestoreBounds_Property); | 92 ui::mojom::WindowManager::kRestoreBounds_Property); |
| 87 RegisterProperty(client::kShowStateKey, | 93 RegisterProperty(client::kShowStateKey, |
| 88 ui::mojom::WindowManager::kShowState_Property, | 94 ui::mojom::WindowManager::kShowState_Property, |
| 89 base::Bind(&ValidateShowState)); | 95 base::Bind(&ValidateShowState)); |
| 90 RegisterProperty(client::kWindowIconKey, | 96 RegisterProperty(client::kWindowIconKey, |
| 91 ui::mojom::WindowManager::kWindowIcon_Property); | 97 ui::mojom::WindowManager::kWindowIcon_Property); |
| 98 RegisterProperty(client::kWindowPinTypeKey, | |
| 99 ui::mojom::WindowManager::kWindowPinType_Property, | |
|
sky
2017/03/31 04:40:26
When you move the classes out of views you'll need
Peng
2017/03/31 18:09:22
Done.
| |
| 100 base::Bind(&ValidateWindowPinType)); | |
| 92 RegisterProperty(client::kTitleKey, | 101 RegisterProperty(client::kTitleKey, |
| 93 ui::mojom::WindowManager::kWindowTitle_Property); | 102 ui::mojom::WindowManager::kWindowTitle_Property); |
| 94 } | 103 } |
| 95 | 104 |
| 96 PropertyConverter::~PropertyConverter() {} | 105 PropertyConverter::~PropertyConverter() {} |
| 97 | 106 |
| 98 bool PropertyConverter::IsTransportNameRegistered( | 107 bool PropertyConverter::IsTransportNameRegistered( |
| 99 const std::string& name) const { | 108 const std::string& name) const { |
| 100 return transport_names_.count(name) > 0; | 109 return transport_names_.count(name) > 0; |
| 101 } | 110 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 } | 328 } |
| 320 | 329 |
| 321 void PropertyConverter::RegisterProperty( | 330 void PropertyConverter::RegisterProperty( |
| 322 const WindowProperty<base::string16*>* property, | 331 const WindowProperty<base::string16*>* property, |
| 323 const char* transport_name) { | 332 const char* transport_name) { |
| 324 string16_properties_[property] = transport_name; | 333 string16_properties_[property] = transport_name; |
| 325 transport_names_.insert(transport_name); | 334 transport_names_.insert(transport_name); |
| 326 } | 335 } |
| 327 | 336 |
| 328 } // namespace aura | 337 } // namespace aura |
| OLD | NEW |