| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/ash/property_util.h" | |
| 6 | |
| 7 #include "ash/wm/window_properties.h" | |
| 8 #include "chrome/browser/ui/ash/ash_util.h" | |
| 9 #include "services/ui/public/cpp/property_type_converters.h" | |
| 10 #include "services/ui/public/cpp/window.h" | |
| 11 #include "services/ui/public/cpp/window_property.h" | |
| 12 #include "services/ui/public/interfaces/window_manager.mojom.h" | |
| 13 #include "ui/aura/mus/mus_util.h" | |
| 14 #include "ui/aura/mus/property_converter.h" | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 // Get the corresponding ui::Window property key for an aura::Window key. | |
| 19 template <typename T> | |
| 20 const char* GetMusProperty(const aura::WindowProperty<T>* aura_key) { | |
| 21 if (aura_key == ash::kShelfItemTypeKey) | |
| 22 return ui::mojom::WindowManager::kShelfItemType_Property; | |
| 23 NOTREACHED(); | |
| 24 return nullptr; | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 namespace property_util { | |
| 30 | |
| 31 void SetIntProperty(aura::Window* window, | |
| 32 const aura::WindowProperty<int>* property, | |
| 33 int value) { | |
| 34 DCHECK(window); | |
| 35 if (chrome::IsRunningInMash()) { | |
| 36 aura::GetMusWindow(window) | |
| 37 ->SetSharedProperty<aura::PropertyConverter::PrimitiveType>( | |
| 38 GetMusProperty(property), value); | |
| 39 } else { | |
| 40 window->SetProperty(property, value); | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 void SetTitle(aura::Window* window, const base::string16& value) { | |
| 45 DCHECK(window); | |
| 46 if (chrome::IsRunningInMash()) { | |
| 47 aura::GetMusWindow(window)->SetSharedProperty<base::string16>( | |
| 48 ui::mojom::WindowManager::kWindowTitle_Property, value); | |
| 49 } else { | |
| 50 window->SetTitle(value); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 } // namespace property_util | |
| OLD | NEW |