| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/session/chrome_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/chrome_session_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 14 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" | 15 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" |
| 15 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" | 16 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" |
| 16 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" | 17 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" |
| 17 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" | 18 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 20 #include "chromeos/cryptohome/cryptohome_parameters.h" | 21 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 21 #include "chromeos/login/user_names.h" | 22 #include "chromeos/login/user_names.h" |
| 22 #include "components/signin/core/account_id/account_id.h" | 23 #include "components/signin/core/account_id/account_id.h" |
| 24 #include "components/user_manager/user_manager.h" |
| 25 #include "content/public/browser/notification_service.h" |
| 23 | 26 |
| 24 namespace chromeos { | 27 namespace chromeos { |
| 25 | 28 |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 28 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { | 31 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { |
| 29 KioskAppManager* app_manager = KioskAppManager::Get(); | 32 KioskAppManager* app_manager = KioskAppManager::Get(); |
| 30 return command_line.HasSwitch(switches::kLoginManager) && | 33 return command_line.HasSwitch(switches::kLoginManager) && |
| 31 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && | 34 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && |
| 32 app_manager->IsAutoLaunchEnabled() && | 35 app_manager->IsAutoLaunchEnabled() && |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 89 } |
| 87 | 90 |
| 88 ChromeSessionManager::ChromeSessionManager( | 91 ChromeSessionManager::ChromeSessionManager( |
| 89 session_manager::SessionManagerDelegate* delegate) { | 92 session_manager::SessionManagerDelegate* delegate) { |
| 90 Initialize(delegate); | 93 Initialize(delegate); |
| 91 } | 94 } |
| 92 | 95 |
| 93 ChromeSessionManager::~ChromeSessionManager() { | 96 ChromeSessionManager::~ChromeSessionManager() { |
| 94 } | 97 } |
| 95 | 98 |
| 99 void ChromeSessionManager::SessionStarted() { |
| 100 session_manager::SessionManager::SessionStarted(); |
| 101 SetSessionState(session_manager::SessionState::ACTIVE); |
| 102 |
| 103 // Notifies UserManager so that it can update login state. |
| 104 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 105 if (user_manager) |
| 106 user_manager->OnSessionStarted(); |
| 107 |
| 108 content::NotificationService::current()->Notify( |
| 109 chrome::NOTIFICATION_SESSION_STARTED, |
| 110 content::Source<session_manager::SessionManager>(this), |
| 111 content::Details<const user_manager::User>( |
| 112 user_manager->GetActiveUser())); |
| 113 } |
| 114 |
| 96 } // namespace chromeos | 115 } // namespace chromeos |
| OLD | NEW |