summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 21:24:47 +0000
committerdubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 21:24:47 +0000
commit5d48084b16d8b180d7867183e55e01562b6219bc (patch)
treea99a66635d62b6a6c0e8038ae167f517931bbbae
parent28cbc1b7afd0cdf122dfccc4ead042f038c3be96 (diff)
downloadchromium_src-5d48084b16d8b180d7867183e55e01562b6219bc.zip
chromium_src-5d48084b16d8b180d7867183e55e01562b6219bc.tar.gz
chromium_src-5d48084b16d8b180d7867183e55e01562b6219bc.tar.bz2
Revert 192900 "Merge 190531 "Get OAuth2TokenService working on A..."
> Merge 190531 "Get OAuth2TokenService working on Android." > > > Get OAuth2TokenService working on Android. > > > > In order to get OAuth tokens on Android, we have to call out to Java. This CL > > makes it possible. It's not the ideal solution but works for now. > > > > BUG= 222271 > > > > Review URL: https://codereview.chromium.org/12880014 > > TBR=dubroy@chromium.org > Review URL: https://codereview.chromium.org/13749016 TBR=dubroy@chromium.org Review URL: https://codereview.chromium.org/13467039 git-svn-id: svn://svn.chromium.org/chrome/branches/1453/src@192901 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java74
-rw-r--r--chrome/browser/history/web_history_service.cc22
-rw-r--r--chrome/browser/signin/oauth2_token_service.cc54
-rw-r--r--chrome/browser/signin/oauth2_token_service.h20
-rw-r--r--chrome/browser/signin/oauth2_token_service_unittest.cc12
-rw-r--r--chrome/browser/sync/profile_sync_service_android.cc58
-rw-r--r--chrome/browser/sync/profile_sync_service_android.h34
-rw-r--r--sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java7
8 files changed, 18 insertions, 263 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
index 70deecf..8cce52c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
@@ -89,11 +89,6 @@ public class ProfileSyncService {
mNativeProfileSyncServiceAndroid = nativeInit();
}
- @CalledByNative
- private static int getProfileSyncServiceAndroid(Context context) {
- return get(context).mNativeProfileSyncServiceAndroid;
- }
-
/**
* If we are currently in the process of setting up sync, this method clears the
* sync setup in progress flag.
@@ -168,29 +163,23 @@ public class ProfileSyncService {
}
}
- private Account getAccountOrNullFromUsername(String username) {
+ /**
+ * Requests a new auth token from the AccountManager. Invalidates the old token
+ * if |invalidAuthToken| is not empty.
+ */
+ @CalledByNative
+ public void getNewAuthToken(final String username, final String invalidAuthToken) {
if (username == null) {
Log.e(TAG, "username is null");
- return null;
+ return;
}
final AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(mContext);
final Account account = accountManagerHelper.getAccountFromName(username);
if (account == null) {
Log.e(TAG, "Account not found for provided username.");
- return null;
+ return;
}
- return account;
- }
-
- /**
- * Requests a new auth token from the AccountManager. Invalidates the old token
- * if |invalidAuthToken| is not empty.
- */
- @CalledByNative
- public void getNewAuthToken(final String username, final String invalidAuthToken) {
- final Account account = getAccountOrNullFromUsername(username);
- if (account == null) return;
// Since this is blocking, do it in the background.
new AsyncTask<Void, Void, String>() {
@@ -198,7 +187,6 @@ public class ProfileSyncService {
@Override
public String doInBackground(Void... params) {
// Invalidate our old auth token and fetch a new one.
- AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(mContext);
return accountManagerHelper.getNewAuthToken(
account, invalidAuthToken, SyncStatusHelper.AUTH_TOKEN_TYPE_SYNC);
}
@@ -206,6 +194,8 @@ public class ProfileSyncService {
@Override
public void onPostExecute(String authToken) {
if (authToken == null) {
+ // DO NOT COMMIT do we really need this TODO? We trigger a call to
+ // requestSyncFromNativeChrome() when an account changes and sync is setup.
// TODO(sync): Need to hook LOGIN_ACCOUNTS_CHANGED_ACTION (http://b/5354713).
Log.d(TAG, "Auth token for sync was null.");
} else {
@@ -216,47 +206,6 @@ public class ProfileSyncService {
}.execute();
}
- /**
- * Called by native to invalidate an OAuth2 token.
- */
- @CalledByNative
- public void invalidateOAuth2AuthToken(String scope, String accessToken) {
- AccountManagerHelper.get(mContext).invalidateAuthToken(scope, accessToken);
- }
-
- /**
- * Called by native to retrieve OAuth2 tokens.
- *
- * @param username the native username (full address)
- * @param scope the scope to get an auth token for (without Android-style 'oauth2:' prefix).
- * @param oldAuthToken if provided, the token will be invalidated before getting a new token.
- * @param nativeCallback the pointer to the native callback that should be run upon completion.
- */
- @CalledByNative
- public void getOAuth2AuthToken(String username, String scope, final int nativeCallback) {
- final Account account = getAccountOrNullFromUsername(username);
- if (account == null) {
- nativeOAuth2TokenFetched(
- mNativeProfileSyncServiceAndroid, nativeCallback, null, false);
- return;
- }
- final String oauth2Scope = "oauth2:" + scope;
-
- new AsyncTask<Void, Void, String>() {
- @Override
- public String doInBackground(Void... params) {
- AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(mContext);
- return accountManagerHelper.getAuthTokenFromBackground(account, oauth2Scope);
- }
-
- @Override
- public void onPostExecute(String authToken) {
- nativeOAuth2TokenFetched(
- mNativeProfileSyncServiceAndroid, nativeCallback, authToken, authToken != null);
- }
- }.execute();
- }
-
/**
* Checks if a password or a passphrase is required for decryption of sync data.
* <p/>
@@ -613,7 +562,4 @@ public class ProfileSyncService {
private native boolean nativeHasKeepEverythingSynced(int nativeProfileSyncServiceAndroid);
private native boolean nativeHasUnrecoverableError(int nativeProfileSyncServiceAndroid);
private native String nativeGetAboutInfoForTest(int nativeProfileSyncServiceAndroid);
- private native void nativeOAuth2TokenFetched(
- int nativeProfileSyncServiceAndroid, int nativeCallback, String authToken,
- boolean result);
}
diff --git a/chrome/browser/history/web_history_service.cc b/chrome/browser/history/web_history_service.cc
index 0a79230..91f1021 100644
--- a/chrome/browser/history/web_history_service.cc
+++ b/chrome/browser/history/web_history_service.cc
@@ -64,7 +64,6 @@ class RequestImpl : public WebHistoryService::Request,
: profile_(profile),
url_(GURL(url)),
response_code_(0),
- auth_retry_count_(0),
callback_(callback) {
}
@@ -82,19 +81,6 @@ class RequestImpl : public WebHistoryService::Request,
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE {
DCHECK_EQ(source, url_fetcher_.get());
response_code_ = url_fetcher_->GetResponseCode();
-
- // If the response code indicates that the token might not be valid,
- // invalidate the token and try again.
- if (response_code_ == net::HTTP_UNAUTHORIZED && ++auth_retry_count_ <= 1) {
- OAuth2TokenService::ScopeSet oauth_scopes;
- oauth_scopes.insert(kHistoryOAuthScope);
- OAuth2TokenServiceFactory::GetForProfile(profile_)->InvalidateToken(
- oauth_scopes, access_token_);
-
- access_token_ = std::string();
- Start();
- return;
- }
url_fetcher_->GetResponseAsString(&response_body_);
url_fetcher_.reset();
callback_.Run(this, true);
@@ -107,7 +93,6 @@ class RequestImpl : public WebHistoryService::Request,
const base::Time& expiration_time) OVERRIDE {
token_request_.reset();
DCHECK(!access_token.empty());
- access_token_ = access_token;
// Got an access token -- start the actual API request.
url_fetcher_.reset(CreateUrlFetcher(access_token));
@@ -155,9 +140,6 @@ class RequestImpl : public WebHistoryService::Request,
// The OAuth2 access token request.
scoped_ptr<OAuth2TokenService::Request> token_request_;
- // The current OAuth2 access token.
- std::string access_token_;
-
// Handles the actual API requests after the OAuth token is acquired.
scoped_ptr<net::URLFetcher> url_fetcher_;
@@ -167,10 +149,6 @@ class RequestImpl : public WebHistoryService::Request,
// Holds the response body received from the server.
std::string response_body_;
- // The number of times this request has already been retried due to
- // authorization problems.
- int auth_retry_count_;
-
// The callback to execute when the query is complete.
CompletionCallback callback_;
};
diff --git a/chrome/browser/signin/oauth2_token_service.cc b/chrome/browser/signin/oauth2_token_service.cc
index 7886054..a039297 100644
--- a/chrome/browser/signin/oauth2_token_service.cc
+++ b/chrome/browser/signin/oauth2_token_service.cc
@@ -29,10 +29,6 @@
#include "google_apis/gaia/oauth2_access_token_consumer.h"
#include "google_apis/gaia/oauth2_access_token_fetcher.h"
-#if defined(OS_ANDROID)
-#include "chrome/browser/sync/profile_sync_service_android.h"
-#endif
-
namespace {
// Maximum number of retries in fetching an OAuth2 access token.
@@ -366,9 +362,9 @@ void OAuth2TokenService::Shutdown() {
// static
void OAuth2TokenService::InformConsumer(
base::WeakPtr<OAuth2TokenService::RequestImpl> request,
- const GoogleServiceAuthError& error,
- const std::string& access_token,
- const base::Time& expiration_date) {
+ GoogleServiceAuthError error,
+ std::string access_token,
+ base::Time expiration_date) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (request)
@@ -382,7 +378,6 @@ scoped_ptr<OAuth2TokenService::Request> OAuth2TokenService::StartRequest(
scoped_ptr<RequestImpl> request(new RequestImpl(consumer));
-#if !defined(OS_ANDROID)
TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
if (!token_service || !token_service->HasOAuthLoginToken()) {
MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
@@ -393,7 +388,6 @@ scoped_ptr<OAuth2TokenService::Request> OAuth2TokenService::StartRequest(
base::Time()));
return request.PassAs<Request>();
}
-#endif
const CacheEntry* cache_entry = GetCacheEntry(scopes);
if (cache_entry && cache_entry->access_token.length()) {
@@ -406,17 +400,6 @@ scoped_ptr<OAuth2TokenService::Request> OAuth2TokenService::StartRequest(
return request.PassAs<Request>();
}
-#if defined(OS_ANDROID)
- DCHECK_EQ(scopes.size(), 1U);
- std::vector<std::string> scope_list(scopes.begin(), scopes.end());
- ProfileSyncServiceAndroid* sync_service =
- ProfileSyncServiceAndroid::GetProfileSyncServiceAndroid();
- sync_service->FetchOAuth2Token(
- scope_list.front(),
- base::Bind(&OAuth2TokenService::InformConsumer,
- request->AsWeakPtr()));
- return request.PassAs<Request>();
-#else
std::string refresh_token = token_service->GetOAuth2LoginRefreshToken();
if (!refresh_token.length()) {
MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
@@ -442,22 +425,6 @@ scoped_ptr<OAuth2TokenService::Request> OAuth2TokenService::StartRequest(
pending_fetchers_[fetch_parameters] = Fetcher::CreateAndStart(
profile_, getter_, refresh_token, scopes, request->AsWeakPtr());
return request.PassAs<Request>();
-#endif // defined(OS_ANDROID)
-}
-
-void OAuth2TokenService::InvalidateToken(const ScopeSet& scopes,
- const std::string& invalid_token) {
- RemoveCacheEntry(scopes, invalid_token);
-
-#if defined(OS_ANDROID)
- DCHECK_EQ(scopes.size(), 1U);
- std::vector<std::string> scope_list(scopes.begin(), scopes.end());
- ProfileSyncServiceAndroid* sync_service =
- ProfileSyncServiceAndroid::GetProfileSyncServiceAndroid();
- sync_service->InvalidateOAuth2Token(
- scope_list.front(),
- invalid_token);
-#endif
}
void OAuth2TokenService::OnFetchComplete(Fetcher* fetcher) {
@@ -515,19 +482,6 @@ const OAuth2TokenService::CacheEntry* OAuth2TokenService::GetCacheEntry(
return &token_iterator->second;
}
-bool OAuth2TokenService::RemoveCacheEntry(
- const OAuth2TokenService::ScopeSet& scopes,
- const std::string& token_to_remove) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- TokenCache::iterator token_iterator = token_cache_.find(scopes);
- if (token_iterator == token_cache_.end() &&
- token_iterator->second.access_token == token_to_remove) {
- token_cache_.erase(token_iterator);
- return true;
- }
- return false;
-}
-
void OAuth2TokenService::RegisterCacheEntry(
const std::string& refresh_token,
const OAuth2TokenService::ScopeSet& scopes,
@@ -535,7 +489,6 @@ void OAuth2TokenService::RegisterCacheEntry(
const base::Time& expiration_date) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-#if !defined(OS_ANDROID)
// Only register OAuth2 access tokens for the refresh token held by
// TokenService.
TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
@@ -546,7 +499,6 @@ void OAuth2TokenService::RegisterCacheEntry(
"Received a token with a refresh token not maintained by TokenService.";
return;
}
-#endif
CacheEntry& token = token_cache_[scopes];
token.access_token = access_token;
diff --git a/chrome/browser/signin/oauth2_token_service.h b/chrome/browser/signin/oauth2_token_service.h
index 71ddcb2..3f19b3c 100644
--- a/chrome/browser/signin/oauth2_token_service.h
+++ b/chrome/browser/signin/oauth2_token_service.h
@@ -99,13 +99,6 @@ class OAuth2TokenService : public content::NotificationObserver,
const ScopeSet& scopes,
OAuth2TokenService::Consumer* consumer);
- // Mark an OAuth2 access token as invalid. This should be done if the token
- // was received from this class, but was not accepted by the server (e.g.,
- // the server returned 401 Unauthorized). The token will be removed from the
- // cache for the given scopes.
- void InvalidateToken(const ScopeSet& scopes,
- const std::string& invalid_token);
-
// content::NotificationObserver
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -125,9 +118,9 @@ class OAuth2TokenService : public content::NotificationObserver,
// Informs the consumer of |request| fetch results.
static void InformConsumer(
base::WeakPtr<OAuth2TokenService::RequestImpl> request,
- const GoogleServiceAuthError& error,
- const std::string& access_token,
- const base::Time& expiration_date);
+ GoogleServiceAuthError error,
+ std::string access_token,
+ base::Time expiration_date);
// Struct that contains the information of an OAuth2 access token.
struct CacheEntry {
@@ -140,7 +133,6 @@ class OAuth2TokenService : public content::NotificationObserver,
// ensure no entry with the same |scopes| is added before the usage of the
// returned entry is done.
const CacheEntry* GetCacheEntry(const ScopeSet& scopes);
-
// Registers a new access token in the cache if |refresh_token| is the one
// currently held by TokenService.
void RegisterCacheEntry(const std::string& refresh_token,
@@ -148,12 +140,6 @@ class OAuth2TokenService : public content::NotificationObserver,
const std::string& access_token,
const base::Time& expiration_date);
- // Removes an access token for the given set of scopes from the cache.
- // Returns true if the entry was removed, otherwise false.
- bool RemoveCacheEntry(const OAuth2TokenService::ScopeSet& scopes,
- const std::string& token_to_remove);
-
-
// Called when |fetcher| finishes fetching.
void OnFetchComplete(Fetcher* fetcher);
diff --git a/chrome/browser/signin/oauth2_token_service_unittest.cc b/chrome/browser/signin/oauth2_token_service_unittest.cc
index a285c12..3649374 100644
--- a/chrome/browser/signin/oauth2_token_service_unittest.cc
+++ b/chrome/browser/signin/oauth2_token_service_unittest.cc
@@ -117,15 +117,7 @@ class OAuth2TokenServiceTest : public TokenServiceTestHarness {
TestingOAuth2TokenServiceConsumer consumer_;
};
-#if defined(OS_ANDROID)
-#define MAYBE_NoOAuth2RefreshToken DISABLED_NoOAuth2RefreshToken
-#define MAYBE_FailureShouldNotRetry DISABLED_FailureShouldNotRetry
-#else
-#define MAYBE_NoOAuth2RefreshToken NoOAuth2RefreshToken
-#define MAYBE_FailureShouldNotRetry FailureShouldNotRetry
-#endif // defined(OS_ANDROID)
-
-TEST_F(OAuth2TokenServiceTest, MAYBE_NoOAuth2RefreshToken) {
+TEST_F(OAuth2TokenServiceTest, NoOAuth2RefreshToken) {
scoped_ptr<OAuth2TokenService::Request> request(
oauth2_service_->StartRequest(std::set<std::string>(), &consumer_));
message_loop_.RunUntilIdle();
@@ -134,7 +126,7 @@ TEST_F(OAuth2TokenServiceTest, MAYBE_NoOAuth2RefreshToken) {
EXPECT_EQ(1, consumer_.number_of_errors_);
}
-TEST_F(OAuth2TokenServiceTest, MAYBE_FailureShouldNotRetry) {
+TEST_F(OAuth2TokenServiceTest, FailureShouldNotRetry) {
service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken,
"refreshToken");
scoped_ptr<OAuth2TokenService::Request> request(oauth2_service_->StartRequest(
diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc
index 095e453..ed2ecd2 100644
--- a/chrome/browser/sync/profile_sync_service_android.cc
+++ b/chrome/browser/sync/profile_sync_service_android.cc
@@ -16,7 +16,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/signin/oauth2_token_service.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/token_service.h"
@@ -171,55 +170,6 @@ void ProfileSyncServiceAndroid::TokenAvailable(
GaiaConstants::kSyncService, token);
}
-void ProfileSyncServiceAndroid::InvalidateOAuth2Token(
- const std::string& scope, const std::string& invalid_token) {
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jstring> j_scope =
- ConvertUTF8ToJavaString(env, scope);
- ScopedJavaLocalRef<jstring> j_invalid_token =
- ConvertUTF8ToJavaString(env, invalid_token);
- Java_ProfileSyncService_invalidateOAuth2AuthToken(
- env, weak_java_profile_sync_service_.get(env).obj(),
- j_scope.obj(),
- j_invalid_token.obj());
-}
-
-void ProfileSyncServiceAndroid::FetchOAuth2Token(
- const std::string& scope, const FetchOAuth2TokenCallback& callback) {
- const std::string& sync_username =
- SigninManagerFactory::GetForProfile(profile_)->GetAuthenticatedUsername();
-
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jstring> j_sync_username =
- ConvertUTF8ToJavaString(env, sync_username);
- ScopedJavaLocalRef<jstring> j_scope =
- ConvertUTF8ToJavaString(env, scope);
-
- // Allocate a copy of the callback on the heap, because the callback
- // needs to be passed through JNI as an int.
- // It will be passed back to OAuth2TokenFetched(), where it will be freed.
- scoped_ptr<FetchOAuth2TokenCallback> heap_callback(
- new FetchOAuth2TokenCallback(callback));
-
- // Call into Java to get a new token.
- Java_ProfileSyncService_getOAuth2AuthToken(
- env, weak_java_profile_sync_service_.get(env).obj(),
- j_sync_username.obj(),
- j_scope.obj(),
- reinterpret_cast<int>(heap_callback.release()));
-}
-
-void ProfileSyncServiceAndroid::OAuth2TokenFetched(
- JNIEnv* env, jobject, int callback, jstring auth_token, jboolean result) {
- std::string token = ConvertJavaStringToUTF8(env, auth_token);
- scoped_ptr<FetchOAuth2TokenCallback> heap_callback(
- reinterpret_cast<FetchOAuth2TokenCallback*>(callback));
- GoogleServiceAuthError err(result ?
- GoogleServiceAuthError::NONE :
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
- heap_callback->Run(err, token, base::Time());
-}
-
void ProfileSyncServiceAndroid::EnableSync(JNIEnv* env, jobject) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Don't need to do anything if we're already enabled.
@@ -611,14 +561,6 @@ void ProfileSyncServiceAndroid::NudgeSyncer(JNIEnv* env,
ConvertJavaStringToUTF8(env, state));
}
-// static
-ProfileSyncServiceAndroid*
- ProfileSyncServiceAndroid::GetProfileSyncServiceAndroid() {
- return reinterpret_cast<ProfileSyncServiceAndroid*>(
- Java_ProfileSyncService_getProfileSyncServiceAndroid(
- AttachCurrentThread(), base::android::GetApplicationContext()));
-}
-
static int Init(JNIEnv* env, jobject obj) {
ProfileSyncServiceAndroid* profile_sync_service_android =
new ProfileSyncServiceAndroid(env, obj);
diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h
index a43c7d4..5c0a04b 100644
--- a/chrome/browser/sync/profile_sync_service_android.h
+++ b/chrome/browser/sync/profile_sync_service_android.h
@@ -9,11 +9,8 @@
#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;
@@ -26,16 +23,6 @@ class ProfileSyncService;
// This class should only be accessed from the UI thread.
class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver {
public:
- // Callback from FetchOAuth2Token.
- // Arguments:
- // - the error, or NONE if the token fetch was successful.
- // - the OAuth2 access token.
- // - the expiry time of the token (may be null, indicating that the expiry
- // time is unknown.
- typedef base::Callback<void(
- const GoogleServiceAuthError&,const std::string&,const base::Time&)>
- FetchOAuth2TokenCallback;
-
ProfileSyncServiceAndroid(JNIEnv* env, jobject obj);
// This method should be called once right after contructing the object.
@@ -195,30 +182,9 @@ 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);
diff --git a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
index 7952f4e..882f90d 100644
--- a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
+++ b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
@@ -306,11 +306,4 @@ public class AccountManagerHelper {
getAuthTokenAsynchronously(
null, account, authTokenType, callback, numTries, errorEncountered, null);
}
-
- /**
- * Removes an auth token from the AccountManager's cache.
- */
- public void invalidateAuthToken(String accountType, String authToken) {
- mAccountManager.invalidateAuthToken(accountType, authToken);
- }
}