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 | |
15 namespace { | |
16 | |
17 // Get the corresponding ui::Window property key for an aura::Window key. | |
18 template <typename T> | |
19 const char* GetMusProperty(const aura::WindowProperty<T>* aura_key) { | |
20 if (aura_key == ash::kShelfIconResourceIdKey) | |
21 return ui::mojom::WindowManager::kShelfIconResourceId_Property; | |
22 if (aura_key == ash::kShelfItemTypeKey) | |
23 return ui::mojom::WindowManager::kShelfItemType_Property; | |
24 NOTREACHED(); | |
25 return nullptr; | |
26 } | |
27 | |
28 } // namespace | |
29 | |
30 namespace property_util { | |
31 | |
32 void SetIntProperty(aura::Window* window, | |
33 const aura::WindowProperty<int>* property, | |
34 int value) { | |
35 DCHECK(window); | |
36 if (chrome::IsRunningInMash()) { | |
37 aura::GetMusWindow(window)->SetSharedProperty<int>(GetMusProperty(property), | |
38 value); | |
39 } else { | |
40 window->SetProperty(property, value); | |
41 } | |
42 } | |
43 | |
44 void SetTitle(aura::Window* window, const base::string16& value) { | |
45 if (chrome::IsRunningInMash()) { | |
James Cook
2016/10/03 20:38:12
DCHECK(window) above, please
msw
2016/10/03 22:02:24
Done.
| |
46 aura::GetMusWindow(window)->SetSharedProperty<base::string16>( | |
47 ui::mojom::WindowManager::kWindowTitle_Property, value); | |
48 } else { | |
49 window->SetTitle(value); | |
50 } | |
51 } | |
52 | |
53 } // namespace property_util | |
OLD | NEW |