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

Side by Side Diff: ash/public/cpp/mus_property_mirror_ash.cc

Issue 2663383003: Revert of mash: Fix MusPropertyMirrorAsh for owned properties; add test. (Closed)
Patch Set: Created 3 years, 10 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 | « ash/public/cpp/mus_property_mirror_ash.h ('k') | ash/public/cpp/shelf_item_types.h » ('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 2017 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 "ash/public/cpp/mus_property_mirror_ash.h"
6
7 #include "ash/public/cpp/window_properties.h"
8 #include "ui/aura/client/aura_constants.h"
9
10 namespace {
11
12 template <typename T>
13 void MirrorOwnedProperty(aura::Window* window,
14 aura::Window* root_window,
15 const aura::WindowProperty<T*>* key) {
16 T* value = window->GetProperty(key);
17 if (!value)
18 root_window->ClearProperty(key);
19 else
20 root_window->SetProperty(key, new T(*value));
21 }
22
23 } // namespace
24
25 namespace ash {
26
27 MusPropertyMirrorAsh::MusPropertyMirrorAsh() {}
28 MusPropertyMirrorAsh::~MusPropertyMirrorAsh() {}
29
30 void MusPropertyMirrorAsh::MirrorPropertyFromWidgetWindowToRootWindow(
31 aura::Window* window,
32 aura::Window* root_window,
33 const void* key) {
34 if (key == kPanelAttachedKey) {
35 bool value = window->GetProperty(kPanelAttachedKey);
36 root_window->SetProperty(kPanelAttachedKey, value);
37 } else if (key == kShelfItemTypeKey) {
38 int32_t value = window->GetProperty(kShelfItemTypeKey);
39 root_window->SetProperty(kShelfItemTypeKey, value);
40 } else if (key == aura::client::kAppIconKey) {
41 MirrorOwnedProperty(window, root_window, aura::client::kAppIconKey);
42 } else if (key == aura::client::kAppIdKey) {
43 MirrorOwnedProperty(window, root_window, aura::client::kAppIdKey);
44 } else if (key == aura::client::kDrawAttentionKey) {
45 bool value = window->GetProperty(aura::client::kDrawAttentionKey);
46 root_window->SetProperty(aura::client::kDrawAttentionKey, value);
47 } else if (key == aura::client::kTitleKey) {
48 MirrorOwnedProperty(window, root_window, aura::client::kTitleKey);
49 } else if (key == aura::client::kWindowIconKey) {
50 MirrorOwnedProperty(window, root_window, aura::client::kWindowIconKey);
51 }
52 }
53
54 } // namespace ash
OLDNEW
« no previous file with comments | « ash/public/cpp/mus_property_mirror_ash.h ('k') | ash/public/cpp/shelf_item_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698