Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: trunk/src/chrome/browser/sync/profile_sync_service_android.cc

Issue 12782018: Revert 190531 "Get OAuth2TokenService working on Android." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/sync/profile_sync_service_android.cc
===================================================================
--- trunk/src/chrome/browser/sync/profile_sync_service_android.cc (revision 190557)
+++ trunk/src/chrome/browser/sync/profile_sync_service_android.cc (working copy)
@@ -15,7 +15,6 @@
#include "base/time.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"
@@ -170,55 +169,6 @@
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.
@@ -584,14 +534,6 @@
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);

Powered by Google App Engine
This is Rietveld 408576698