| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 PROXY_TABS = 1 << 7, | 60 PROXY_TABS = 1 << 7, |
| 61 FAVICON_IMAGE = 1 << 8, | 61 FAVICON_IMAGE = 1 << 8, |
| 62 FAVICON_TRACKING = 1 << 9, | 62 FAVICON_TRACKING = 1 << 9, |
| 63 NIGORI = 1 << 10, | 63 NIGORI = 1 << 10, |
| 64 DEVICE_INFO = 1 << 11, | 64 DEVICE_INFO = 1 << 11, |
| 65 EXPERIMENTS = 1 << 12, | 65 EXPERIMENTS = 1 << 12, |
| 66 SUPERVISED_USER_SETTING = 1 << 13, | 66 SUPERVISED_USER_SETTING = 1 << 13, |
| 67 SUPERVISED_USER_WHITELIST = 1 << 14, | 67 SUPERVISED_USER_WHITELIST = 1 << 14, |
| 68 AUTOFILL_WALLET = 1 << 15, | 68 AUTOFILL_WALLET = 1 << 15, |
| 69 AUTOFILL_WALLET_METADATA = 1 << 16, | 69 AUTOFILL_WALLET_METADATA = 1 << 16, |
| 70 PREFERENCE = 1 << 17, |
| 71 PRIORITY_PREFERENCE = 1 << 18, |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 // Native callback for the JNI GetAllNodes method. When | 74 // Native callback for the JNI GetAllNodes method. When |
| 73 // ProfileSyncService::GetAllNodes completes, this method is called and the | 75 // ProfileSyncService::GetAllNodes completes, this method is called and the |
| 74 // results are sent to the Java callback. | 76 // results are sent to the Java callback. |
| 75 void NativeGetAllNodesCallback( | 77 void NativeGetAllNodesCallback( |
| 76 const base::android::ScopedJavaGlobalRef<jobject>& callback, | 78 const base::android::ScopedJavaGlobalRef<jobject>& callback, |
| 77 scoped_ptr<base::ListValue> result) { | 79 scoped_ptr<base::ListValue> result) { |
| 78 JNIEnv* env = base::android::AttachCurrentThread(); | 80 JNIEnv* env = base::android::AttachCurrentThread(); |
| 79 std::string json_string; | 81 std::string json_string; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 if (model_type_selection & AUTOFILL) | 415 if (model_type_selection & AUTOFILL) |
| 414 types.Put(syncer::AUTOFILL); | 416 types.Put(syncer::AUTOFILL); |
| 415 if (model_type_selection & BOOKMARK) | 417 if (model_type_selection & BOOKMARK) |
| 416 types.Put(syncer::BOOKMARKS); | 418 types.Put(syncer::BOOKMARKS); |
| 417 if (model_type_selection & PASSWORD) | 419 if (model_type_selection & PASSWORD) |
| 418 types.Put(syncer::PASSWORDS); | 420 types.Put(syncer::PASSWORDS); |
| 419 if (model_type_selection & PROXY_TABS) | 421 if (model_type_selection & PROXY_TABS) |
| 420 types.Put(syncer::PROXY_TABS); | 422 types.Put(syncer::PROXY_TABS); |
| 421 if (model_type_selection & TYPED_URL) | 423 if (model_type_selection & TYPED_URL) |
| 422 types.Put(syncer::TYPED_URLS); | 424 types.Put(syncer::TYPED_URLS); |
| 425 if (model_type_selection & PREFERENCE) |
| 426 types.Put(syncer::PREFERENCES); |
| 423 DCHECK(syncer::UserSelectableTypes().HasAll(types)); | 427 DCHECK(syncer::UserSelectableTypes().HasAll(types)); |
| 424 sync_service_->OnUserChoseDatatypes(sync_everything, types); | 428 sync_service_->OnUserChoseDatatypes(sync_everything, types); |
| 425 } | 429 } |
| 426 | 430 |
| 427 void ProfileSyncServiceAndroid::SetSetupInProgress( | 431 void ProfileSyncServiceAndroid::SetSetupInProgress( |
| 428 JNIEnv* env, jobject obj, jboolean in_progress) { | 432 JNIEnv* env, jobject obj, jboolean in_progress) { |
| 429 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 433 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 430 sync_service_->SetSetupInProgress(in_progress); | 434 sync_service_->SetSetupInProgress(in_progress); |
| 431 } | 435 } |
| 432 | 436 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 521 } |
| 518 if (types.Has(syncer::AUTOFILL_WALLET_DATA)) { | 522 if (types.Has(syncer::AUTOFILL_WALLET_DATA)) { |
| 519 model_type_selection |= AUTOFILL_WALLET; | 523 model_type_selection |= AUTOFILL_WALLET; |
| 520 } | 524 } |
| 521 if (types.Has(syncer::AUTOFILL_WALLET_METADATA)) { | 525 if (types.Has(syncer::AUTOFILL_WALLET_METADATA)) { |
| 522 model_type_selection |= AUTOFILL_WALLET_METADATA; | 526 model_type_selection |= AUTOFILL_WALLET_METADATA; |
| 523 } | 527 } |
| 524 if (types.Has(syncer::PASSWORDS)) { | 528 if (types.Has(syncer::PASSWORDS)) { |
| 525 model_type_selection |= PASSWORD; | 529 model_type_selection |= PASSWORD; |
| 526 } | 530 } |
| 531 if (types.Has(syncer::PREFERENCES)) { |
| 532 model_type_selection |= PREFERENCE; |
| 533 } |
| 534 if (types.Has(syncer::PRIORITY_PREFERENCES)) { |
| 535 model_type_selection |= PRIORITY_PREFERENCE; |
| 536 } |
| 527 if (types.Has(syncer::TYPED_URLS)) { | 537 if (types.Has(syncer::TYPED_URLS)) { |
| 528 model_type_selection |= TYPED_URL; | 538 model_type_selection |= TYPED_URL; |
| 529 } | 539 } |
| 530 if (types.Has(syncer::SESSIONS)) { | 540 if (types.Has(syncer::SESSIONS)) { |
| 531 model_type_selection |= SESSION; | 541 model_type_selection |= SESSION; |
| 532 } | 542 } |
| 533 if (types.Has(syncer::HISTORY_DELETE_DIRECTIVES)) { | 543 if (types.Has(syncer::HISTORY_DELETE_DIRECTIVES)) { |
| 534 model_type_selection |= HISTORY_DELETE_DIRECTIVE; | 544 model_type_selection |= HISTORY_DELETE_DIRECTIVE; |
| 535 } | 545 } |
| 536 if (types.Has(syncer::PROXY_TABS)) { | 546 if (types.Has(syncer::PROXY_TABS)) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 ProfileSyncServiceAndroid* profile_sync_service_android = | 591 ProfileSyncServiceAndroid* profile_sync_service_android = |
| 582 new ProfileSyncServiceAndroid(env, obj); | 592 new ProfileSyncServiceAndroid(env, obj); |
| 583 profile_sync_service_android->Init(); | 593 profile_sync_service_android->Init(); |
| 584 return reinterpret_cast<intptr_t>(profile_sync_service_android); | 594 return reinterpret_cast<intptr_t>(profile_sync_service_android); |
| 585 } | 595 } |
| 586 | 596 |
| 587 // static | 597 // static |
| 588 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { | 598 bool ProfileSyncServiceAndroid::Register(JNIEnv* env) { |
| 589 return RegisterNativesImpl(env); | 599 return RegisterNativesImpl(env); |
| 590 } | 600 } |
| OLD | NEW |