| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" | 14 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" |
| 15 #include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h" | 15 #include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h" |
| 16 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "google_apis/gaia/gaia_oauth_client.h" | 17 #include "google_apis/gaia/gaia_oauth_client.h" |
| 18 #include "google_apis/gaia/oauth2_token_service.h" | 18 #include "google_apis/gaia/oauth2_token_service.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 20 | 20 |
| 21 class GoogleServiceAuthError; | 21 class GoogleServiceAuthError; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 POST_MERGE_COUNT = 7, | 143 POST_MERGE_COUNT = 7, |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 // KeyedService implementation. | 146 // KeyedService implementation. |
| 147 void Shutdown() override; | 147 void Shutdown() override; |
| 148 | 148 |
| 149 // gaia::GaiaOAuthClient::Delegate overrides. | 149 // gaia::GaiaOAuthClient::Delegate overrides. |
| 150 void OnRefreshTokenResponse(const std::string& access_token, | 150 void OnRefreshTokenResponse(const std::string& access_token, |
| 151 int expires_in_seconds) override; | 151 int expires_in_seconds) override; |
| 152 void OnGetUserInfoResponse( | 152 void OnGetUserInfoResponse( |
| 153 scoped_ptr<base::DictionaryValue> user_info) override; | 153 std::unique_ptr<base::DictionaryValue> user_info) override; |
| 154 void OnOAuthError() override; | 154 void OnOAuthError() override; |
| 155 void OnNetworkError(int response_code) override; | 155 void OnNetworkError(int response_code) override; |
| 156 | 156 |
| 157 // OAuth2LoginVerifier::Delegate overrides. | 157 // OAuth2LoginVerifier::Delegate overrides. |
| 158 void OnSessionMergeSuccess() override; | 158 void OnSessionMergeSuccess() override; |
| 159 void OnSessionMergeFailure(bool connection_error) override; | 159 void OnSessionMergeFailure(bool connection_error) override; |
| 160 void OnListAccountsSuccess( | 160 void OnListAccountsSuccess( |
| 161 const std::vector<gaia::ListedAccount>& accounts) override; | 161 const std::vector<gaia::ListedAccount>& accounts) override; |
| 162 void OnListAccountsFailure(bool connection_error) override; | 162 void OnListAccountsFailure(bool connection_error) override; |
| 163 | 163 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 bool is_pre_merge, | 228 bool is_pre_merge, |
| 229 MergeVerificationOutcome outcome); | 229 MergeVerificationOutcome outcome); |
| 230 | 230 |
| 231 // Keeps the track if we have already reported OAuth2 token being loaded | 231 // Keeps the track if we have already reported OAuth2 token being loaded |
| 232 // by OAuth2TokenService. | 232 // by OAuth2TokenService. |
| 233 Profile* user_profile_; | 233 Profile* user_profile_; |
| 234 scoped_refptr<net::URLRequestContextGetter> auth_request_context_; | 234 scoped_refptr<net::URLRequestContextGetter> auth_request_context_; |
| 235 SessionRestoreStrategy restore_strategy_; | 235 SessionRestoreStrategy restore_strategy_; |
| 236 SessionRestoreState state_; | 236 SessionRestoreState state_; |
| 237 | 237 |
| 238 scoped_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_; | 238 std::unique_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_; |
| 239 scoped_ptr<OAuth2LoginVerifier> login_verifier_; | 239 std::unique_ptr<OAuth2LoginVerifier> login_verifier_; |
| 240 scoped_ptr<gaia::GaiaOAuthClient> account_info_fetcher_; | 240 std::unique_ptr<gaia::GaiaOAuthClient> account_info_fetcher_; |
| 241 | 241 |
| 242 // OAuth2 refresh token. | 242 // OAuth2 refresh token. |
| 243 std::string refresh_token_; | 243 std::string refresh_token_; |
| 244 | 244 |
| 245 // OAuthLogin scoped access token. | 245 // OAuthLogin scoped access token. |
| 246 std::string oauthlogin_access_token_; | 246 std::string oauthlogin_access_token_; |
| 247 | 247 |
| 248 // Session restore start time. | 248 // Session restore start time. |
| 249 base::Time session_restore_start_; | 249 base::Time session_restore_start_; |
| 250 | 250 |
| 251 // List of observers to notify when token availability changes. | 251 // List of observers to notify when token availability changes. |
| 252 // Makes sure list is empty on destruction. | 252 // Makes sure list is empty on destruction. |
| 253 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we | 253 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we |
| 254 // can change the line below to base::ObserverList<Observer, true>. | 254 // can change the line below to base::ObserverList<Observer, true>. |
| 255 base::ObserverList<Observer, false> observer_list_; | 255 base::ObserverList<Observer, false> observer_list_; |
| 256 | 256 |
| 257 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager); | 257 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager); |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 } // namespace chromeos | 260 } // namespace chromeos |
| 261 | 261 |
| 262 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 262 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
| OLD | NEW |