Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service_android.h |
| diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h |
| index 1886b8127c06936d417344dbab606087e4860fe5..21479094a1cc4e159183edcb4cefb8de1d578abc 100644 |
| --- a/chrome/browser/sync/profile_sync_service_android.h |
| +++ b/chrome/browser/sync/profile_sync_service_android.h |
| @@ -9,8 +9,11 @@ |
| #include <map> |
| #include "base/android/jni_helper.h" |
| +#include "base/callback.h" |
| #include "base/compiler_specific.h" |
| +#include "base/time.h" |
| #include "chrome/browser/sync/profile_sync_service_observer.h" |
| +#include "google_apis/gaia/google_service_auth_error.h" |
| #include "sync/internal_api/public/base/model_type.h" |
| class Profile; |
| @@ -23,6 +26,10 @@ class ProfileSyncService; |
| // This class should only be accessed from the UI thread. |
| class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { |
| public: |
| + typedef base::Callback<void( |
| + const GoogleServiceAuthError&,const std::string&,const base::Time&)> |
| + FetchOAuth2TokenCallback; |
|
Roger Tawa OOO till Jul 10th
2013/03/25 20:47:20
Document args?
Patrick Dubroy
2013/03/25 21:15:49
Done.
|
| + |
| ProfileSyncServiceAndroid(JNIEnv* env, jobject obj); |
| // This method should be called once right after contructing the object. |
| @@ -187,9 +194,30 @@ class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { |
| // (GoogleServiceAuthError.State). |
| jint GetAuthError(JNIEnv* env, jobject obj); |
| + // Called by native to invalidate an OAuth2 token, e.g. after a 401 response |
| + // from the server. This should be done before fetching a new token. |
| + void InvalidateOAuth2Token(const std::string& scope, |
| + const std::string& invalid_auth_token); |
| + |
| + // Called by native when an OAuth2 token is required. |invalid_auth_token| |
| + // is an old auth token to be invalidated (may be empty). |callback| will be |
| + // invoked asynchronously after a new token has been fetched. |
| + void FetchOAuth2Token(const std::string& scope, |
| + const FetchOAuth2TokenCallback& callback); |
| + |
| + // Called from Java when fetching of an OAuth2 token is finished. The |
| + // |authToken| param is only valid when |result| is true. |
| + void OAuth2TokenFetched(JNIEnv* env, |
| + jobject obj, |
| + int callback, |
| + jstring auth_token, |
| + jboolean result); |
| + |
| // ProfileSyncServiceObserver: |
| virtual void OnStateChanged() OVERRIDE; |
| + static ProfileSyncServiceAndroid* GetProfileSyncServiceAndroid(); |
| + |
| // Registers the ProfileSyncServiceAndroid's native methods through JNI. |
| static bool Register(JNIEnv* env); |