Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/chrome_browser_main.h" | 11 #include "chrome/browser/chrome_browser_main.h" |
| 11 #include "chrome/browser/ui/ash/ash_init.h" | 12 #include "chrome/browser/ui/ash/ash_init.h" |
| 12 #include "chrome/browser/ui/ash/ash_util.h" | 13 #include "chrome/browser/ui/ash/ash_util.h" |
| 13 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" | 14 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" |
| 14 #include "chrome/browser/ui/ash/chrome_new_window_client.h" | 15 #include "chrome/browser/ui/ash/chrome_new_window_client.h" |
| 15 #include "chrome/browser/ui/ash/chrome_shell_content_state.h" | 16 #include "chrome/browser/ui/ash/chrome_shell_content_state.h" |
| 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h" |
| 17 #include "chrome/browser/ui/ash/media_client.h" | 18 #include "chrome/browser/ui/ash/media_client.h" |
| 18 #include "chrome/browser/ui/ash/session_controller_client.h" | 19 #include "chrome/browser/ui/ash/session_controller_client.h" |
| 19 #include "chrome/browser/ui/ash/system_tray_client.h" | 20 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 20 #include "chrome/browser/ui/ash/volume_controller.h" | 21 #include "chrome/browser/ui/ash/volume_controller.h" |
| 21 #include "chrome/browser/ui/ash/vpn_list_forwarder.h" | 22 #include "chrome/browser/ui/ash/vpn_list_forwarder.h" |
| 22 #include "chrome/browser/ui/views/ash/tab_scrubber.h" | 23 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
| 23 #include "chrome/browser/ui/views/frame/immersive_context_mus.h" | 24 #include "chrome/browser/ui/views/frame/immersive_context_mus.h" |
| 24 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h" | 25 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h" |
| 25 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 26 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
| 26 #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" | |
| 29 #include "ui/aura/mus/property_converter.h" | |
| 30 #include "ui/aura/window_property.h" | |
| 27 #include "ui/keyboard/content/keyboard.h" | 31 #include "ui/keyboard/content/keyboard.h" |
| 28 #include "ui/keyboard/keyboard_controller.h" | 32 #include "ui/keyboard/keyboard_controller.h" |
| 33 #include "ui/views/mus/mus_client.h" | |
| 34 #include "ui/views/mus/mus_property_mirror.h" | |
| 35 | |
| 36 // Relays aura content window properties to its root window (the mash frame). | |
|
sky
2017/01/27 20:10:45
Explain why this is done.
msw
2017/01/27 21:19:25
Done. (I attempted to give a clear explanation, su
| |
| 37 class MusPropertyMirrorAsh : public views::MusPropertyMirror { | |
| 38 public: | |
| 39 MusPropertyMirrorAsh() {} | |
| 40 ~MusPropertyMirrorAsh() override {} | |
| 41 | |
| 42 // MusPropertyMirror: | |
| 43 void MirrorPropertyFromWidgetWindowToRootWindow(aura::Window* window, | |
| 44 const void* key) override { | |
| 45 DCHECK(!window->IsRootWindow()); | |
| 46 aura::Window* root_window = window->GetRootWindow(); | |
| 47 if (!root_window) | |
| 48 return; | |
| 49 if (key == ash::kShelfIDKey) { | |
| 50 int32_t value = window->GetProperty(ash::kShelfIDKey); | |
| 51 root_window->SetProperty(ash::kShelfIDKey, value); | |
| 52 } else if (key == ash::kShelfItemTypeKey) { | |
| 53 int32_t value = window->GetProperty(ash::kShelfItemTypeKey); | |
| 54 root_window->SetProperty(ash::kShelfItemTypeKey, value); | |
| 55 } else if (key == aura::client::kAppIconKey) { | |
| 56 gfx::ImageSkia* value = window->GetProperty(aura::client::kAppIconKey); | |
| 57 root_window->SetProperty(aura::client::kAppIconKey, value); | |
| 58 } else if (key == aura::client::kAppIdKey) { | |
| 59 std::string* value = window->GetProperty(aura::client::kAppIdKey); | |
| 60 root_window->SetProperty(aura::client::kAppIdKey, value); | |
| 61 } else if (key == aura::client::kDrawAttentionKey) { | |
| 62 bool value = window->GetProperty(aura::client::kDrawAttentionKey); | |
| 63 root_window->SetProperty(aura::client::kDrawAttentionKey, value); | |
| 64 } else if (key == aura::client::kTitleKey) { | |
| 65 base::string16* value = window->GetProperty(aura::client::kTitleKey); | |
| 66 root_window->SetProperty(aura::client::kTitleKey, value); | |
| 67 } else if (key == aura::client::kWindowIconKey) { | |
| 68 gfx::ImageSkia* value = window->GetProperty(aura::client::kWindowIconKey); | |
| 69 root_window->SetProperty(aura::client::kWindowIconKey, value); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 private: | |
| 74 DISALLOW_COPY_AND_ASSIGN(MusPropertyMirrorAsh); | |
| 75 }; | |
| 29 | 76 |
| 30 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} | 77 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} |
| 31 | 78 |
| 32 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} | 79 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} |
| 33 | 80 |
| 81 void ChromeBrowserMainExtraPartsAsh::ServiceManagerConnectionStarted( | |
| 82 content::ServiceManagerConnection* connection) { | |
| 83 if (chrome::IsRunningInMash()) { | |
| 84 // Register ash-specific window properties with Chrome's property converter. | |
| 85 // This propagates ash properties set on chrome windows to ash, via mojo. | |
| 86 DCHECK(views::MusClient::Exists()); | |
| 87 views::MusClient* mus_client = views::MusClient::Get(); | |
| 88 aura::WindowTreeClientDelegate* delegate = mus_client; | |
| 89 aura::PropertyConverter* converter = delegate->GetPropertyConverter(); | |
| 90 converter->RegisterProperty( | |
| 91 ash::kPanelAttachedKey, | |
| 92 ui::mojom::WindowManager::kPanelAttached_Property); | |
| 93 converter->RegisterProperty( | |
| 94 ash::kShelfItemTypeKey, | |
| 95 ui::mojom::WindowManager::kShelfItemType_Property); | |
| 96 | |
| 97 mus_client->set_mus_property_mirror( | |
| 98 base::MakeUnique<MusPropertyMirrorAsh>()); | |
| 99 } | |
| 100 } | |
| 101 | |
| 34 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { | 102 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { |
| 35 if (chrome::ShouldOpenAshOnStartup()) | 103 if (chrome::ShouldOpenAshOnStartup()) |
| 36 chrome::OpenAsh(gfx::kNullAcceleratedWidget); | 104 chrome::OpenAsh(gfx::kNullAcceleratedWidget); |
| 37 | 105 |
| 38 if (chrome::IsRunningInMash()) { | 106 if (chrome::IsRunningInMash()) { |
| 39 immersive_context_ = base::MakeUnique<ImmersiveContextMus>(); | 107 immersive_context_ = base::MakeUnique<ImmersiveContextMus>(); |
| 40 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>(); | 108 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>(); |
| 41 } | 109 } |
| 42 | 110 |
| 43 session_controller_client_ = base::MakeUnique<SessionControllerClient>(); | 111 session_controller_client_ = base::MakeUnique<SessionControllerClient>(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 vpn_list_forwarder_.reset(); | 153 vpn_list_forwarder_.reset(); |
| 86 volume_controller_.reset(); | 154 volume_controller_.reset(); |
| 87 new_window_client_.reset(); | 155 new_window_client_.reset(); |
| 88 system_tray_client_.reset(); | 156 system_tray_client_.reset(); |
| 89 media_client_.reset(); | 157 media_client_.reset(); |
| 90 cast_config_client_media_router_.reset(); | 158 cast_config_client_media_router_.reset(); |
| 91 session_controller_client_.reset(); | 159 session_controller_client_.reset(); |
| 92 | 160 |
| 93 chrome::CloseAsh(); | 161 chrome::CloseAsh(); |
| 94 } | 162 } |
| OLD | NEW |