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

Side by Side Diff: chrome/browser/chromeos/login/session/chrome_session_manager.cc

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. 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
OLDNEW
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
13 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana ger_delegate.h" 13 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana ger_delegate.h"
14 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg ate.h" 14 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg ate.h"
15 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana ger_delegate.h" 15 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana ger_delegate.h"
16 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg ate.h" 16 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg ate.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chromeos/chromeos_switches.h" 18 #include "chromeos/chromeos_switches.h"
19 #include "chromeos/cryptohome/cryptohome_parameters.h"
20 #include "chromeos/login/auth/utils.h"
19 #include "chromeos/login/user_names.h" 21 #include "chromeos/login/user_names.h"
20 #include "components/signin/core/account_id/account_id.h" 22 #include "components/signin/core/account_id/account_id.h"
21 23
22 namespace chromeos { 24 namespace chromeos {
23 25
24 namespace { 26 namespace {
25 27
26 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { 28 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) {
27 KioskAppManager* app_manager = KioskAppManager::Get(); 29 KioskAppManager* app_manager = KioskAppManager::Get();
28 return command_line.HasSwitch(switches::kLoginManager) && 30 return command_line.HasSwitch(switches::kLoginManager) &&
29 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && 31 !command_line.HasSwitch(switches::kForceLoginManagerInTests) &&
30 app_manager->IsAutoLaunchEnabled() && 32 app_manager->IsAutoLaunchEnabled() &&
31 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; 33 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE;
32 } 34 }
33 35
34 } // namespace 36 } // namespace
35 37
36 // static 38 // static
37 scoped_ptr<session_manager::SessionManager> 39 scoped_ptr<session_manager::SessionManager>
38 ChromeSessionManager::CreateSessionManager( 40 ChromeSessionManager::CreateSessionManager(
39 const base::CommandLine& parsed_command_line, 41 const base::CommandLine& parsed_command_line,
40 Profile* profile, 42 Profile* profile,
41 bool is_running_test) { 43 bool is_running_test) {
42 // Tests should be able to tune login manager before showing it. Thus only 44 // Tests should be able to tune login manager before showing it. Thus only
43 // show login UI (login and out-of-box) in normal (non-testing) mode with 45 // show login UI (login and out-of-box) in normal (non-testing) mode with
44 // --login-manager switch and if test passed --force-login-manager-in-tests. 46 // --login-manager switch and if test passed --force-login-manager-in-tests.
45 bool force_login_screen_in_test = 47 bool force_login_screen_in_test =
46 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); 48 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests);
47 49
48 const AccountId login_account_id(AccountId::FromUserEmail( 50 const std::string cryptohome_id =
49 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser))); 51 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser);
52 const AccountId login_account_id(cryptohome::GetAccountId(
53 cryptohome::Identification::FromString(cryptohome_id)));
50 54
51 KioskAppManager::RemoveObsoleteCryptohomes(); 55 KioskAppManager::RemoveObsoleteCryptohomes();
52 56
53 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { 57 if (ShouldAutoLaunchKioskApp(parsed_command_line)) {
54 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; 58 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate";
55 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( 59 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager(
56 new KioskAutoLauncherSessionManagerDelegate())); 60 new KioskAutoLauncherSessionManagerDelegate()));
57 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && 61 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) &&
58 (!is_running_test || force_login_screen_in_test)) { 62 (!is_running_test || force_login_screen_in_test)) {
59 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; 63 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate";
(...skipping 22 matching lines...) Expand all
82 86
83 ChromeSessionManager::ChromeSessionManager( 87 ChromeSessionManager::ChromeSessionManager(
84 session_manager::SessionManagerDelegate* delegate) { 88 session_manager::SessionManagerDelegate* delegate) {
85 Initialize(delegate); 89 Initialize(delegate);
86 } 90 }
87 91
88 ChromeSessionManager::~ChromeSessionManager() { 92 ChromeSessionManager::~ChromeSessionManager() {
89 } 93 }
90 94
91 } // namespace chromeos 95 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698