summaryrefslogtreecommitdiff
path: root/chrome/browser/signin/android_profile_oauth2_token_service.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-10-18 15:46:22 +0100
committerTorne (Richard Coles) <torne@google.com>2013-10-18 15:46:22 +0100
commit4e180b6a0b4720a9b8e9e959a882386f690f08ff (patch)
tree788435d09362885908ba5ba9ef868b852ca82c0b /chrome/browser/signin/android_profile_oauth2_token_service.h
parent1179b92b08db0c652a0cf003ab4d89b31ce3610f (diff)
downloadchromium_org-4e180b6a0b4720a9b8e9e959a882386f690f08ff.tar.gz
Merge from Chromium at DEPS revision 228962
This commit was generated by merge_to_master.py. Change-Id: I23bd7d7766f213fd52f28ae5e1ecc6ae9df905ea
Diffstat (limited to 'chrome/browser/signin/android_profile_oauth2_token_service.h')
-rw-r--r--chrome/browser/signin/android_profile_oauth2_token_service.h43
1 files changed, 40 insertions, 3 deletions
diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.h b/chrome/browser/signin/android_profile_oauth2_token_service.h
index 6c4437797c..1d6c054e8e 100644
--- a/chrome/browser/signin/android_profile_oauth2_token_service.h
+++ b/chrome/browser/signin/android_profile_oauth2_token_service.h
@@ -28,16 +28,43 @@ class TokenService;
// request from other thread, please use ProfileOAuth2TokenServiceRequest.
class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService {
public:
- virtual bool RefreshTokenIsAvailable(
- const std::string& account_id) OVERRIDE;
-
// Registers the AndroidProfileOAuth2TokenService's native methods through
// JNI.
static bool Register(JNIEnv* env);
+ // Creates a new instance of the AndroidProfileOAuth2TokenService.
+ static AndroidProfileOAuth2TokenService* Create();
+
+ // Returns a reference to the Java instance of this service.
+ static jobject GetForProfile(
+ JNIEnv* env, jclass clazz, jobject j_profile_android);
+
+ virtual bool RefreshTokenIsAvailable(
+ const std::string& account_id) OVERRIDE;
+
// Lists account IDs of all accounts with a refresh token.
virtual std::vector<std::string> GetAccounts() OVERRIDE;
+ void ValidateAccounts(JNIEnv* env,
+ jobject obj,
+ jobjectArray accounts,
+ jstring current_account);
+
+ // Triggers a notification to all observers of the OAuth2TokenService that a
+ // refresh token is now available. This may cause observers to retry
+ // operations that require authentication.
+ virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env,
+ jobject obj,
+ const jstring account_name);
+ // Triggers a notification to all observers of the OAuth2TokenService that a
+ // refresh token is now available.
+ virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env,
+ jobject obj,
+ const jstring account_name);
+ // Triggers a notification to all observers of the OAuth2TokenService that all
+ // refresh tokens have now been loaded.
+ virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj);
+
protected:
friend class ProfileOAuth2TokenServiceFactory;
AndroidProfileOAuth2TokenService();
@@ -59,7 +86,17 @@ class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService {
const ScopeSet& scopes,
const std::string& access_token) OVERRIDE;
+ // Called to notify observers when a refresh token is available.
+ virtual void FireRefreshTokenAvailable(
+ const std::string& account_id) OVERRIDE;
+ // Called to notify observers when a refresh token has been revoked.
+ virtual void FireRefreshTokenRevoked(const std::string& account_id) OVERRIDE;
+ // Called to notify observers when refresh tokans have been loaded.
+ virtual void FireRefreshTokensLoaded() OVERRIDE;
+
private:
+ base::android::ScopedJavaGlobalRef<jobject> java_ref_;
+
DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService);
};