| 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 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // OAuth2TokenServiceDelegate overrides: | 48 // OAuth2TokenServiceDelegate overrides: |
| 49 bool RefreshTokenIsAvailable(const std::string& account_id) const override; | 49 bool RefreshTokenIsAvailable(const std::string& account_id) const override; |
| 50 bool RefreshTokenHasError(const std::string& account_id) const override; | 50 bool RefreshTokenHasError(const std::string& account_id) const override; |
| 51 void UpdateAuthError(const std::string& account_id, | 51 void UpdateAuthError(const std::string& account_id, |
| 52 const GoogleServiceAuthError& error) override; | 52 const GoogleServiceAuthError& error) override; |
| 53 std::vector<std::string> GetAccounts() override; | 53 std::vector<std::string> GetAccounts() override; |
| 54 | 54 |
| 55 // Lists account names at the OS level. | 55 // Lists account names at the OS level. |
| 56 std::vector<std::string> GetSystemAccountNames(); | 56 std::vector<std::string> GetSystemAccountNames(); |
| 57 | 57 |
| 58 void ValidateAccounts(JNIEnv* env, | 58 void ValidateAccounts( |
| 59 jobject obj, | 59 JNIEnv* env, |
| 60 jstring current_account, | 60 const base::android::JavaParamRef<jobject>& obj, |
| 61 jboolean force_notifications); | 61 const base::android::JavaParamRef<jstring>& current_account, |
| 62 jboolean force_notifications); |
| 62 | 63 |
| 63 // Takes a the signed in sync account as well as all the other | 64 // Takes a the signed in sync account as well as all the other |
| 64 // android account ids and check the token status of each. If | 65 // android account ids and check the token status of each. If |
| 65 // |force_notifications| is true, TokenAvailable notifications will | 66 // |force_notifications| is true, TokenAvailable notifications will |
| 66 // be sent anyway, even if the account was already known. | 67 // be sent anyway, even if the account was already known. |
| 67 void ValidateAccounts(const std::string& signed_in_account_id, | 68 void ValidateAccounts(const std::string& signed_in_account_id, |
| 68 bool force_notifications); | 69 bool force_notifications); |
| 69 | 70 |
| 70 // Triggers a notification to all observers of the OAuth2TokenService that a | 71 // Triggers a notification to all observers of the OAuth2TokenService that a |
| 71 // refresh token is now available. This may cause observers to retry | 72 // refresh token is now available. This may cause observers to retry |
| 72 // operations that require authentication. | 73 // operations that require authentication. |
| 73 virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env, | 74 virtual void FireRefreshTokenAvailableFromJava( |
| 74 jobject obj, | 75 JNIEnv* env, |
| 75 const jstring account_name); | 76 const base::android::JavaParamRef<jobject>& obj, |
| 77 const base::android::JavaParamRef<jstring>& account_name); |
| 76 // Triggers a notification to all observers of the OAuth2TokenService that a | 78 // Triggers a notification to all observers of the OAuth2TokenService that a |
| 77 // refresh token is now available. | 79 // refresh token is now available. |
| 78 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, | 80 virtual void FireRefreshTokenRevokedFromJava( |
| 79 jobject obj, | 81 JNIEnv* env, |
| 80 const jstring account_name); | 82 const base::android::JavaParamRef<jobject>& obj, |
| 83 const base::android::JavaParamRef<jstring>& account_name); |
| 81 // Triggers a notification to all observers of the OAuth2TokenService that all | 84 // Triggers a notification to all observers of the OAuth2TokenService that all |
| 82 // refresh tokens have now been loaded. | 85 // refresh tokens have now been loaded. |
| 83 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); | 86 virtual void FireRefreshTokensLoadedFromJava( |
| 87 JNIEnv* env, |
| 88 const base::android::JavaParamRef<jobject>& obj); |
| 84 | 89 |
| 85 // Overridden from OAuth2TokenService to complete signout of all | 90 // Overridden from OAuth2TokenService to complete signout of all |
| 86 // OA2TService aware accounts. | 91 // OA2TService aware accounts. |
| 87 void RevokeAllCredentials() override; | 92 void RevokeAllCredentials() override; |
| 88 | 93 |
| 89 void LoadCredentials(const std::string& primary_account_id) override; | 94 void LoadCredentials(const std::string& primary_account_id) override; |
| 90 | 95 |
| 91 protected: | 96 protected: |
| 92 friend class ProfileOAuth2TokenServiceFactory; | 97 friend class ProfileOAuth2TokenServiceFactory; |
| 93 OAuth2TokenServiceDelegateAndroid( | 98 OAuth2TokenServiceDelegateAndroid( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 153 |
| 149 AccountTrackerService* account_tracker_service_; | 154 AccountTrackerService* account_tracker_service_; |
| 150 RefreshTokenLoadStatus fire_refresh_token_loaded_; | 155 RefreshTokenLoadStatus fire_refresh_token_loaded_; |
| 151 | 156 |
| 152 static bool is_testing_profile_; | 157 static bool is_testing_profile_; |
| 153 | 158 |
| 154 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid); | 159 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid); |
| 155 }; | 160 }; |
| 156 | 161 |
| 157 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ | 162 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ |
| OLD | NEW |