| 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 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.util.Log; | 9 import android.util.Log; |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 assert isSyncInitialized(); | 310 assert isSyncInitialized(); |
| 311 return nativeSetDecryptionPassphrase(mNativeProfileSyncServiceAndroid, p
assphrase); | 311 return nativeSetDecryptionPassphrase(mNativeProfileSyncServiceAndroid, p
assphrase); |
| 312 } | 312 } |
| 313 | 313 |
| 314 public GoogleServiceAuthError.State getAuthError() { | 314 public GoogleServiceAuthError.State getAuthError() { |
| 315 int authErrorCode = nativeGetAuthError(mNativeProfileSyncServiceAndroid)
; | 315 int authErrorCode = nativeGetAuthError(mNativeProfileSyncServiceAndroid)
; |
| 316 return GoogleServiceAuthError.State.fromCode(authErrorCode); | 316 return GoogleServiceAuthError.State.fromCode(authErrorCode); |
| 317 } | 317 } |
| 318 | 318 |
| 319 /** | 319 /** |
| 320 * Gets the set of data types that are currently enabled to sync. | 320 * Gets the set of data types that are currently syncing. |
| 321 * | 321 * |
| 322 * @return Set of enabled types. | 322 * This is affected by whether sync is on. |
| 323 * |
| 324 * @return Set of active data types. |
| 323 */ | 325 */ |
| 324 public Set<ModelType> getPreferredDataTypes() { | 326 public Set<ModelType> getActiveDataTypes() { |
| 325 long modelTypeSelection = | 327 long modelTypeSelection = nativeGetActiveDataTypes(mNativeProfileSyncSer
viceAndroid); |
| 326 nativeGetEnabledDataTypes(mNativeProfileSyncServiceAndroid); | |
| 327 return modelTypeSelectionToSet(modelTypeSelection); | 328 return modelTypeSelectionToSet(modelTypeSelection); |
| 328 } | 329 } |
| 329 | 330 |
| 331 /** |
| 332 * Gets the set of data types that are enabled in sync. |
| 333 * |
| 334 * This is unaffected by whether sync is on. |
| 335 * |
| 336 * @return Set of preferred types. |
| 337 */ |
| 338 public Set<ModelType> getPreferredDataTypes() { |
| 339 // TODO(maxbogue): Correct this line to GetPreferredDataTypes once |
| 340 // downstream uses are fixed. |
| 341 long modelTypeSelection = nativeGetActiveDataTypes(mNativeProfileSyncSer
viceAndroid); |
| 342 return modelTypeSelectionToSet(modelTypeSelection); |
| 343 } |
| 344 |
| 330 @VisibleForTesting | 345 @VisibleForTesting |
| 331 public static Set<ModelType> modelTypeSelectionToSet(long modelTypeSelection
) { | 346 public static Set<ModelType> modelTypeSelectionToSet(long modelTypeSelection
) { |
| 332 Set<ModelType> syncTypes = new HashSet<ModelType>(); | 347 Set<ModelType> syncTypes = new HashSet<ModelType>(); |
| 333 if ((modelTypeSelection & ModelTypeSelection.AUTOFILL) != 0) { | 348 if ((modelTypeSelection & ModelTypeSelection.AUTOFILL) != 0) { |
| 334 syncTypes.add(ModelType.AUTOFILL); | 349 syncTypes.add(ModelType.AUTOFILL); |
| 335 } | 350 } |
| 336 if ((modelTypeSelection & ModelTypeSelection.AUTOFILL_PROFILE) != 0) { | 351 if ((modelTypeSelection & ModelTypeSelection.AUTOFILL_PROFILE) != 0) { |
| 337 syncTypes.add(ModelType.AUTOFILL_PROFILE); | 352 syncTypes.add(ModelType.AUTOFILL_PROFILE); |
| 338 } | 353 } |
| 339 if ((modelTypeSelection & ModelTypeSelection.BOOKMARK) != 0) { | 354 if ((modelTypeSelection & ModelTypeSelection.BOOKMARK) != 0) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 private native boolean nativeHasExplicitPassphraseTime(long nativeProfileSyn
cServiceAndroid); | 585 private native boolean nativeHasExplicitPassphraseTime(long nativeProfileSyn
cServiceAndroid); |
| 571 private native long nativeGetExplicitPassphraseTime(long nativeProfileSyncSe
rviceAndroid); | 586 private native long nativeGetExplicitPassphraseTime(long nativeProfileSyncSe
rviceAndroid); |
| 572 private native String nativeGetSyncEnterGooglePassphraseBodyWithDateText( | 587 private native String nativeGetSyncEnterGooglePassphraseBodyWithDateText( |
| 573 long nativeProfileSyncServiceAndroid); | 588 long nativeProfileSyncServiceAndroid); |
| 574 private native String nativeGetSyncEnterCustomPassphraseBodyWithDateText( | 589 private native String nativeGetSyncEnterCustomPassphraseBodyWithDateText( |
| 575 long nativeProfileSyncServiceAndroid); | 590 long nativeProfileSyncServiceAndroid); |
| 576 private native String nativeGetCurrentSignedInAccountText(long nativeProfile
SyncServiceAndroid); | 591 private native String nativeGetCurrentSignedInAccountText(long nativeProfile
SyncServiceAndroid); |
| 577 private native String nativeGetSyncEnterCustomPassphraseBodyText( | 592 private native String nativeGetSyncEnterCustomPassphraseBodyText( |
| 578 long nativeProfileSyncServiceAndroid); | 593 long nativeProfileSyncServiceAndroid); |
| 579 private native boolean nativeIsSyncKeystoreMigrationDone(long nativeProfileS
yncServiceAndroid); | 594 private native boolean nativeIsSyncKeystoreMigrationDone(long nativeProfileS
yncServiceAndroid); |
| 580 private native long nativeGetEnabledDataTypes(long nativeProfileSyncServiceA
ndroid); | 595 private native long nativeGetActiveDataTypes(long nativeProfileSyncServiceAn
droid); |
| 596 private native long nativeGetPreferredDataTypes(long nativeProfileSyncServic
eAndroid); |
| 581 private native void nativeSetPreferredDataTypes( | 597 private native void nativeSetPreferredDataTypes( |
| 582 long nativeProfileSyncServiceAndroid, boolean syncEverything, long m
odelTypeSelection); | 598 long nativeProfileSyncServiceAndroid, boolean syncEverything, long m
odelTypeSelection); |
| 583 private native void nativeSetSetupInProgress( | 599 private native void nativeSetSetupInProgress( |
| 584 long nativeProfileSyncServiceAndroid, boolean inProgress); | 600 long nativeProfileSyncServiceAndroid, boolean inProgress); |
| 585 private native void nativeSetSyncSetupCompleted(long nativeProfileSyncServic
eAndroid); | 601 private native void nativeSetSyncSetupCompleted(long nativeProfileSyncServic
eAndroid); |
| 586 private native boolean nativeHasSyncSetupCompleted(long nativeProfileSyncSer
viceAndroid); | 602 private native boolean nativeHasSyncSetupCompleted(long nativeProfileSyncSer
viceAndroid); |
| 587 private native boolean nativeIsStartSuppressed(long nativeProfileSyncService
Android); | 603 private native boolean nativeIsStartSuppressed(long nativeProfileSyncService
Android); |
| 588 private native boolean nativeHasKeepEverythingSynced(long nativeProfileSyncS
erviceAndroid); | 604 private native boolean nativeHasKeepEverythingSynced(long nativeProfileSyncS
erviceAndroid); |
| 589 private native boolean nativeHasUnrecoverableError(long nativeProfileSyncSer
viceAndroid); | 605 private native boolean nativeHasUnrecoverableError(long nativeProfileSyncSer
viceAndroid); |
| 590 private native String nativeGetAboutInfoForTest(long nativeProfileSyncServic
eAndroid); | 606 private native String nativeGetAboutInfoForTest(long nativeProfileSyncServic
eAndroid); |
| 591 private native long nativeGetLastSyncedTimeForTest(long nativeProfileSyncSer
viceAndroid); | 607 private native long nativeGetLastSyncedTimeForTest(long nativeProfileSyncSer
viceAndroid); |
| 592 private native void nativeOverrideNetworkResourcesForTest( | 608 private native void nativeOverrideNetworkResourcesForTest( |
| 593 long nativeProfileSyncServiceAndroid, long networkResources); | 609 long nativeProfileSyncServiceAndroid, long networkResources); |
| 594 } | 610 } |
| OLD | NEW |