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

Side by Side Diff: chrome/browser/sync/profile_sync_service_android.cc

Issue 1414203016: [Sync] Introduce GmsCoreSyncListener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move GetCustomPassphraseKey declaration. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #include "chrome/browser/sync/profile_sync_service_android.h" 5 #include "chrome/browser/sync/profile_sync_service_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 DCHECK_CURRENTLY_ON(BrowserThread::UI); 234 DCHECK_CURRENTLY_ON(BrowserThread::UI);
235 return sync_service_->IsPassphraseRequiredForDecryption(); 235 return sync_service_->IsPassphraseRequiredForDecryption();
236 } 236 }
237 237
238 jboolean ProfileSyncServiceAndroid::IsUsingSecondaryPassphrase( 238 jboolean ProfileSyncServiceAndroid::IsUsingSecondaryPassphrase(
239 JNIEnv* env, jobject) { 239 JNIEnv* env, jobject) {
240 DCHECK_CURRENTLY_ON(BrowserThread::UI); 240 DCHECK_CURRENTLY_ON(BrowserThread::UI);
241 return sync_service_->IsUsingSecondaryPassphrase(); 241 return sync_service_->IsUsingSecondaryPassphrase();
242 } 242 }
243 243
244 ScopedJavaLocalRef<jbyteArray>
245 ProfileSyncServiceAndroid::GetCustomPassphraseKey(JNIEnv* env, jobject obj) {
246 std::string key = sync_service_->GetCustomPassphraseKey();
247 return base::android::ToJavaByteArray(
248 env, reinterpret_cast<const uint8_t*>(key.data()), key.size());
249 }
250
244 jint ProfileSyncServiceAndroid::GetPassphraseType(JNIEnv* env, jobject) { 251 jint ProfileSyncServiceAndroid::GetPassphraseType(JNIEnv* env, jobject) {
245 DCHECK_CURRENTLY_ON(BrowserThread::UI); 252 DCHECK_CURRENTLY_ON(BrowserThread::UI);
246 return sync_service_->GetPassphraseType(); 253 return sync_service_->GetPassphraseType();
247 } 254 }
248 255
249 void ProfileSyncServiceAndroid::SetEncryptionPassphrase( 256 void ProfileSyncServiceAndroid::SetEncryptionPassphrase(
250 JNIEnv* env, jobject obj, jstring passphrase) { 257 JNIEnv* env, jobject obj, jstring passphrase) {
251 DCHECK_CURRENTLY_ON(BrowserThread::UI); 258 DCHECK_CURRENTLY_ON(BrowserThread::UI);
252 std::string key = ConvertJavaStringToUTF8(env, passphrase); 259 std::string key = ConvertJavaStringToUTF8(env, passphrase);
253 sync_service_->SetEncryptionPassphrase(key, ProfileSyncService::EXPLICIT); 260 sync_service_->SetEncryptionPassphrase(key, ProfileSyncService::EXPLICIT);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { 438 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) {
432 return RegisterNativesImpl(env); 439 return RegisterNativesImpl(env);
433 } 440 }
434 441
435 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 442 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
436 ProfileSyncServiceAndroid* profile_sync_service_android = 443 ProfileSyncServiceAndroid* profile_sync_service_android =
437 new ProfileSyncServiceAndroid(env, obj); 444 new ProfileSyncServiceAndroid(env, obj);
438 profile_sync_service_android->Init(); 445 profile_sync_service_android->Init();
439 return reinterpret_cast<intptr_t>(profile_sync_service_android); 446 return reinterpret_cast<intptr_t>(profile_sync_service_android);
440 } 447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698