Chromium Code Reviews| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 } | 333 } |
| 334 | 334 |
| 335 jboolean ProfileSyncServiceAndroid::IsSyncKeystoreMigrationDone( | 335 jboolean ProfileSyncServiceAndroid::IsSyncKeystoreMigrationDone( |
| 336 JNIEnv* env, jobject) { | 336 JNIEnv* env, jobject) { |
| 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 338 syncer::SyncStatus status; | 338 syncer::SyncStatus status; |
| 339 bool is_status_valid = sync_service_->QueryDetailedSyncStatus(&status); | 339 bool is_status_valid = sync_service_->QueryDetailedSyncStatus(&status); |
| 340 return is_status_valid && !status.keystore_migration_time.is_null(); | 340 return is_status_valid && !status.keystore_migration_time.is_null(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 jlong ProfileSyncServiceAndroid::GetEnabledDataTypes(JNIEnv* env, | 343 jlong ProfileSyncServiceAndroid::GetActiveDataTypes(JNIEnv* env, |
| 344 jobject obj) { | 344 jobject obj) { |
| 345 syncer::ModelTypeSet types = sync_service_->GetActiveDataTypes(); | 345 syncer::ModelTypeSet types = sync_service_->GetActiveDataTypes(); |
| 346 types.PutAll(syncer::ControlTypes()); | 346 types.PutAll(syncer::ControlTypes()); |
| 347 return ModelTypeSetToSelection(types); | 347 return ModelTypeSetToSelection(types); |
| 348 } | 348 } |
| 349 | 349 |
| 350 jlong ProfileSyncServiceAndroid::GetPreferredDataTypes(JNIEnv* env, | |
| 351 jobject obj) { | |
|
Nicolas Zea
2015/03/18 17:57:06
nit: Fix indent
maxbogue
2015/03/18 20:51:07
Done.
| |
| 352 syncer::ModelTypeSet types = sync_service_->GetPreferredDataTypes(); | |
| 353 types.PutAll(syncer::ControlTypes()); | |
|
Nicolas Zea
2015/03/18 17:57:06
nit: Is this necessary? Nothing outside of sync re
maxbogue
2015/03/18 20:51:07
This allows the control types to register for inva
| |
| 354 return ModelTypeSetToSelection(types); | |
| 355 } | |
| 356 | |
| 350 void ProfileSyncServiceAndroid::SetPreferredDataTypes( | 357 void ProfileSyncServiceAndroid::SetPreferredDataTypes( |
| 351 JNIEnv* env, jobject obj, | 358 JNIEnv* env, jobject obj, |
| 352 jboolean sync_everything, | 359 jboolean sync_everything, |
| 353 jlong model_type_selection) { | 360 jlong model_type_selection) { |
| 354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 355 syncer::ModelTypeSet types; | 362 syncer::ModelTypeSet types; |
| 356 // Note: only user selectable types should be included here. | 363 // Note: only user selectable types should be included here. |
| 357 if (model_type_selection & AUTOFILL) | 364 if (model_type_selection & AUTOFILL) |
| 358 types.Put(syncer::AUTOFILL); | 365 types.Put(syncer::AUTOFILL); |
| 359 if (model_type_selection & BOOKMARK) | 366 if (model_type_selection & BOOKMARK) |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 ProfileSyncServiceAndroid* profile_sync_service_android = | 521 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 515 new ProfileSyncServiceAndroid(env, obj); | 522 new ProfileSyncServiceAndroid(env, obj); |
| 516 profile_sync_service_android->Init(); | 523 profile_sync_service_android->Init(); |
| 517 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 524 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
| 518 } | 525 } |
| 519 | 526 |
| 520 // static | 527 // static |
| 521 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 528 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
| 522 return RegisterNativesImpl(env); | 529 return RegisterNativesImpl(env); |
| 523 } | 530 } |
| OLD | NEW |