| 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 COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ |
| 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const std::vector<std::string>& /* flags */)> | 41 const std::vector<std::string>& /* flags */)> |
| 42 ResultCallback; | 42 ResultCallback; |
| 43 | 43 |
| 44 // Immediately starts fetching the flags. | 44 // Immediately starts fetching the flags. |
| 45 AccountServiceFlagFetcher(const std::string& account_id, | 45 AccountServiceFlagFetcher(const std::string& account_id, |
| 46 ProfileOAuth2TokenService* token_service, | 46 ProfileOAuth2TokenService* token_service, |
| 47 net::URLRequestContextGetter* request_context, | 47 net::URLRequestContextGetter* request_context, |
| 48 const ResultCallback& callback); | 48 const ResultCallback& callback); |
| 49 | 49 |
| 50 // Destructing the object before the callback is called cancels the request. | 50 // Destructing the object before the callback is called cancels the request. |
| 51 virtual ~AccountServiceFlagFetcher(); | 51 ~AccountServiceFlagFetcher() override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 void Start(); | 54 void Start(); |
| 55 void StartFetchingOAuth2AccessToken(); | 55 void StartFetchingOAuth2AccessToken(); |
| 56 | 56 |
| 57 // Overridden from OAuth2TokenService::Observer: | 57 // Overridden from OAuth2TokenService::Observer: |
| 58 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; | 58 void OnRefreshTokenAvailable(const std::string& account_id) override; |
| 59 virtual void OnRefreshTokensLoaded() override; | 59 void OnRefreshTokensLoaded() override; |
| 60 | 60 |
| 61 // Overridden from OAuth2TokenService::Consumer: | 61 // Overridden from OAuth2TokenService::Consumer: |
| 62 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 62 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 63 const std::string& access_token, | 63 const std::string& access_token, |
| 64 const base::Time& expiration_time) override; | 64 const base::Time& expiration_time) override; |
| 65 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 65 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 66 const GoogleServiceAuthError& error) override; | 66 const GoogleServiceAuthError& error) override; |
| 67 | 67 |
| 68 // Overridden from GaiaAuthConsumer: | 68 // Overridden from GaiaAuthConsumer: |
| 69 virtual void OnClientLoginSuccess(const ClientLoginResult& result) override; | 69 void OnClientLoginSuccess(const ClientLoginResult& result) override; |
| 70 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) | 70 void OnClientLoginFailure(const GoogleServiceAuthError& error) override; |
| 71 override; | 71 void OnGetUserInfoSuccess(const UserInfoMap& data) override; |
| 72 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) override; | 72 void OnGetUserInfoFailure(const GoogleServiceAuthError& error) override; |
| 73 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) | |
| 74 override; | |
| 75 | 73 |
| 76 const std::string account_id_; | 74 const std::string account_id_; |
| 77 ProfileOAuth2TokenService* token_service_; | 75 ProfileOAuth2TokenService* token_service_; |
| 78 GaiaAuthFetcher gaia_auth_fetcher_; | 76 GaiaAuthFetcher gaia_auth_fetcher_; |
| 79 | 77 |
| 80 ResultCallback callback_; | 78 ResultCallback callback_; |
| 81 | 79 |
| 82 scoped_ptr<OAuth2TokenService::Request> oauth2_access_token_request_; | 80 scoped_ptr<OAuth2TokenService::Request> oauth2_access_token_request_; |
| 83 | 81 |
| 84 DISALLOW_COPY_AND_ASSIGN(AccountServiceFlagFetcher); | 82 DISALLOW_COPY_AND_ASSIGN(AccountServiceFlagFetcher); |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ | 85 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_SERVICE_FLAG_FETCHER_H_ |
| OLD | NEW |