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

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc

Issue 1466143002: arc-bridge: Enable ARC with a command-line flag (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased to ToT Created 5 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
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include "ash/accelerators/magnifier_key_scroller.h" 7 #include "ash/accelerators/magnifier_key_scroller.h"
8 #include "ash/accelerators/spoken_feedback_toggler.h" 8 #include "ash/accelerators/spoken_feedback_toggler.h"
9 #include "ash/accessibility_delegate.h" 9 #include "ash/accessibility_delegate.h"
10 #include "ash/wm/mru_window_tracker.h" 10 #include "ash/wm/mru_window_tracker.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 29 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
30 #include "chrome/browser/ui/ash/media_delegate_chromeos.h" 30 #include "chrome/browser/ui/ash/media_delegate_chromeos.h"
31 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 31 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
32 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 32 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
33 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 33 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
34 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_finder.h" 35 #include "chrome/browser/ui/browser_finder.h"
36 #include "chrome/browser/ui/browser_window.h" 36 #include "chrome/browser/ui/browser_window.h"
37 #include "chrome/grit/generated_resources.h" 37 #include "chrome/grit/generated_resources.h"
38 #include "chromeos/chromeos_switches.h" 38 #include "chromeos/chromeos_switches.h"
39 #include "components/arc/arc_bridge_service.h"
39 #include "content/public/browser/notification_service.h" 40 #include "content/public/browser/notification_service.h"
40 #include "content/public/browser/user_metrics.h" 41 #include "content/public/browser/user_metrics.h"
41 #include "ui/aura/window.h" 42 #include "ui/aura/window.h"
42 #include "ui/base/ime/chromeos/input_method_manager.h" 43 #include "ui/base/ime/chromeos/input_method_manager.h"
43 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
44 45
45 #if defined(ENABLE_ARC)
46 #include "components/arc/arc_bridge_service.h"
47 #endif
48
49 namespace { 46 namespace {
50 47
51 void InitAfterFirstSessionStart() { 48 void InitAfterFirstSessionStart() {
52 // Restore focus after the user session is started. It's needed because some 49 // Restore focus after the user session is started. It's needed because some
53 // windows can be opened in background while login UI is still active because 50 // windows can be opened in background while login UI is still active because
54 // we currently restore browser windows before login UI is deleted. 51 // we currently restore browser windows before login UI is deleted.
55 ash::Shell* shell = ash::Shell::GetInstance(); 52 ash::Shell* shell = ash::Shell::GetInstance();
56 ash::MruWindowTracker::WindowList mru_list = 53 ash::MruWindowTracker::WindowList mru_list =
57 shell->mru_window_tracker()->BuildMruWindowList(); 54 shell->mru_window_tracker()->BuildMruWindowList();
58 if (!mru_list.empty()) 55 if (!mru_list.empty())
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 222
226 void ChromeShellDelegate::PreInit() { 223 void ChromeShellDelegate::PreInit() {
227 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); 224 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot());
228 // Object owns itself, and deletes itself when Observer::OnShutdown is called: 225 // Object owns itself, and deletes itself when Observer::OnShutdown is called:
229 new policy::DisplayRotationDefaultHandler(); 226 new policy::DisplayRotationDefaultHandler();
230 // Set the observer now so that we can save the initial state 227 // Set the observer now so that we can save the initial state
231 // in Shell::Init. 228 // in Shell::Init.
232 display_configuration_observer_.reset( 229 display_configuration_observer_.reset(
233 new chromeos::DisplayConfigurationObserver()); 230 new chromeos::DisplayConfigurationObserver());
234 231
235 #if defined(ENABLE_ARC)
236 arc_session_observer_.reset(new ArcSessionObserver); 232 arc_session_observer_.reset(new ArcSessionObserver);
237 #endif
238 233
239 chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder); 234 chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder);
240 } 235 }
241 236
242 void ChromeShellDelegate::PreShutdown() { 237 void ChromeShellDelegate::PreShutdown() {
243 display_configuration_observer_.reset(); 238 display_configuration_observer_.reset();
244 239
245 #if defined(ENABLE_ARC)
246 // Remove the ARC observer now since it uses the ash::Shell instance in its 240 // Remove the ARC observer now since it uses the ash::Shell instance in its
247 // destructor, which is unavailable after PreShutdown() returns. 241 // destructor, which is unavailable after PreShutdown() returns.
248 arc_session_observer_.reset(); 242 arc_session_observer_.reset();
249 #endif
250 243
251 chrome_user_metrics_recorder_.reset(); 244 chrome_user_metrics_recorder_.reset();
252 } 245 }
253 246
254 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { 247 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
255 return new SessionStateDelegateChromeos; 248 return new SessionStateDelegateChromeos;
256 } 249 }
257 250
258 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { 251 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
259 return new AccessibilityDelegateImpl; 252 return new AccessibilityDelegateImpl;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 302
310 void ChromeShellDelegate::PlatformInit() { 303 void ChromeShellDelegate::PlatformInit() {
311 registrar_.Add(this, 304 registrar_.Add(this,
312 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 305 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
313 content::NotificationService::AllSources()); 306 content::NotificationService::AllSources());
314 registrar_.Add(this, 307 registrar_.Add(this,
315 chrome::NOTIFICATION_SESSION_STARTED, 308 chrome::NOTIFICATION_SESSION_STARTED,
316 content::NotificationService::AllSources()); 309 content::NotificationService::AllSources());
317 } 310 }
318 311
319 #if defined(ENABLE_ARC)
320 ChromeShellDelegate::ArcSessionObserver::ArcSessionObserver() { 312 ChromeShellDelegate::ArcSessionObserver::ArcSessionObserver() {
321 ash::Shell::GetInstance()->AddShellObserver(this); 313 ash::Shell::GetInstance()->AddShellObserver(this);
322 } 314 }
323 315
324 ChromeShellDelegate::ArcSessionObserver::~ArcSessionObserver() { 316 ChromeShellDelegate::ArcSessionObserver::~ArcSessionObserver() {
325 ash::Shell::GetInstance()->RemoveShellObserver(this); 317 ash::Shell::GetInstance()->RemoveShellObserver(this);
326 } 318 }
327 319
328 void ChromeShellDelegate::ArcSessionObserver::OnLoginStateChanged( 320 void ChromeShellDelegate::ArcSessionObserver::OnLoginStateChanged(
329 ash::user::LoginStatus status) { 321 ash::user::LoginStatus status) {
330 switch (status) { 322 switch (status) {
331 case ash::user::LOGGED_IN_LOCKED: 323 case ash::user::LOGGED_IN_LOCKED:
332 case ash::user::LOGGED_IN_KIOSK_APP: 324 case ash::user::LOGGED_IN_KIOSK_APP:
333 return; 325 return;
334 326
335 case ash::user::LOGGED_IN_NONE: 327 case ash::user::LOGGED_IN_NONE:
336 arc::ArcBridgeService::Get()->Shutdown(); 328 arc::ArcBridgeService::Get()->Shutdown();
337 break; 329 break;
338 330
339 case ash::user::LOGGED_IN_USER: 331 case ash::user::LOGGED_IN_USER:
340 case ash::user::LOGGED_IN_OWNER: 332 case ash::user::LOGGED_IN_OWNER:
341 case ash::user::LOGGED_IN_GUEST: 333 case ash::user::LOGGED_IN_GUEST:
342 case ash::user::LOGGED_IN_PUBLIC: 334 case ash::user::LOGGED_IN_PUBLIC:
343 case ash::user::LOGGED_IN_SUPERVISED: 335 case ash::user::LOGGED_IN_SUPERVISED:
344 arc::ArcBridgeService::Get()->HandleStartup(); 336 if (arc::ArcBridgeService::GetEnabled(
337 base::CommandLine::ForCurrentProcess())) {
338 arc::ArcBridgeService::Get()->HandleStartup();
339 }
345 break; 340 break;
346 } 341 }
347 } 342 }
348 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698