OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const JavaParamRef<jobject>& obj) { | 283 const JavaParamRef<jobject>& obj) { |
284 std::string key = sync_service_->GetCustomPassphraseKey(); | 284 std::string key = sync_service_->GetCustomPassphraseKey(); |
285 return base::android::ToJavaByteArray( | 285 return base::android::ToJavaByteArray( |
286 env, reinterpret_cast<const uint8_t*>(key.data()), key.size()); | 286 env, reinterpret_cast<const uint8_t*>(key.data()), key.size()); |
287 } | 287 } |
288 | 288 |
289 jint ProfileSyncServiceAndroid::GetPassphraseType( | 289 jint ProfileSyncServiceAndroid::GetPassphraseType( |
290 JNIEnv* env, | 290 JNIEnv* env, |
291 const JavaParamRef<jobject>&) { | 291 const JavaParamRef<jobject>&) { |
292 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 292 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
293 return sync_service_->GetPassphraseType(); | 293 return static_cast<unsigned>(sync_service_->GetPassphraseType()); |
294 } | 294 } |
295 | 295 |
296 void ProfileSyncServiceAndroid::SetEncryptionPassphrase( | 296 void ProfileSyncServiceAndroid::SetEncryptionPassphrase( |
297 JNIEnv* env, | 297 JNIEnv* env, |
298 const JavaParamRef<jobject>& obj, | 298 const JavaParamRef<jobject>& obj, |
299 const JavaParamRef<jstring>& passphrase) { | 299 const JavaParamRef<jstring>& passphrase) { |
300 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 300 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
301 std::string key = ConvertJavaStringToUTF8(env, passphrase); | 301 std::string key = ConvertJavaStringToUTF8(env, passphrase); |
302 sync_service_->SetEncryptionPassphrase(key, ProfileSyncService::EXPLICIT); | 302 sync_service_->SetEncryptionPassphrase(key, ProfileSyncService::EXPLICIT); |
303 } | 303 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 513 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
514 ProfileSyncServiceAndroid* profile_sync_service_android = | 514 ProfileSyncServiceAndroid* profile_sync_service_android = |
515 new ProfileSyncServiceAndroid(env, obj); | 515 new ProfileSyncServiceAndroid(env, obj); |
516 if (profile_sync_service_android->Init()) { | 516 if (profile_sync_service_android->Init()) { |
517 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 517 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
518 } else { | 518 } else { |
519 delete profile_sync_service_android; | 519 delete profile_sync_service_android; |
520 return 0; | 520 return 0; |
521 } | 521 } |
522 } | 522 } |
OLD | NEW |