| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 JNIEnv* env, jclass clazz, jobject j_profile_android); | 37 JNIEnv* env, jclass clazz, jobject j_profile_android); |
| 38 | 38 |
| 39 virtual bool RefreshTokenIsAvailable( | 39 virtual bool RefreshTokenIsAvailable( |
| 40 const std::string& account_id) const OVERRIDE; | 40 const std::string& account_id) const OVERRIDE; |
| 41 | 41 |
| 42 // Lists account IDs of all accounts with a refresh token. | 42 // Lists account IDs of all accounts with a refresh token. |
| 43 virtual std::vector<std::string> GetAccounts() OVERRIDE; | 43 virtual std::vector<std::string> GetAccounts() OVERRIDE; |
| 44 | 44 |
| 45 void ValidateAccounts(JNIEnv* env, | 45 void ValidateAccounts(JNIEnv* env, |
| 46 jobject obj, | 46 jobject obj, |
| 47 jobjectArray accounts, | 47 jobjectArray prev_account_ids, |
| 48 jstring current_account); | 48 jstring current_account); |
| 49 | 49 |
| 50 // Takes a the signed in sync account as well as all the other | 50 // Takes a the signed in sync account as well as all the other |
| 51 // android account ids and check the token status of each. | 51 // android account ids and check the token status of each. |
| 52 void ValidateAccounts(const std::string& signed_in_account, | 52 void ValidateAccounts(const std::string& signed_in_account, |
| 53 const std::vector<std::string>& account_ids); | 53 const std::vector<std::string>& prev_account_ids); |
| 54 | 54 |
| 55 // Triggers a notification to all observers of the OAuth2TokenService that a | 55 // Triggers a notification to all observers of the OAuth2TokenService that a |
| 56 // refresh token is now available. This may cause observers to retry | 56 // refresh token is now available. This may cause observers to retry |
| 57 // operations that require authentication. | 57 // operations that require authentication. |
| 58 virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env, | 58 virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env, |
| 59 jobject obj, | 59 jobject obj, |
| 60 const jstring account_name); | 60 const jstring account_name); |
| 61 // Triggers a notification to all observers of the OAuth2TokenService that a | 61 // Triggers a notification to all observers of the OAuth2TokenService that a |
| 62 // refresh token is now available. | 62 // refresh token is now available. |
| 63 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, | 63 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, |
| 64 jobject obj, | 64 jobject obj, |
| 65 const jstring account_name); | 65 const jstring account_name); |
| 66 // Triggers a notification to all observers of the OAuth2TokenService that all | 66 // Triggers a notification to all observers of the OAuth2TokenService that all |
| 67 // refresh tokens have now been loaded. | 67 // refresh tokens have now been loaded. |
| 68 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); | 68 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); |
| 69 | 69 |
| 70 // Overridden from OAuth2TokenService to complete signout of all |
| 71 // OA2TService aware accounts. |
| 72 virtual void RevokeAllCredentials() OVERRIDE; |
| 73 |
| 70 protected: | 74 protected: |
| 71 friend class ProfileOAuth2TokenServiceFactory; | 75 friend class ProfileOAuth2TokenServiceFactory; |
| 72 AndroidProfileOAuth2TokenService(); | 76 AndroidProfileOAuth2TokenService(); |
| 73 virtual ~AndroidProfileOAuth2TokenService(); | 77 virtual ~AndroidProfileOAuth2TokenService(); |
| 74 | 78 |
| 75 // Overridden from OAuth2TokenService to intercept token fetch requests and | 79 // Overridden from OAuth2TokenService to intercept token fetch requests and |
| 76 // redirect them to the Account Manager. | 80 // redirect them to the Account Manager. |
| 77 virtual void FetchOAuth2Token(RequestImpl* request, | 81 virtual void FetchOAuth2Token(RequestImpl* request, |
| 78 const std::string& account_id, | 82 const std::string& account_id, |
| 79 net::URLRequestContextGetter* getter, | 83 net::URLRequestContextGetter* getter, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 // Called to notify observers when refresh tokans have been loaded. | 108 // Called to notify observers when refresh tokans have been loaded. |
| 105 virtual void FireRefreshTokensLoaded() OVERRIDE; | 109 virtual void FireRefreshTokensLoaded() OVERRIDE; |
| 106 | 110 |
| 107 private: | 111 private: |
| 108 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 112 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); | 114 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 117 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |