| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 6 #define CHROME_BROWSER_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 9 #include "components/webdata/common/web_data_service_base.h" | 9 #include "components/webdata/common/web_data_service_base.h" |
| 10 #include "components/webdata/common/web_data_service_consumer.h" | 10 #include "components/webdata/common/web_data_service_consumer.h" |
| 11 | 11 |
| 12 // A specialization of ProfileOAuth2TokenService that can can mutate its OAuth2 | 12 // A specialization of ProfileOAuth2TokenService that can can mutate its OAuth2 |
| 13 // tokens. | 13 // tokens. |
| 14 // | 14 // |
| 15 // Note: This class is just a placeholder for now. Methods used to mutate | 15 // Note: This class is just a placeholder for now. Methods used to mutate |
| 16 // the tokens are currently being migrated from ProfileOAuth2TokenService. | 16 // the tokens are currently being migrated from ProfileOAuth2TokenService. |
| 17 class MutableProfileOAuth2TokenService : public ProfileOAuth2TokenService, | 17 class MutableProfileOAuth2TokenService : public ProfileOAuth2TokenService, |
| 18 public WebDataServiceConsumer { | 18 public WebDataServiceConsumer { |
| 19 public: | 19 public: |
| 20 // ProfileOAuth2TokenService. | 20 // ProfileOAuth2TokenService. |
| 21 virtual void Shutdown() OVERRIDE; | 21 virtual void Shutdown() OVERRIDE; |
| 22 virtual void LoadCredentials() OVERRIDE; | 22 virtual void LoadCredentials() OVERRIDE; |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 friend class ProfileOAuth2TokenServiceFactory; | 25 friend class ProfileOAuth2TokenServiceFactory; |
| 26 MutableProfileOAuth2TokenService(); | 26 MutableProfileOAuth2TokenService(); |
| 27 virtual ~MutableProfileOAuth2TokenService(); | 27 virtual ~MutableProfileOAuth2TokenService(); |
| 28 | 28 |
| 29 // OAuth2TokenService implementation. |
| 30 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
| 31 |
| 29 private: | 32 private: |
| 30 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, | 33 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, |
| 31 TokenServiceUpdateClearsCache); | 34 TokenServiceUpdateClearsCache); |
| 32 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, | 35 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, |
| 33 PersistenceDBUpgrade); | 36 PersistenceDBUpgrade); |
| 34 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, | 37 FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, |
| 35 PersistenceLoadCredentials); | 38 PersistenceLoadCredentials); |
| 36 | 39 |
| 37 // WebDataServiceConsumer implementation: | 40 // WebDataServiceConsumer implementation: |
| 38 virtual void OnWebDataServiceRequestDone( | 41 virtual void OnWebDataServiceRequestDone( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 // Persists credentials for |account_id|. Enables overriding for | 53 // Persists credentials for |account_id|. Enables overriding for |
| 51 // testing purposes, or other cases, when accessing the DB is not desired. | 54 // testing purposes, or other cases, when accessing the DB is not desired. |
| 52 virtual void PersistCredentials(const std::string& account_id, | 55 virtual void PersistCredentials(const std::string& account_id, |
| 53 const std::string& refresh_token) OVERRIDE; | 56 const std::string& refresh_token) OVERRIDE; |
| 54 | 57 |
| 55 // Clears credentials persisted for |account_id|. Enables overriding for | 58 // Clears credentials persisted for |account_id|. Enables overriding for |
| 56 // testing purposes, or other cases, when accessing the DB is not desired. | 59 // testing purposes, or other cases, when accessing the DB is not desired. |
| 57 virtual void ClearPersistedCredentials( | 60 virtual void ClearPersistedCredentials( |
| 58 const std::string& account_id) OVERRIDE; | 61 const std::string& account_id) OVERRIDE; |
| 59 | 62 |
| 63 // Revokes the refresh token on the server. |
| 64 virtual void RevokeCredentialsOnServer( |
| 65 const std::string& refresh_token) OVERRIDE; |
| 66 |
| 60 // Handle to the request reading tokens from database. | 67 // Handle to the request reading tokens from database. |
| 61 WebDataServiceBase::Handle web_data_service_request_; | 68 WebDataServiceBase::Handle web_data_service_request_; |
| 62 | 69 |
| 63 DISALLOW_COPY_AND_ASSIGN(MutableProfileOAuth2TokenService); | 70 DISALLOW_COPY_AND_ASSIGN(MutableProfileOAuth2TokenService); |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 #endif // CHROME_BROWSER_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 73 #endif // CHROME_BROWSER_SIGNIN_MUTABLE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |