| 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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 // signing in with GAIA webview (i.e. webview instance hasn't been | 1355 // signing in with GAIA webview (i.e. webview instance hasn't been |
| 1356 // initialized at all). Use fallback request context if authenticator was | 1356 // initialized at all). Use fallback request context if authenticator was |
| 1357 // provided. | 1357 // provided. |
| 1358 // Authenticator instance may not be initialized for session | 1358 // Authenticator instance may not be initialized for session |
| 1359 // restore case when Chrome is restarting after crash or to apply custom user | 1359 // restore case when Chrome is restarting after crash or to apply custom user |
| 1360 // flags. In that case auth_request_context will be nullptr which is accepted | 1360 // flags. In that case auth_request_context will be nullptr which is accepted |
| 1361 // by RestoreSession() for session restore case. | 1361 // by RestoreSession() for session restore case. |
| 1362 if (!auth_request_context && | 1362 if (!auth_request_context && |
| 1363 (authenticator_.get() && authenticator_->authentication_context())) { | 1363 (authenticator_.get() && authenticator_->authentication_context())) { |
| 1364 auth_request_context = | 1364 auth_request_context = |
| 1365 content::BrowserContext::GetDefaultStoragePartition( | 1365 authenticator_->authentication_context()->GetRequestContext(); |
| 1366 authenticator_->authentication_context())->GetURLRequestContext(); | |
| 1367 } | 1366 } |
| 1368 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, | 1367 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, |
| 1369 user_context_.GetRefreshToken(), | 1368 user_context_.GetRefreshToken(), |
| 1370 user_context_.GetAccessToken()); | 1369 user_context_.GetAccessToken()); |
| 1371 } | 1370 } |
| 1372 | 1371 |
| 1373 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { | 1372 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { |
| 1374 #if defined(ENABLE_RLZ) | 1373 #if defined(ENABLE_RLZ) |
| 1375 PrefService* local_state = g_browser_process->local_state(); | 1374 PrefService* local_state = g_browser_process->local_state(); |
| 1376 if (disabled) { | 1375 if (disabled) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 | 1565 |
| 1567 if (StartupUtils::IsWebviewSigninEnabled()) { | 1566 if (StartupUtils::IsWebviewSigninEnabled()) { |
| 1568 // Webview uses different partition storage than iframe. We need to get | 1567 // Webview uses different partition storage than iframe. We need to get |
| 1569 // cookies from the right storage for url request to get auth token into | 1568 // cookies from the right storage for url request to get auth token into |
| 1570 // session. | 1569 // session. |
| 1571 content::StoragePartition* signin_partition = login::GetSigninPartition(); | 1570 content::StoragePartition* signin_partition = login::GetSigninPartition(); |
| 1572 if (signin_partition) | 1571 if (signin_partition) |
| 1573 auth_request_context = signin_partition->GetURLRequestContext(); | 1572 auth_request_context = signin_partition->GetURLRequestContext(); |
| 1574 } else if (authenticator_.get() && authenticator_->authentication_context()) { | 1573 } else if (authenticator_.get() && authenticator_->authentication_context()) { |
| 1575 auth_request_context = | 1574 auth_request_context = |
| 1576 content::BrowserContext::GetDefaultStoragePartition( | 1575 authenticator_->authentication_context()->GetRequestContext(); |
| 1577 authenticator_->authentication_context())->GetURLRequestContext(); | |
| 1578 } | 1576 } |
| 1579 return auth_request_context; | 1577 return auth_request_context; |
| 1580 } | 1578 } |
| 1581 | 1579 |
| 1582 void UserSessionManager::AttemptRestart(Profile* profile) { | 1580 void UserSessionManager::AttemptRestart(Profile* profile) { |
| 1583 // Restart unconditionally in case if we are stuck somewhere in a session | 1581 // Restart unconditionally in case if we are stuck somewhere in a session |
| 1584 // restore process. http://crbug.com/520346. | 1582 // restore process. http://crbug.com/520346. |
| 1585 base::MessageLoop::current()->PostDelayedTask( | 1583 base::MessageLoop::current()->PostDelayedTask( |
| 1586 FROM_HERE, base::Bind(RestartOnTimeout), | 1584 FROM_HERE, base::Bind(RestartOnTimeout), |
| 1587 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); | 1585 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 token_handle_util_.reset(); | 1822 token_handle_util_.reset(); |
| 1825 first_run::GoodiesDisplayer::Delete(); | 1823 first_run::GoodiesDisplayer::Delete(); |
| 1826 } | 1824 } |
| 1827 | 1825 |
| 1828 void UserSessionManager::CreateTokenUtilIfMissing() { | 1826 void UserSessionManager::CreateTokenUtilIfMissing() { |
| 1829 if (!token_handle_util_.get()) | 1827 if (!token_handle_util_.get()) |
| 1830 token_handle_util_.reset(new TokenHandleUtil()); | 1828 token_handle_util_.reset(new TokenHandleUtil()); |
| 1831 } | 1829 } |
| 1832 | 1830 |
| 1833 } // namespace chromeos | 1831 } // namespace chromeos |
| OLD | NEW |