diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 21:18:18 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 21:18:18 +0000 |
commit | 6805b60643ae360b5350f97209a420ee46161fee (patch) | |
tree | 414704d0e4ea9d8767cdcffd115ec53f56a5cd94 /chrome/android | |
parent | d06bcaca1a000d55e80d9cbf0865eb32f7668ba1 (diff) | |
download | chromium_src-6805b60643ae360b5350f97209a420ee46161fee.zip chromium_src-6805b60643ae360b5350f97209a420ee46161fee.tar.gz chromium_src-6805b60643ae360b5350f97209a420ee46161fee.tar.bz2 |
[Sync] Move Android enabled types logic into native
This adds a JNI method to get the set of enabled types, which is then used
in registering for invalidations.
BUG=224144
Review URL: https://chromiumcodereview.appspot.com/13109002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android')
-rw-r--r-- | chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java index 3b28021..b7d3c2a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java @@ -420,22 +420,47 @@ public class ProfileSyncService { * @return Set of enabled types. */ public Set<ModelType> getPreferredDataTypes() { + long modelTypeSelection = + nativeGetEnabledDataTypes(mNativeProfileSyncServiceAndroid); Set<ModelType> syncTypes = new HashSet<ModelType>(); - - if (nativeIsAutofillSyncEnabled(mNativeProfileSyncServiceAndroid)) { - syncTypes.add(ModelType.AUTOFILL); + if ((modelTypeSelection & ModelTypeSelection.AUTOFILL) != 0) { + syncTypes.add(ModelType.AUTOFILL); + } + if ((modelTypeSelection & ModelTypeSelection.AUTOFILL_PROFILE) != 0) { + syncTypes.add(ModelType.AUTOFILL_PROFILE); + } + if ((modelTypeSelection & ModelTypeSelection.BOOKMARK) != 0) { + syncTypes.add(ModelType.BOOKMARK); + } + if ((modelTypeSelection & ModelTypeSelection.EXPERIMENTS) != 0) { + syncTypes.add(ModelType.EXPERIMENTS); + } + if ((modelTypeSelection & ModelTypeSelection.NIGORI) != 0) { + syncTypes.add(ModelType.NIGORI); + } + if ((modelTypeSelection & ModelTypeSelection.PASSWORD) != 0) { + syncTypes.add(ModelType.PASSWORD); + } + if ((modelTypeSelection & ModelTypeSelection.SESSION) != 0) { + syncTypes.add(ModelType.SESSION); + } + if ((modelTypeSelection & ModelTypeSelection.TYPED_URL) != 0) { + syncTypes.add(ModelType.TYPED_URL); + } + if ((modelTypeSelection & ModelTypeSelection.HISTORY_DELETE_DIRECTIVE) != 0) { + syncTypes.add(ModelType.HISTORY_DELETE_DIRECTIVE); } - if (nativeIsBookmarkSyncEnabled(mNativeProfileSyncServiceAndroid)) { - syncTypes.add(ModelType.BOOKMARK); + if ((modelTypeSelection & ModelTypeSelection.DEVICE_INFO) != 0) { + syncTypes.add(ModelType.DEVICE_INFO); } - if (nativeIsPasswordSyncEnabled(mNativeProfileSyncServiceAndroid)) { - syncTypes.add(ModelType.PASSWORD); + if ((modelTypeSelection & ModelTypeSelection.PROXY_TABS) != 0) { + syncTypes.add(ModelType.PROXY_TABS); } - if (nativeIsTypedUrlSyncEnabled(mNativeProfileSyncServiceAndroid)) { - syncTypes.add(ModelType.TYPED_URL); + if ((modelTypeSelection & ModelTypeSelection.FAVICON_IMAGE) != 0) { + syncTypes.add(ModelType.FAVICON_IMAGE); } - if (nativeIsSessionSyncEnabled(mNativeProfileSyncServiceAndroid)) { - syncTypes.add(ModelType.SESSION); + if ((modelTypeSelection & ModelTypeSelection.FAVICON_TRACKING) != 0) { + syncTypes.add(ModelType.FAVICON_TRACKING); } return syncTypes; } @@ -577,6 +602,8 @@ public class ProfileSyncService { private native String nativeGetSyncEnterCustomPassphraseBodyText( int nativeProfileSyncServiceAndroid); private native boolean nativeIsSyncKeystoreMigrationDone(int nativeProfileSyncServiceAndroid); + private native long nativeGetEnabledDataTypes( + int nativeProfileSyncServiceAndroid); private native void nativeSetPreferredDataTypes( int nativeProfileSyncServiceAndroid, boolean syncEverything, long modelTypeSelection); private native void nativeSetSetupInProgress( @@ -584,11 +611,6 @@ public class ProfileSyncService { private native void nativeSetSyncSetupCompleted(int nativeProfileSyncServiceAndroid); private native boolean nativeHasSyncSetupCompleted(int nativeProfileSyncServiceAndroid); private native boolean nativeHasKeepEverythingSynced(int nativeProfileSyncServiceAndroid); - private native boolean nativeIsAutofillSyncEnabled(int nativeProfileSyncServiceAndroid); - private native boolean nativeIsBookmarkSyncEnabled(int nativeProfileSyncServiceAndroid); - private native boolean nativeIsPasswordSyncEnabled(int nativeProfileSyncServiceAndroid); - private native boolean nativeIsTypedUrlSyncEnabled(int nativeProfileSyncServiceAndroid); - private native boolean nativeIsSessionSyncEnabled(int nativeProfileSyncServiceAndroid); private native boolean nativeHasUnrecoverableError(int nativeProfileSyncServiceAndroid); private native String nativeGetAboutInfoForTest(int nativeProfileSyncServiceAndroid); private native void nativeOAuth2TokenFetched( |