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

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

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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/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
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 authenticator_->authentication_context()->GetRequestContext(); 1365 content::BrowserContext::GetDefaultStoragePartition(
1366 authenticator_->authentication_context())->GetURLRequestContext();
1366 } 1367 }
1367 login_manager->RestoreSession(auth_request_context, session_restore_strategy_, 1368 login_manager->RestoreSession(auth_request_context, session_restore_strategy_,
1368 user_context_.GetRefreshToken(), 1369 user_context_.GetRefreshToken(),
1369 user_context_.GetAccessToken()); 1370 user_context_.GetAccessToken());
1370 } 1371 }
1371 1372
1372 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) { 1373 void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
1373 #if defined(ENABLE_RLZ) 1374 #if defined(ENABLE_RLZ)
1374 PrefService* local_state = g_browser_process->local_state(); 1375 PrefService* local_state = g_browser_process->local_state();
1375 if (disabled) { 1376 if (disabled) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 1566
1566 if (StartupUtils::IsWebviewSigninEnabled()) { 1567 if (StartupUtils::IsWebviewSigninEnabled()) {
1567 // Webview uses different partition storage than iframe. We need to get 1568 // Webview uses different partition storage than iframe. We need to get
1568 // cookies from the right storage for url request to get auth token into 1569 // cookies from the right storage for url request to get auth token into
1569 // session. 1570 // session.
1570 content::StoragePartition* signin_partition = login::GetSigninPartition(); 1571 content::StoragePartition* signin_partition = login::GetSigninPartition();
1571 if (signin_partition) 1572 if (signin_partition)
1572 auth_request_context = signin_partition->GetURLRequestContext(); 1573 auth_request_context = signin_partition->GetURLRequestContext();
1573 } else if (authenticator_.get() && authenticator_->authentication_context()) { 1574 } else if (authenticator_.get() && authenticator_->authentication_context()) {
1574 auth_request_context = 1575 auth_request_context =
1575 authenticator_->authentication_context()->GetRequestContext(); 1576 content::BrowserContext::GetDefaultStoragePartition(
1577 authenticator_->authentication_context())->GetURLRequestContext();
1576 } 1578 }
1577 return auth_request_context; 1579 return auth_request_context;
1578 } 1580 }
1579 1581
1580 void UserSessionManager::AttemptRestart(Profile* profile) { 1582 void UserSessionManager::AttemptRestart(Profile* profile) {
1581 // Restart unconditionally in case if we are stuck somewhere in a session 1583 // Restart unconditionally in case if we are stuck somewhere in a session
1582 // restore process. http://crbug.com/520346. 1584 // restore process. http://crbug.com/520346.
1583 base::MessageLoop::current()->PostDelayedTask( 1585 base::MessageLoop::current()->PostDelayedTask(
1584 FROM_HERE, base::Bind(RestartOnTimeout), 1586 FROM_HERE, base::Bind(RestartOnTimeout),
1585 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); 1587 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds));
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 token_handle_util_.reset(); 1824 token_handle_util_.reset();
1823 first_run::GoodiesDisplayer::Delete(); 1825 first_run::GoodiesDisplayer::Delete();
1824 } 1826 }
1825 1827
1826 void UserSessionManager::CreateTokenUtilIfMissing() { 1828 void UserSessionManager::CreateTokenUtilIfMissing() {
1827 if (!token_handle_util_.get()) 1829 if (!token_handle_util_.get())
1828 token_handle_util_.reset(new TokenHandleUtil()); 1830 token_handle_util_.reset(new TokenHandleUtil());
1829 } 1831 }
1830 1832
1831 } // namespace chromeos 1833 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698