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

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

Issue 2573703003: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: rebase on session change, fix tests Created 4 years 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/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h"
10 #include "base/lazy_instance.h"
11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
13 #include "build/build_config.h"
14 #include "chrome/browser/chrome_browser_main.h" 10 #include "chrome/browser/chrome_browser_main.h"
15 #include "chrome/browser/ui/ash/ash_init.h" 11 #include "chrome/browser/ui/ash/ash_init.h"
16 #include "chrome/browser/ui/ash/ash_util.h" 12 #include "chrome/browser/ui/ash/ash_util.h"
17 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" 13 #include "chrome/browser/ui/ash/cast_config_client_media_router.h"
18 #include "chrome/browser/ui/ash/chrome_new_window_client.h" 14 #include "chrome/browser/ui/ash/chrome_new_window_client.h"
19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h" 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h"
20 #include "chrome/browser/ui/ash/media_client.h" 16 #include "chrome/browser/ui/ash/media_client.h"
21 #include "chrome/browser/ui/views/ash/tab_scrubber.h"
22 #include "chrome/browser/ui/views/frame/immersive_context_mus.h"
23 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h"
24 #include "chrome/common/chrome_switches.h"
25 #include "ui/aura/env.h"
26 #include "ui/keyboard/content/keyboard.h"
27 #include "ui/keyboard/keyboard_controller.h"
28
29 #if defined(OS_CHROMEOS)
30 #include "chrome/browser/ui/ash/session_controller_client.h" 17 #include "chrome/browser/ui/ash/session_controller_client.h"
31 #include "chrome/browser/ui/ash/system_tray_client.h" 18 #include "chrome/browser/ui/ash/system_tray_client.h"
32 #include "chrome/browser/ui/ash/volume_controller.h" 19 #include "chrome/browser/ui/ash/volume_controller.h"
33 #include "chrome/browser/ui/ash/vpn_list_forwarder.h" 20 #include "chrome/browser/ui/ash/vpn_list_forwarder.h"
21 #include "chrome/browser/ui/views/ash/tab_scrubber.h"
22 #include "chrome/browser/ui/views/frame/immersive_context_mus.h"
23 #include "chrome/browser/ui/views/frame/immersive_handler_factory_mus.h"
34 #include "chrome/browser/ui/views/select_file_dialog_extension.h" 24 #include "chrome/browser/ui/views/select_file_dialog_extension.h"
35 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" 25 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h"
36 #endif // defined(OS_CHROMEOS) 26 #include "ui/keyboard/content/keyboard.h"
27 #include "ui/keyboard/keyboard_controller.h"
37 28
38 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {} 29 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {}
39 30
40 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {} 31 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {}
41 32
42 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { 33 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
43 if (chrome::ShouldOpenAshOnStartup()) 34 if (chrome::ShouldOpenAshOnStartup())
44 chrome::OpenAsh(gfx::kNullAcceleratedWidget); 35 chrome::OpenAsh(gfx::kNullAcceleratedWidget);
45 36
46 if (chrome::IsRunningInMash()) { 37 if (chrome::IsRunningInMash()) {
47 immersive_context_ = base::MakeUnique<ImmersiveContextMus>(); 38 immersive_context_ = base::MakeUnique<ImmersiveContextMus>();
48 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>(); 39 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>();
49 } 40 }
50 41
51 #if defined(OS_CHROMEOS) 42 session_controller_client_ = base::MakeUnique<SessionControllerClient>();
52 // TODO(xiyuan): Update after SesssionStateDelegate is deprecated.
53 if (chrome::IsRunningInMash())
54 session_controller_client_ = base::MakeUnique<SessionControllerClient>();
55 43
56 // Must be available at login screen, so initialize before profile. 44 // Must be available at login screen, so initialize before profile.
57 system_tray_client_ = base::MakeUnique<SystemTrayClient>(); 45 system_tray_client_ = base::MakeUnique<SystemTrayClient>();
58 new_window_client_ = base::MakeUnique<ChromeNewWindowClient>(); 46 new_window_client_ = base::MakeUnique<ChromeNewWindowClient>();
59 volume_controller_ = base::MakeUnique<VolumeController>(); 47 volume_controller_ = base::MakeUnique<VolumeController>();
60 vpn_list_forwarder_ = base::MakeUnique<VpnListForwarder>(); 48 vpn_list_forwarder_ = base::MakeUnique<VpnListForwarder>();
61 49
62 // For OS_CHROMEOS, virtual keyboard needs to be initialized before profile 50 // For OS_CHROMEOS, virtual keyboard needs to be initialized before profile
63 // initialized. Otherwise, virtual keyboard extension will not load at login 51 // initialized. Otherwise, virtual keyboard extension will not load at login
64 // screen. 52 // screen.
65 keyboard::InitializeKeyboard(); 53 keyboard::InitializeKeyboard();
66 54
67 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); 55 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory);
68 #endif // defined(OS_CHROMEOS)
69 } 56 }
70 57
71 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { 58 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
72 if (chrome::IsRunningInMash()) { 59 if (chrome::IsRunningInMash()) {
73 DCHECK(!ash::Shell::HasInstance()); 60 DCHECK(!ash::Shell::HasInstance());
74 DCHECK(!ChromeLauncherController::instance()); 61 DCHECK(!ChromeLauncherController::instance());
75 chrome_launcher_controller_mus_ = 62 chrome_launcher_controller_mus_ =
76 base::MakeUnique<ChromeLauncherControllerMus>(); 63 base::MakeUnique<ChromeLauncherControllerMus>();
77 chrome_launcher_controller_mus_->Init(); 64 chrome_launcher_controller_mus_->Init();
78 } 65 }
79 66
80 cast_config_client_media_router_ = 67 cast_config_client_media_router_ =
81 base::MakeUnique<CastConfigClientMediaRouter>(); 68 base::MakeUnique<CastConfigClientMediaRouter>();
82 media_client_ = base::MakeUnique<MediaClient>(); 69 media_client_ = base::MakeUnique<MediaClient>();
83 70
84 if (!ash::Shell::HasInstance()) 71 if (!ash::Shell::HasInstance())
85 return; 72 return;
86 73
87 // Initialize TabScrubber after the Ash Shell has been initialized. 74 // Initialize TabScrubber after the Ash Shell has been initialized.
88 TabScrubber::GetInstance(); 75 TabScrubber::GetInstance();
89 // Activate virtual keyboard after profile is initialized. It depends on the 76 // Activate virtual keyboard after profile is initialized. It depends on the
90 // default profile. 77 // default profile.
91 ash::Shell::GetPrimaryRootWindowController()->ActivateKeyboard( 78 ash::Shell::GetPrimaryRootWindowController()->ActivateKeyboard(
92 keyboard::KeyboardController::GetInstance()); 79 keyboard::KeyboardController::GetInstance());
93 } 80 }
94 81
95 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { 82 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() {
96 #if defined(OS_CHROMEOS)
97 vpn_list_forwarder_.reset(); 83 vpn_list_forwarder_.reset();
98 volume_controller_.reset(); 84 volume_controller_.reset();
99 new_window_client_.reset(); 85 new_window_client_.reset();
100 system_tray_client_.reset(); 86 system_tray_client_.reset();
101 media_client_.reset(); 87 media_client_.reset();
102 cast_config_client_media_router_.reset(); 88 cast_config_client_media_router_.reset();
103 session_controller_client_.reset(); 89 session_controller_client_.reset();
104 #endif 90
105 chrome::CloseAsh(); 91 chrome::CloseAsh();
106 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698