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

Unified Diff: ash/public/cpp/mus_property_mirror_ash.cc

Issue 2664113004: Reland: mash: Fix MusPropertyMirrorAsh for owned properties; add test. (Closed)
Patch Set: Sync and rebase. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/public/cpp/mus_property_mirror_ash.h ('k') | ash/public/cpp/shelf_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/public/cpp/mus_property_mirror_ash.cc
diff --git a/ash/public/cpp/mus_property_mirror_ash.cc b/ash/public/cpp/mus_property_mirror_ash.cc
new file mode 100644
index 0000000000000000000000000000000000000000..25ddc91fbe390511e6bfe7ebf109378addccc693
--- /dev/null
+++ b/ash/public/cpp/mus_property_mirror_ash.cc
@@ -0,0 +1,54 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/public/cpp/mus_property_mirror_ash.h"
+
+#include "ash/public/cpp/window_properties.h"
+#include "ui/aura/client/aura_constants.h"
+
+namespace {
+
+template <typename T>
+void MirrorOwnedProperty(aura::Window* window,
+ aura::Window* root_window,
+ const aura::WindowProperty<T*>* key) {
+ T* value = window->GetProperty(key);
+ if (!value)
+ root_window->ClearProperty(key);
+ else
+ root_window->SetProperty(key, new T(*value));
+}
+
+} // namespace
+
+namespace ash {
+
+MusPropertyMirrorAsh::MusPropertyMirrorAsh() {}
+MusPropertyMirrorAsh::~MusPropertyMirrorAsh() {}
+
+void MusPropertyMirrorAsh::MirrorPropertyFromWidgetWindowToRootWindow(
+ aura::Window* window,
+ aura::Window* root_window,
+ const void* key) {
+ if (key == kPanelAttachedKey) {
+ bool value = window->GetProperty(kPanelAttachedKey);
+ root_window->SetProperty(kPanelAttachedKey, value);
+ } else if (key == kShelfItemTypeKey) {
+ int32_t value = window->GetProperty(kShelfItemTypeKey);
+ root_window->SetProperty(kShelfItemTypeKey, value);
+ } else if (key == aura::client::kAppIconKey) {
+ MirrorOwnedProperty(window, root_window, aura::client::kAppIconKey);
+ } else if (key == aura::client::kAppIdKey) {
+ MirrorOwnedProperty(window, root_window, aura::client::kAppIdKey);
+ } else if (key == aura::client::kDrawAttentionKey) {
+ bool value = window->GetProperty(aura::client::kDrawAttentionKey);
+ root_window->SetProperty(aura::client::kDrawAttentionKey, value);
+ } else if (key == aura::client::kTitleKey) {
+ MirrorOwnedProperty(window, root_window, aura::client::kTitleKey);
+ } else if (key == aura::client::kWindowIconKey) {
+ MirrorOwnedProperty(window, root_window, aura::client::kWindowIconKey);
+ }
+}
+
+} // namespace ash
« no previous file with comments | « ash/public/cpp/mus_property_mirror_ash.h ('k') | ash/public/cpp/shelf_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698