| 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/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 return false; | 1287 return false; |
| 1288 } | 1288 } |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 DoBrowserLaunch(profile, LoginDisplayHost::default_host()); | 1291 DoBrowserLaunch(profile, LoginDisplayHost::default_host()); |
| 1292 return true; | 1292 return true; |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 void UserSessionManager::InitSessionRestoreStrategy() { | 1295 void UserSessionManager::InitSessionRestoreStrategy() { |
| 1296 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 1296 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 1297 bool in_app_mode = chrome::IsRunningInForcedAppMode(); | 1297 bool in_app_mode = chrome::IsRunningInForcedAppMode() || |
| 1298 chrome::IsRunningInForcedAndroidAppMode(); |
| 1298 | 1299 |
| 1299 // Are we in kiosk app mode? | 1300 // Are we in kiosk app mode? |
| 1300 if (in_app_mode) { | 1301 if (in_app_mode) { |
| 1301 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { | 1302 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { |
| 1302 user_context_.SetRefreshToken(command_line->GetSwitchValueASCII( | 1303 user_context_.SetRefreshToken(command_line->GetSwitchValueASCII( |
| 1303 ::switches::kAppModeOAuth2Token)); | 1304 ::switches::kAppModeOAuth2Token)); |
| 1304 } | 1305 } |
| 1305 | 1306 |
| 1306 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) { | 1307 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) { |
| 1307 user_context_.SetAuthCode(command_line->GetSwitchValueASCII( | 1308 user_context_.SetAuthCode(command_line->GetSwitchValueASCII( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1320 session_restore_strategy_ = | 1321 session_restore_strategy_ = |
| 1321 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; | 1322 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; |
| 1322 } | 1323 } |
| 1323 } | 1324 } |
| 1324 | 1325 |
| 1325 void UserSessionManager::RestoreAuthSessionImpl( | 1326 void UserSessionManager::RestoreAuthSessionImpl( |
| 1326 Profile* profile, | 1327 Profile* profile, |
| 1327 bool restore_from_auth_cookies) { | 1328 bool restore_from_auth_cookies) { |
| 1328 CHECK((authenticator_.get() && authenticator_->authentication_context()) || | 1329 CHECK((authenticator_.get() && authenticator_->authentication_context()) || |
| 1329 !restore_from_auth_cookies); | 1330 !restore_from_auth_cookies); |
| 1330 | |
| 1331 if (chrome::IsRunningInForcedAppMode() || | 1331 if (chrome::IsRunningInForcedAppMode() || |
| 1332 chrome::IsRunningInForcedAndroidAppMode() || |
| 1332 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1333 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1333 chromeos::switches::kDisableGaiaServices)) { | 1334 chromeos::switches::kDisableGaiaServices)) { |
| 1334 return; | 1335 return; |
| 1335 } | 1336 } |
| 1336 | 1337 |
| 1337 exit_after_session_restore_ = false; | 1338 exit_after_session_restore_ = false; |
| 1338 | 1339 |
| 1339 // Remove legacy OAuth1 token if we have one. If it's valid, we should already | 1340 // Remove legacy OAuth1 token if we have one. If it's valid, we should already |
| 1340 // have OAuth2 refresh token in OAuth2TokenService that could be used to | 1341 // have OAuth2 refresh token in OAuth2TokenService that could be used to |
| 1341 // retrieve all other tokens and user_context. | 1342 // retrieve all other tokens and user_context. |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 ->browser_policy_connector_chromeos() | 1872 ->browser_policy_connector_chromeos() |
| 1872 ->IsEnterpriseManaged()) { | 1873 ->IsEnterpriseManaged()) { |
| 1873 return false; | 1874 return false; |
| 1874 } | 1875 } |
| 1875 | 1876 |
| 1876 // Do not show end of life notification if this is a guest session | 1877 // Do not show end of life notification if this is a guest session |
| 1877 return !profile->IsGuestSession(); | 1878 return !profile->IsGuestSession(); |
| 1878 } | 1879 } |
| 1879 | 1880 |
| 1880 } // namespace chromeos | 1881 } // namespace chromeos |
| OLD | NEW |