| 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_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 6 #define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <deque> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/android/jni_helper.h" | 12 #include "base/android/jni_helper.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 16 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 16 #include "google_apis/gaia/google_service_auth_error.h" | 17 #include "google_apis/gaia/google_service_auth_error.h" |
| 17 | 18 |
| 18 class TokenService; | 19 class TokenService; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const jstring account_name); | 59 const jstring account_name); |
| 59 // Triggers a notification to all observers of the OAuth2TokenService that a | 60 // Triggers a notification to all observers of the OAuth2TokenService that a |
| 60 // refresh token is now available. | 61 // refresh token is now available. |
| 61 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, | 62 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, |
| 62 jobject obj, | 63 jobject obj, |
| 63 const jstring account_name); | 64 const jstring account_name); |
| 64 // Triggers a notification to all observers of the OAuth2TokenService that all | 65 // Triggers a notification to all observers of the OAuth2TokenService that all |
| 65 // refresh tokens have now been loaded. | 66 // refresh tokens have now been loaded. |
| 66 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); | 67 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); |
| 67 | 68 |
| 69 // Called to notify observers when a refresh token is available. |
| 70 virtual void FireRefreshTokenAvailable( |
| 71 const std::string& account_id) OVERRIDE; |
| 72 virtual void FireRefreshTokenAvailable( |
| 73 const std::deque<std::string>& account_ids) OVERRIDE; |
| 74 |
| 68 protected: | 75 protected: |
| 69 friend class ProfileOAuth2TokenServiceFactory; | 76 friend class ProfileOAuth2TokenServiceFactory; |
| 70 AndroidProfileOAuth2TokenService(); | 77 AndroidProfileOAuth2TokenService(); |
| 71 virtual ~AndroidProfileOAuth2TokenService(); | 78 virtual ~AndroidProfileOAuth2TokenService(); |
| 72 | 79 |
| 73 // Overridden from OAuth2TokenService to intercept token fetch requests and | 80 // Overridden from OAuth2TokenService to intercept token fetch requests and |
| 74 // redirect them to the Account Manager. | 81 // redirect them to the Account Manager. |
| 75 virtual void FetchOAuth2Token(RequestImpl* request, | 82 virtual void FetchOAuth2Token(RequestImpl* request, |
| 76 const std::string& account_id, | 83 const std::string& account_id, |
| 77 net::URLRequestContextGetter* getter, | 84 net::URLRequestContextGetter* getter, |
| 78 const std::string& client_id, | 85 const std::string& client_id, |
| 79 const std::string& client_secret, | 86 const std::string& client_secret, |
| 80 const ScopeSet& scopes) OVERRIDE; | 87 const ScopeSet& scopes) OVERRIDE; |
| 81 | 88 |
| 82 // Overridden from OAuth2TokenService to intercept token fetch requests and | 89 // Overridden from OAuth2TokenService to intercept token fetch requests and |
| 83 // redirect them to the Account Manager. | 90 // redirect them to the Account Manager. |
| 84 virtual void InvalidateOAuth2Token(const std::string& account_id, | 91 virtual void InvalidateOAuth2Token(const std::string& account_id, |
| 85 const std::string& client_id, | 92 const std::string& client_id, |
| 86 const ScopeSet& scopes, | 93 const ScopeSet& scopes, |
| 87 const std::string& access_token) OVERRIDE; | 94 const std::string& access_token) OVERRIDE; |
| 88 | 95 |
| 89 // Called to notify observers when a refresh token is available. | |
| 90 virtual void FireRefreshTokenAvailable( | |
| 91 const std::string& account_id) OVERRIDE; | |
| 92 // Called to notify observers when a refresh token has been revoked. | 96 // Called to notify observers when a refresh token has been revoked. |
| 93 virtual void FireRefreshTokenRevoked(const std::string& account_id) OVERRIDE; | 97 virtual void FireRefreshTokenRevoked(const std::string& account_id) OVERRIDE; |
| 94 // Called to notify observers when refresh tokans have been loaded. | 98 // Called to notify observers when refresh tokans have been loaded. |
| 95 virtual void FireRefreshTokensLoaded() OVERRIDE; | 99 virtual void FireRefreshTokensLoaded() OVERRIDE; |
| 96 | 100 |
| 97 private: | 101 private: |
| 98 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 102 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 99 | 103 |
| 100 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); | 104 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 107 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |