| 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_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ | 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // A specialization of OAuth2TokenServiceDelegate that will be returned by | 24 // A specialization of OAuth2TokenServiceDelegate that will be returned by |
| 25 // OAuth2TokenServiceDelegateFactory for OS_ANDROID. This instance uses | 25 // OAuth2TokenServiceDelegateFactory for OS_ANDROID. This instance uses |
| 26 // native Android features to lookup OAuth2 tokens. | 26 // native Android features to lookup OAuth2 tokens. |
| 27 // | 27 // |
| 28 // See |OAuth2TokenServiceDelegate| for usage details. | 28 // See |OAuth2TokenServiceDelegate| for usage details. |
| 29 // | 29 // |
| 30 // Note: requests should be started from the UI thread. To start a | 30 // Note: requests should be started from the UI thread. To start a |
| 31 // request from other thread, please use OAuth2TokenServiceRequest. | 31 // request from other thread, please use OAuth2TokenServiceRequest. |
| 32 class OAuth2TokenServiceDelegateAndroid : public OAuth2TokenServiceDelegate { | 32 class OAuth2TokenServiceDelegateAndroid : public OAuth2TokenServiceDelegate { |
| 33 public: | 33 public: |
| 34 OAuth2TokenServiceDelegateAndroid( |
| 35 AccountTrackerService* account_tracker_service); |
| 36 ~OAuth2TokenServiceDelegateAndroid() override; |
| 37 |
| 34 // Registers the OAuth2TokenServiceDelegateAndroid's native methods through | 38 // Registers the OAuth2TokenServiceDelegateAndroid's native methods through |
| 35 // JNI. | 39 // JNI. |
| 36 static bool Register(JNIEnv* env); | 40 static bool Register(JNIEnv* env); |
| 37 | 41 |
| 38 // Creates a new instance of the OAuth2TokenServiceDelegateAndroid. | 42 // Creates a new instance of the OAuth2TokenServiceDelegateAndroid. |
| 39 static OAuth2TokenServiceDelegateAndroid* Create(); | 43 static OAuth2TokenServiceDelegateAndroid* Create(); |
| 40 | 44 |
| 41 // Returns a reference to the Java instance of this service. | 45 // Returns a reference to the Java instance of this service. |
| 42 static base::android::ScopedJavaLocalRef<jobject> | 46 static base::android::ScopedJavaLocalRef<jobject> |
| 43 GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile_android); | 47 GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile_android); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 JNIEnv* env, | 93 JNIEnv* env, |
| 90 const base::android::JavaParamRef<jobject>& obj); | 94 const base::android::JavaParamRef<jobject>& obj); |
| 91 | 95 |
| 92 // Overridden from OAuth2TokenService to complete signout of all | 96 // Overridden from OAuth2TokenService to complete signout of all |
| 93 // OA2TService aware accounts. | 97 // OA2TService aware accounts. |
| 94 void RevokeAllCredentials() override; | 98 void RevokeAllCredentials() override; |
| 95 | 99 |
| 96 void LoadCredentials(const std::string& primary_account_id) override; | 100 void LoadCredentials(const std::string& primary_account_id) override; |
| 97 | 101 |
| 98 protected: | 102 protected: |
| 99 friend class ProfileOAuth2TokenServiceFactory; | |
| 100 OAuth2TokenServiceDelegateAndroid( | |
| 101 AccountTrackerService* account_tracker_service); | |
| 102 ~OAuth2TokenServiceDelegateAndroid() override; | |
| 103 | |
| 104 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( | 103 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
| 105 const std::string& account_id, | 104 const std::string& account_id, |
| 106 net::URLRequestContextGetter* getter, | 105 net::URLRequestContextGetter* getter, |
| 107 OAuth2AccessTokenConsumer* consumer) override; | 106 OAuth2AccessTokenConsumer* consumer) override; |
| 108 | 107 |
| 109 // Overridden from OAuth2TokenService to intercept token fetch requests and | 108 // Overridden from OAuth2TokenService to intercept token fetch requests and |
| 110 // redirect them to the Account Manager. | 109 // redirect them to the Account Manager. |
| 111 void InvalidateAccessToken(const std::string& account_id, | 110 void InvalidateAccessToken(const std::string& account_id, |
| 112 const std::string& client_id, | 111 const std::string& client_id, |
| 113 const OAuth2TokenService::ScopeSet& scopes, | 112 const OAuth2TokenService::ScopeSet& scopes, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 154 |
| 156 AccountTrackerService* account_tracker_service_; | 155 AccountTrackerService* account_tracker_service_; |
| 157 RefreshTokenLoadStatus fire_refresh_token_loaded_; | 156 RefreshTokenLoadStatus fire_refresh_token_loaded_; |
| 158 | 157 |
| 159 static bool is_testing_profile_; | 158 static bool is_testing_profile_; |
| 160 | 159 |
| 161 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid); | 160 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid); |
| 162 }; | 161 }; |
| 163 | 162 |
| 164 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ | 163 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ |
| OLD | NEW |