| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/public/cpp/window_properties.h" | 5 #include "ash/public/cpp/window_properties.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/mus_property_mirror_ash.h" |
| 7 #include "ash/public/cpp/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.h" |
| 9 #include "ash/public/cpp/window_pin_type.h" |
| 8 #include "ash/public/interfaces/window_pin_type.mojom.h" | 10 #include "ash/public/interfaces/window_pin_type.mojom.h" |
| 11 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 12 #include "ui/aura/mus/property_converter.h" |
| 13 #include "ui/views/mus/mus_client.h" |
| 9 | 14 |
| 10 DECLARE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, | 15 DECLARE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT, |
| 11 ash::mojom::WindowPinType) | 16 ash::mojom::WindowPinType) |
| 12 | 17 |
| 13 namespace ash { | 18 namespace ash { |
| 14 | 19 |
| 15 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kPanelAttachedKey, true); | 20 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kPanelAttachedKey, true); |
| 16 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kShelfIDKey, nullptr); | 21 DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kShelfIDKey, nullptr); |
| 17 DEFINE_UI_CLASS_PROPERTY_KEY(int32_t, kShelfItemTypeKey, TYPE_UNDEFINED); | 22 DEFINE_UI_CLASS_PROPERTY_KEY(int32_t, kShelfItemTypeKey, TYPE_UNDEFINED); |
| 18 DEFINE_UI_CLASS_PROPERTY_KEY(mojom::WindowPinType, | 23 DEFINE_UI_CLASS_PROPERTY_KEY(mojom::WindowPinType, |
| 19 kWindowPinTypeKey, | 24 kWindowPinTypeKey, |
| 20 mojom::WindowPinType::NONE); | 25 mojom::WindowPinType::NONE); |
| 21 | 26 |
| 27 void RegisterWindowPropertiesForTransportAndMirroring() { |
| 28 DCHECK(views::MusClient::Exists()); |
| 29 views::MusClient* mus_client = views::MusClient::Get(); |
| 30 aura::WindowTreeClientDelegate* delegate = mus_client; |
| 31 aura::PropertyConverter* converter = delegate->GetPropertyConverter(); |
| 32 |
| 33 converter->RegisterPrimitiveProperty( |
| 34 kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property, |
| 35 aura::PropertyConverter::CreateAcceptAnyValueCallback()); |
| 36 converter->RegisterPrimitiveProperty( |
| 37 kShelfItemTypeKey, ui::mojom::WindowManager::kShelfItemType_Property, |
| 38 base::Bind(&IsValidShelfItemType)); |
| 39 converter->RegisterPrimitiveProperty(kWindowPinTypeKey, |
| 40 mojom::kWindowPinType_Property, |
| 41 base::Bind(&IsValidWindowPinType)); |
| 42 converter->RegisterStringProperty( |
| 43 kShelfIDKey, ui::mojom::WindowManager::kShelfID_Property); |
| 44 |
| 45 mus_client->SetMusPropertyMirror(base::MakeUnique<MusPropertyMirrorAsh>()); |
| 46 } |
| 47 |
| 22 } // namespace ash | 48 } // namespace ash |
| OLD | NEW |