Commit ada2715c authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove unused code from OAuth2LoginManager

Removes oauth2_token_fetcher_ and auth_url_loader_factory_ from
OAuth2LoginManager, as they are no longer used - the usage was removed
in CL:1212962

BUG=None

Change-Id: Ia025818376f239e406dd285cdd288dca164c0ed2
Reviewed-on: https://chromium-review.googlesource.com/c/1347447Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610253}
parent 1e61684c
...@@ -1726,27 +1726,9 @@ void UserSessionManager::RestoreAuthSessionImpl( ...@@ -1726,27 +1726,9 @@ void UserSessionManager::RestoreAuthSessionImpl(
OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile); OAuth2LoginManagerFactory::GetInstance()->GetForProfile(profile);
login_manager->AddObserver(this); login_manager->AddObserver(this);
scoped_refptr<network::SharedURLLoaderFactory> auth_url_loader_factory = login_manager->RestoreSession(session_restore_strategy_,
GetAuthURLLoaderFactory(); user_context_.GetRefreshToken(),
user_context_.GetAccessToken());
// Authentication URLLoaderFactory may not be available if user was not
// signing in with GAIA webview (i.e. webview instance hasn't been
// initialized at all). Use fallback URLLoaderFactory if authenticator was
// provided.
// Authenticator instance may not be initialized for session
// restore case when Chrome is restarting after crash or to apply custom user
// flags. In that case auth_url_loader_factory will be nullptr which is
// accepted by RestoreSession() for session restore case.
if (!auth_url_loader_factory &&
(authenticator_.get() && authenticator_->authentication_context())) {
auth_url_loader_factory =
content::BrowserContext::GetDefaultStoragePartition(
authenticator_->authentication_context())
->GetURLLoaderFactoryForBrowserProcess();
}
login_manager->RestoreSession(
auth_url_loader_factory, session_restore_strategy_,
user_context_.GetRefreshToken(), user_context_.GetAccessToken());
} }
void UserSessionManager::InitRlzImpl(Profile* profile, void UserSessionManager::InitRlzImpl(Profile* profile,
...@@ -1991,15 +1973,6 @@ void UserSessionManager::UpdateEasyUnlockKeys(const UserContext& user_context) { ...@@ -1991,15 +1973,6 @@ void UserSessionManager::UpdateEasyUnlockKeys(const UserContext& user_context) {
user_context.GetAccountId().GetUserEmail())); user_context.GetAccountId().GetUserEmail()));
} }
scoped_refptr<network::SharedURLLoaderFactory>
UserSessionManager::GetAuthURLLoaderFactory() const {
content::StoragePartition* signin_partition = login::GetSigninPartition();
if (!signin_partition)
return nullptr;
return signin_partition->GetURLLoaderFactoryForBrowserProcess();
}
void UserSessionManager::OnEasyUnlockKeyOpsFinished(const std::string& user_id, void UserSessionManager::OnEasyUnlockKeyOpsFinished(const std::string& user_id,
bool success) { bool success) {
const user_manager::User* user = user_manager::UserManager::Get()->FindUser( const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
......
...@@ -47,10 +47,6 @@ namespace base { ...@@ -47,10 +47,6 @@ namespace base {
class CommandLine; class CommandLine;
} }
namespace network {
class SharedURLLoaderFactory;
}
namespace user_manager { namespace user_manager {
class User; class User;
} // namespace user_manager } // namespace user_manager
...@@ -281,11 +277,6 @@ class UserSessionManager ...@@ -281,11 +277,6 @@ class UserSessionManager
// Update Easy unlock cryptohome keys for given user context. // Update Easy unlock cryptohome keys for given user context.
void UpdateEasyUnlockKeys(const UserContext& user_context); void UpdateEasyUnlockKeys(const UserContext& user_context);
// Returns the auth request context/URLLoaderFactory associated with auth
// data.
scoped_refptr<network::SharedURLLoaderFactory> GetAuthURLLoaderFactory()
const;
// Removes a profile from the per-user input methods states map. // Removes a profile from the per-user input methods states map.
void RemoveProfileForTesting(Profile* profile); void RemoveProfileForTesting(Profile* profile);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/gaia_urls.h"
#include "services/identity/public/cpp/identity_manager.h" #include "services/identity/public/cpp/identity_manager.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace chromeos { namespace chromeos {
...@@ -51,12 +50,10 @@ void OAuth2LoginManager::RemoveObserver( ...@@ -51,12 +50,10 @@ void OAuth2LoginManager::RemoveObserver(
} }
void OAuth2LoginManager::RestoreSession( void OAuth2LoginManager::RestoreSession(
scoped_refptr<network::SharedURLLoaderFactory> auth_url_loader_factory,
SessionRestoreStrategy restore_strategy, SessionRestoreStrategy restore_strategy,
const std::string& oauth2_refresh_token, const std::string& oauth2_refresh_token,
const std::string& oauth2_access_token) { const std::string& oauth2_access_token) {
DCHECK(user_profile_); DCHECK(user_profile_);
auth_url_loader_factory_ = auth_url_loader_factory;
restore_strategy_ = restore_strategy; restore_strategy_ = restore_strategy;
refresh_token_ = oauth2_refresh_token; refresh_token_ = oauth2_refresh_token;
oauthlogin_access_token_ = oauth2_access_token; oauthlogin_access_token_ = oauth2_access_token;
...@@ -112,7 +109,6 @@ void OAuth2LoginManager::RestoreSessionFromSavedTokens() { ...@@ -112,7 +109,6 @@ void OAuth2LoginManager::RestoreSessionFromSavedTokens() {
} }
void OAuth2LoginManager::Stop() { void OAuth2LoginManager::Stop() {
oauth2_token_fetcher_.reset();
login_verifier_.reset(); login_verifier_.reset();
} }
...@@ -189,21 +185,6 @@ void OAuth2LoginManager::FireRefreshTokensLoaded() { ...@@ -189,21 +185,6 @@ void OAuth2LoginManager::FireRefreshTokensLoaded() {
GetTokenService()->LoadCredentials(std::string()); GetTokenService()->LoadCredentials(std::string());
} }
void OAuth2LoginManager::OnOAuth2TokensAvailable(
const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) {
VLOG(1) << "OAuth2 tokens fetched";
DCHECK(refresh_token_.empty());
refresh_token_.assign(oauth2_tokens.refresh_token);
oauthlogin_access_token_ = oauth2_tokens.access_token;
StoreOAuth2Token();
}
void OAuth2LoginManager::OnOAuth2TokensFetchFailed() {
LOG(ERROR) << "OAuth2 tokens fetch failed!";
RecordSessionRestoreOutcome(SESSION_RESTORE_TOKEN_FETCH_FAILED,
SESSION_RESTORE_FAILED);
}
void OAuth2LoginManager::VerifySessionCookies() { void OAuth2LoginManager::VerifySessionCookies() {
DCHECK(!login_verifier_.get()); DCHECK(!login_verifier_.get());
login_verifier_.reset(new OAuth2LoginVerifier( login_verifier_.reset(new OAuth2LoginVerifier(
...@@ -226,7 +207,6 @@ void OAuth2LoginManager::RestoreSessionCookies() { ...@@ -226,7 +207,6 @@ void OAuth2LoginManager::RestoreSessionCookies() {
void OAuth2LoginManager::Shutdown() { void OAuth2LoginManager::Shutdown() {
GetTokenService()->RemoveObserver(this); GetTokenService()->RemoveObserver(this);
login_verifier_.reset(); login_verifier_.reset();
oauth2_token_fetcher_.reset();
} }
void OAuth2LoginManager::OnSessionMergeSuccess() { void OAuth2LoginManager::OnSessionMergeSuccess() {
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h"
#include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "google_apis/gaia/oauth2_token_service.h" #include "google_apis/gaia/oauth2_token_service.h"
...@@ -21,17 +20,12 @@ class GoogleServiceAuthError; ...@@ -21,17 +20,12 @@ class GoogleServiceAuthError;
class Profile; class Profile;
class ProfileOAuth2TokenService; class ProfileOAuth2TokenService;
namespace network {
class SharedURLLoaderFactory;
}
namespace chromeos { namespace chromeos {
// This class is responsible for restoring authenticated web sessions out of // This class is responsible for restoring authenticated web sessions out of
// OAuth2 refresh tokens or pre-authenticated cookie jar. // OAuth2 refresh tokens or pre-authenticated cookie jar.
class OAuth2LoginManager : public KeyedService, class OAuth2LoginManager : public KeyedService,
public OAuth2LoginVerifier::Delegate, public OAuth2LoginVerifier::Delegate,
public OAuth2TokenFetcher::Delegate,
public OAuth2TokenService::Observer { public OAuth2TokenService::Observer {
public: public:
// Session restore states. // Session restore states.
...@@ -94,7 +88,6 @@ class OAuth2LoginManager : public KeyedService, ...@@ -94,7 +88,6 @@ class OAuth2LoginManager : public KeyedService,
// |oauth2_refresh_token| needs to have a non-empty value. // |oauth2_refresh_token| needs to have a non-empty value.
// For |restore_strategy| DDEPRECATED_RESTORE_FROM_COOKIE_JAR. // For |restore_strategy| DDEPRECATED_RESTORE_FROM_COOKIE_JAR.
void RestoreSession( void RestoreSession(
scoped_refptr<network::SharedURLLoaderFactory> auth_url_loader_factory,
SessionRestoreStrategy restore_strategy, SessionRestoreStrategy restore_strategy,
const std::string& oauth2_refresh_token, const std::string& oauth2_refresh_token,
const std::string& oauth2_access_token); const std::string& oauth2_access_token);
...@@ -160,11 +153,6 @@ class OAuth2LoginManager : public KeyedService, ...@@ -160,11 +153,6 @@ class OAuth2LoginManager : public KeyedService,
const std::vector<gaia::ListedAccount>& accounts) override; const std::vector<gaia::ListedAccount>& accounts) override;
void OnListAccountsFailure(bool connection_error) override; void OnListAccountsFailure(bool connection_error) override;
// OAuth2TokenFetcher::Delegate overrides.
void OnOAuth2TokensAvailable(
const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override;
void OnOAuth2TokensFetchFailed() override;
// OAuth2TokenService::Observer implementation: // OAuth2TokenService::Observer implementation:
void OnRefreshTokenAvailable(const std::string& user_email) override; void OnRefreshTokenAvailable(const std::string& user_email) override;
...@@ -222,14 +210,12 @@ class OAuth2LoginManager : public KeyedService, ...@@ -222,14 +210,12 @@ class OAuth2LoginManager : public KeyedService,
// Keeps the track if we have already reported OAuth2 token being loaded // Keeps the track if we have already reported OAuth2 token being loaded
// by OAuth2TokenService. // by OAuth2TokenService.
Profile* user_profile_; Profile* user_profile_;
scoped_refptr<network::SharedURLLoaderFactory> auth_url_loader_factory_;
SessionRestoreStrategy restore_strategy_; SessionRestoreStrategy restore_strategy_;
SessionRestoreState state_; SessionRestoreState state_;
// Whether there is pending TokenService::LoadCredentials call. // Whether there is pending TokenService::LoadCredentials call.
bool pending_token_service_load_ = false; bool pending_token_service_load_ = false;
std::unique_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_;
std::unique_ptr<OAuth2LoginVerifier> login_verifier_; std::unique_ptr<OAuth2LoginVerifier> login_verifier_;
// OAuth2 refresh token. // OAuth2 refresh token.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment