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

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

Issue 1618193003: arc: Pass auth token from Chrome to ARC instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update BUILD.gn Created 4 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 | « 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 19 matching lines...) Expand all
30 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 30 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
31 #include "chrome/browser/ui/ash/media_delegate_chromeos.h" 31 #include "chrome/browser/ui/ash/media_delegate_chromeos.h"
32 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 32 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
33 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 33 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
34 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 34 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
35 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
36 #include "chrome/browser/ui/browser_finder.h" 36 #include "chrome/browser/ui/browser_finder.h"
37 #include "chrome/browser/ui/browser_window.h" 37 #include "chrome/browser/ui/browser_window.h"
38 #include "chrome/grit/generated_resources.h" 38 #include "chrome/grit/generated_resources.h"
39 #include "chromeos/chromeos_switches.h" 39 #include "chromeos/chromeos_switches.h"
40 #include "components/arc/arc_bridge_service.h"
41 #include "components/arc/arc_service_manager.h"
42 #include "content/public/browser/notification_service.h" 40 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/user_metrics.h" 41 #include "content/public/browser/user_metrics.h"
44 #include "ui/aura/window.h" 42 #include "ui/aura/window.h"
45 #include "ui/base/ime/chromeos/input_method_manager.h" 43 #include "ui/base/ime/chromeos/input_method_manager.h"
46 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
47 45
48 namespace { 46 namespace {
49 47
50 void InitAfterFirstSessionStart() { 48 void InitAfterFirstSessionStart() {
51 // 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
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 222
225 void ChromeShellDelegate::PreInit() { 223 void ChromeShellDelegate::PreInit() {
226 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); 224 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot());
227 // Object owns itself, and deletes itself when Observer::OnShutdown is called: 225 // Object owns itself, and deletes itself when Observer::OnShutdown is called:
228 new policy::DisplayRotationDefaultHandler(); 226 new policy::DisplayRotationDefaultHandler();
229 // 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
230 // in Shell::Init. 228 // in Shell::Init.
231 display_configuration_observer_.reset( 229 display_configuration_observer_.reset(
232 new chromeos::DisplayConfigurationObserver()); 230 new chromeos::DisplayConfigurationObserver());
233 231
234 arc_session_observer_.reset(new ArcSessionObserver);
235
236 chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder); 232 chrome_user_metrics_recorder_.reset(new ChromeUserMetricsRecorder);
237 } 233 }
238 234
239 void ChromeShellDelegate::PreShutdown() { 235 void ChromeShellDelegate::PreShutdown() {
240 display_configuration_observer_.reset(); 236 display_configuration_observer_.reset();
241 237
242 // Remove the ARC observer now since it uses the ash::Shell instance in its
243 // destructor, which is unavailable after PreShutdown() returns.
244 arc_session_observer_.reset();
245
246 chrome_user_metrics_recorder_.reset(); 238 chrome_user_metrics_recorder_.reset();
247 } 239 }
248 240
249 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { 241 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
250 return new SessionStateDelegateChromeos; 242 return new SessionStateDelegateChromeos;
251 } 243 }
252 244
253 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { 245 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
254 return new AccessibilityDelegateImpl; 246 return new AccessibilityDelegateImpl;
255 } 247 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 295 }
304 296
305 void ChromeShellDelegate::PlatformInit() { 297 void ChromeShellDelegate::PlatformInit() {
306 registrar_.Add(this, 298 registrar_.Add(this,
307 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 299 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
308 content::NotificationService::AllSources()); 300 content::NotificationService::AllSources());
309 registrar_.Add(this, 301 registrar_.Add(this,
310 chrome::NOTIFICATION_SESSION_STARTED, 302 chrome::NOTIFICATION_SESSION_STARTED,
311 content::NotificationService::AllSources()); 303 content::NotificationService::AllSources());
312 } 304 }
313
314 ChromeShellDelegate::ArcSessionObserver::ArcSessionObserver() {
315 ash::Shell::GetInstance()->AddShellObserver(this);
316 }
317
318 ChromeShellDelegate::ArcSessionObserver::~ArcSessionObserver() {
319 ash::Shell::GetInstance()->RemoveShellObserver(this);
320 }
321
322 void ChromeShellDelegate::ArcSessionObserver::OnLoginStateChanged(
323 ash::user::LoginStatus status) {
324 switch (status) {
325 case ash::user::LOGGED_IN_LOCKED:
326 case ash::user::LOGGED_IN_KIOSK_APP:
327 return;
328
329 case ash::user::LOGGED_IN_NONE:
330 arc::ArcServiceManager::Get()->arc_bridge_service()->Shutdown();
331 break;
332
333 case ash::user::LOGGED_IN_USER:
334 case ash::user::LOGGED_IN_OWNER:
335 case ash::user::LOGGED_IN_GUEST:
336 case ash::user::LOGGED_IN_PUBLIC:
337 case ash::user::LOGGED_IN_SUPERVISED:
338 if (arc::ArcBridgeService::GetEnabled(
339 base::CommandLine::ForCurrentProcess())) {
340 arc::ArcServiceManager::Get()->arc_bridge_service()->HandleStartup();
341 }
342 break;
343 }
344 }
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