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

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

Issue 2915223002: mash: Fix mash app shelf items; encapsulate ash property setup. (Closed)
Patch Set: Similar changes for other mash apps. Created 3 years, 6 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
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/public/cpp/mus_property_mirror_ash.h"
8 #include "ash/public/cpp/window_pin_type.h"
9 #include "ash/public/cpp/window_properties.h" 7 #include "ash/public/cpp/window_properties.h"
10 #include "ash/public/interfaces/window_pin_type.mojom.h"
11 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
12 #include "ash/shelf/shelf_model.h" 9 #include "ash/shelf/shelf_model.h"
13 #include "ash/shell.h" 10 #include "ash/shell.h"
14 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
15 #include "chrome/browser/chrome_browser_main.h" 12 #include "chrome/browser/chrome_browser_main.h"
16 #include "chrome/browser/ui/ash/ash_init.h" 13 #include "chrome/browser/ui/ash/ash_init.h"
17 #include "chrome/browser/ui/ash/ash_util.h" 14 #include "chrome/browser/ui/ash/ash_util.h"
18 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" 15 #include "chrome/browser/ui/ash/cast_config_client_media_router.h"
19 #include "chrome/browser/ui/ash/chrome_new_window_client.h" 16 #include "chrome/browser/ui/ash/chrome_new_window_client.h"
20 #include "chrome/browser/ui/ash/chrome_shell_content_state.h" 17 #include "chrome/browser/ui/ash/chrome_shell_content_state.h"
21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
22 #include "chrome/browser/ui/ash/lock_screen_client.h" 19 #include "chrome/browser/ui/ash/lock_screen_client.h"
23 #include "chrome/browser/ui/ash/media_client.h" 20 #include "chrome/browser/ui/ash/media_client.h"
24 #include "chrome/browser/ui/ash/session_controller_client.h" 21 #include "chrome/browser/ui/ash/session_controller_client.h"
25 #include "chrome/browser/ui/ash/system_tray_client.h" 22 #include "chrome/browser/ui/ash/system_tray_client.h"
26 #include "chrome/browser/ui/ash/volume_controller.h" 23 #include "chrome/browser/ui/ash/volume_controller.h"
27 #include "chrome/browser/ui/ash/vpn_list_forwarder.h" 24 #include "chrome/browser/ui/ash/vpn_list_forwarder.h"
28 #include "chrome/browser/ui/views/ash/tab_scrubber.h" 25 #include "chrome/browser/ui/views/ash/tab_scrubber.h"
29 #include "chrome/browser/ui/views/frame/immersive_context_mus.h" 26 #include "chrome/browser/ui/views/frame/immersive_context_mus.h"
30 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h" 27 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h"
31 #include "chrome/browser/ui/views/select_file_dialog_extension.h" 28 #include "chrome/browser/ui/views/select_file_dialog_extension.h"
32 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" 29 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h"
33 #include "ui/aura/mus/property_converter.h"
34 #include "ui/base/class_property.h"
35 #include "ui/keyboard/content/keyboard.h" 30 #include "ui/keyboard/content/keyboard.h"
36 #include "ui/keyboard/keyboard_controller.h" 31 #include "ui/keyboard/keyboard_controller.h"
37 #include "ui/views/mus/mus_client.h"
38 32
39 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} 33 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {}
40 34
41 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} 35 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {}
42 36
43 void ChromeBrowserMainExtraPartsAsh::ServiceManagerConnectionStarted( 37 void ChromeBrowserMainExtraPartsAsh::ServiceManagerConnectionStarted(
44 content::ServiceManagerConnection* connection) { 38 content::ServiceManagerConnection* connection) {
45 if (ash_util::IsRunningInMash()) { 39 if (ash_util::IsRunningInMash()) {
46 // ash::Shell will not be created because ash is running out-of-process. 40 // ash::Shell will not be created because ash is running out-of-process.
47 ash::Shell::SetIsBrowserProcessWithMash(); 41 ash::Shell::SetIsBrowserProcessWithMash();
48 42
49 // Register ash-specific window properties with Chrome's property converter. 43 ash::RegisterWindowPropertiesForTransportAndMirroring();
50 // This propagates ash properties set on chrome windows to ash, via mojo.
51 DCHECK(views::MusClient::Exists());
52 views::MusClient* mus_client = views::MusClient::Get();
53 aura::WindowTreeClientDelegate* delegate = mus_client;
54 aura::PropertyConverter* converter = delegate->GetPropertyConverter();
55
56 converter->RegisterPrimitiveProperty(
57 ash::kPanelAttachedKey,
58 ui::mojom::WindowManager::kPanelAttached_Property,
59 aura::PropertyConverter::CreateAcceptAnyValueCallback());
60 converter->RegisterPrimitiveProperty(
61 ash::kShelfItemTypeKey,
62 ui::mojom::WindowManager::kShelfItemType_Property,
63 base::Bind(&ash::IsValidShelfItemType));
64 converter->RegisterPrimitiveProperty(
65 ash::kWindowPinTypeKey, ash::mojom::kWindowPinType_Property,
66 base::Bind(&ash::IsValidWindowPinType));
67 converter->RegisterStringProperty(
68 ash::kShelfIDKey, ui::mojom::WindowManager::kShelfID_Property);
sky 2017/06/02 13:36:39 Ideally clients would not have to do anything spec
msw 2017/06/02 15:25:15 We would need some way to (a) disambiguate windows
69
70 mus_client->SetMusPropertyMirror(
71 base::MakeUnique<ash::MusPropertyMirrorAsh>());
72 } 44 }
73 } 45 }
74 46
75 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { 47 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
76 if (ash_util::ShouldOpenAshOnStartup()) 48 if (ash_util::ShouldOpenAshOnStartup())
77 ash_init_ = base::MakeUnique<AshInit>(); 49 ash_init_ = base::MakeUnique<AshInit>();
78 50
79 if (ash_util::IsRunningInMash()) { 51 if (ash_util::IsRunningInMash()) {
80 immersive_context_ = base::MakeUnique<ImmersiveContextMus>(); 52 immersive_context_ = base::MakeUnique<ImmersiveContextMus>();
81 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>(); 53 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 volume_controller_.reset(); 104 volume_controller_.reset();
133 new_window_client_.reset(); 105 new_window_client_.reset();
134 system_tray_client_.reset(); 106 system_tray_client_.reset();
135 lock_screen_client_.reset(); 107 lock_screen_client_.reset();
136 media_client_.reset(); 108 media_client_.reset();
137 cast_config_client_media_router_.reset(); 109 cast_config_client_media_router_.reset();
138 session_controller_client_.reset(); 110 session_controller_client_.reset();
139 111
140 ash_init_.reset(); 112 ash_init_.reset();
141 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698