OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 11 |
| 12 namespace net { |
| 13 class URLRequestContextGetter; |
| 14 } |
| 15 |
| 16 class TokenService; |
| 17 |
| 18 // A specialization of ProfileOAuth2TokenService that will be returned by |
| 19 // ProfileOAuth2TokenServiceFactory for OS_ANDROID. This instance uses |
| 20 // native Android features to lookup OAuth2 tokens. |
| 21 // |
| 22 // See |ProfileOAuth2TokenService| for usage details. |
| 23 // |
| 24 // Note: requests should be started from the UI thread. To start a |
| 25 // request from other thread, please use ProfileOAuth2TokenServiceRequest. |
| 26 class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService { |
| 27 public: |
| 28 // Start the OAuth2 access token for the given scopes using |
| 29 // ProfileSyncServiceAndroid. |
| 30 virtual scoped_ptr<OAuth2TokenService::Request> StartRequest( |
| 31 const OAuth2TokenService::ScopeSet& scopes, |
| 32 OAuth2TokenService::Consumer* consumer) OVERRIDE; |
| 33 |
| 34 virtual void InvalidateToken(const ScopeSet& scopes, |
| 35 const std::string& invalid_token) OVERRIDE; |
| 36 |
| 37 protected: |
| 38 friend class ProfileOAuth2TokenServiceFactory; |
| 39 explicit AndroidProfileOAuth2TokenService( |
| 40 net::URLRequestContextGetter* getter); |
| 41 virtual ~AndroidProfileOAuth2TokenService(); |
| 42 |
| 43 // Takes injected TokenService for testing. |
| 44 bool ShouldCacheForRefreshToken(TokenService *token_service, |
| 45 const std::string& refresh_token); |
| 46 |
| 47 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
OLD | NEW |