Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: chrome/browser/ui/ash/property_util.cc

Issue 2381183002: mash: Fix shelf window property use in Chrome. (Closed)
Patch Set: Address comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/property_util.h ('k') | chrome/browser/ui/views/task_manager_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 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
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/property_util.h ('k') | chrome/browser/ui/views/task_manager_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698