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

Side by Side Diff: chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc

Issue 2667743003: mash: Fix icon window property mirroring. (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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" 5 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/window_properties.h" 9 #include "ash/wm/window_properties.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/ui/views/select_file_dialog_extension.h" 26 #include "chrome/browser/ui/views/select_file_dialog_extension.h"
27 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" 27 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h"
28 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
29 #include "ui/aura/mus/property_converter.h" 29 #include "ui/aura/mus/property_converter.h"
30 #include "ui/base/class_property.h" 30 #include "ui/base/class_property.h"
31 #include "ui/keyboard/content/keyboard.h" 31 #include "ui/keyboard/content/keyboard.h"
32 #include "ui/keyboard/keyboard_controller.h" 32 #include "ui/keyboard/keyboard_controller.h"
33 #include "ui/views/mus/mus_client.h" 33 #include "ui/views/mus/mus_client.h"
34 #include "ui/views/mus/mus_property_mirror.h" 34 #include "ui/views/mus/mus_property_mirror.h"
35 35
36 namespace {
37
38 void MirrorIcon(aura::Window* window,
39 aura::Window* root_window,
40 const aura::WindowProperty<gfx::ImageSkia*>* key) {
41 gfx::ImageSkia* value = window->GetProperty(key);
42 if (!value || value->isNull())
43 root_window->ClearProperty(key);
44 else
45 root_window->SetProperty(key, new gfx::ImageSkia(*value));
46 }
47
48 } // namespace
49
36 // Relays aura content window properties to its root window (the mash frame). 50 // Relays aura content window properties to its root window (the mash frame).
37 // Ash relies on various window properties for frame titles, shelf items, etc. 51 // Ash relies on various window properties for frame titles, shelf items, etc.
38 // These properties are read from the client's root, not child content windows. 52 // These properties are read from the client's root, not child content windows.
39 class MusPropertyMirrorAsh : public views::MusPropertyMirror { 53 class MusPropertyMirrorAsh : public views::MusPropertyMirror {
40 public: 54 public:
41 MusPropertyMirrorAsh() {} 55 MusPropertyMirrorAsh() {}
42 ~MusPropertyMirrorAsh() override {} 56 ~MusPropertyMirrorAsh() override {}
43 57
44 // MusPropertyMirror: 58 // MusPropertyMirror:
45 void MirrorPropertyFromWidgetWindowToRootWindow(aura::Window* window, 59 void MirrorPropertyFromWidgetWindowToRootWindow(aura::Window* window,
46 aura::Window* root_window, 60 aura::Window* root_window,
47 const void* key) override { 61 const void* key) override {
48 if (key == ash::kShelfIDKey) { 62 if (key == ash::kShelfIDKey) {
49 int32_t value = window->GetProperty(ash::kShelfIDKey); 63 int32_t value = window->GetProperty(ash::kShelfIDKey);
50 root_window->SetProperty(ash::kShelfIDKey, value); 64 root_window->SetProperty(ash::kShelfIDKey, value);
51 } else if (key == ash::kShelfItemTypeKey) { 65 } else if (key == ash::kShelfItemTypeKey) {
52 int32_t value = window->GetProperty(ash::kShelfItemTypeKey); 66 int32_t value = window->GetProperty(ash::kShelfItemTypeKey);
53 root_window->SetProperty(ash::kShelfItemTypeKey, value); 67 root_window->SetProperty(ash::kShelfItemTypeKey, value);
54 } else if (key == aura::client::kAppIconKey) { 68 } else if (key == aura::client::kAppIconKey) {
55 gfx::ImageSkia* value = window->GetProperty(aura::client::kAppIconKey); 69 MirrorIcon(window, root_window, aura::client::kAppIconKey);
56 root_window->SetProperty(aura::client::kAppIconKey, value);
57 } else if (key == aura::client::kAppIdKey) { 70 } else if (key == aura::client::kAppIdKey) {
58 std::string* value = window->GetProperty(aura::client::kAppIdKey); 71 std::string* value = window->GetProperty(aura::client::kAppIdKey);
59 root_window->SetProperty(aura::client::kAppIdKey, value); 72 root_window->SetProperty(aura::client::kAppIdKey, value);
60 } else if (key == aura::client::kDrawAttentionKey) { 73 } else if (key == aura::client::kDrawAttentionKey) {
61 bool value = window->GetProperty(aura::client::kDrawAttentionKey); 74 bool value = window->GetProperty(aura::client::kDrawAttentionKey);
62 root_window->SetProperty(aura::client::kDrawAttentionKey, value); 75 root_window->SetProperty(aura::client::kDrawAttentionKey, value);
63 } else if (key == aura::client::kTitleKey) { 76 } else if (key == aura::client::kTitleKey) {
64 base::string16* value = window->GetProperty(aura::client::kTitleKey); 77 base::string16* value = window->GetProperty(aura::client::kTitleKey);
65 root_window->SetProperty(aura::client::kTitleKey, value); 78 root_window->SetProperty(aura::client::kTitleKey, value);
66 } else if (key == aura::client::kWindowIconKey) { 79 } else if (key == aura::client::kWindowIconKey) {
67 gfx::ImageSkia* value = window->GetProperty(aura::client::kWindowIconKey); 80 MirrorIcon(window, root_window, aura::client::kWindowIconKey);
68 root_window->SetProperty(aura::client::kWindowIconKey, value);
69 } 81 }
70 } 82 }
71 83
72 private: 84 private:
73 DISALLOW_COPY_AND_ASSIGN(MusPropertyMirrorAsh); 85 DISALLOW_COPY_AND_ASSIGN(MusPropertyMirrorAsh);
74 }; 86 };
75 87
76 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} 88 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {}
77 89
78 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} 90 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 vpn_list_forwarder_.reset(); 163 vpn_list_forwarder_.reset();
152 volume_controller_.reset(); 164 volume_controller_.reset();
153 new_window_client_.reset(); 165 new_window_client_.reset();
154 system_tray_client_.reset(); 166 system_tray_client_.reset();
155 media_client_.reset(); 167 media_client_.reset();
156 cast_config_client_media_router_.reset(); 168 cast_config_client_media_router_.reset();
157 session_controller_client_.reset(); 169 session_controller_client_.reset();
158 170
159 chrome::CloseAsh(); 171 chrome::CloseAsh();
160 } 172 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698