OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.preferences; | 5 package org.chromium.chrome.browser.preferences; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.util.Log; | 9 import android.util.Log; |
10 | 10 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 /** | 504 /** |
505 * @return Whether the Contextual Search feature is uninitialized (preferenc
e unset by the | 505 * @return Whether the Contextual Search feature is uninitialized (preferenc
e unset by the |
506 * user). | 506 * user). |
507 */ | 507 */ |
508 public boolean isContextualSearchUninitialized() { | 508 public boolean isContextualSearchUninitialized() { |
509 return getContextualSearchPreference().isEmpty(); | 509 return getContextualSearchPreference().isEmpty(); |
510 } | 510 } |
511 | 511 |
512 /** | 512 /** |
513 * @param Whether Contextual Search should be enabled. | 513 * @param enabled Whether Contextual Search should be enabled. |
514 */ | 514 */ |
515 public void setContextualSearchState(boolean enabled) { | 515 public void setContextualSearchState(boolean enabled) { |
516 setContextualSearchPreference(enabled | 516 setContextualSearchPreference(enabled |
517 ? CONTEXTUAL_SEARCH_ENABLED : CONTEXTUAL_SEARCH_DISABLED); | 517 ? CONTEXTUAL_SEARCH_ENABLED : CONTEXTUAL_SEARCH_DISABLED); |
518 } | 518 } |
519 | 519 |
520 /** | 520 /** |
521 * @return Whether the active Safe Browsing Extended Reporting pref is the n
ew Scout pref. | 521 * @return Whether the active Safe Browsing Extended Reporting pref is the n
ew Scout pref. |
522 */ | 522 */ |
523 public boolean isSafeBrowsingScoutReportingActive() { | 523 public boolean isSafeBrowsingScoutReportingActive() { |
524 return nativeIsScoutExtendedReportingActive(); | 524 return nativeIsScoutExtendedReportingActive(); |
525 } | 525 } |
526 | 526 |
527 /** | 527 /** |
528 * @return Whether Safe Browsing Extended Reporting is currently enabled. | 528 * @return Whether Safe Browsing Extended Reporting is currently enabled. |
529 */ | 529 */ |
530 public boolean isSafeBrowsingExtendedReportingEnabled() { | 530 public boolean isSafeBrowsingExtendedReportingEnabled() { |
531 return nativeGetSafeBrowsingExtendedReportingEnabled(); | 531 return nativeGetSafeBrowsingExtendedReportingEnabled(); |
532 } | 532 } |
533 | 533 |
534 /** | 534 /** |
535 * @param Whether Safe Browsing Extended Reporting should be enabled. | 535 * @param enabled Whether Safe Browsing Extended Reporting should be enabled
. |
536 */ | 536 */ |
537 public void setSafeBrowsingExtendedReportingEnabled(boolean enabled) { | 537 public void setSafeBrowsingExtendedReportingEnabled(boolean enabled) { |
538 nativeSetSafeBrowsingExtendedReportingEnabled(enabled); | 538 nativeSetSafeBrowsingExtendedReportingEnabled(enabled); |
539 } | 539 } |
540 | 540 |
541 /** | 541 /** |
542 * @return Whether Safe Browsing Extended Reporting is managed | 542 * @return Whether Safe Browsing Extended Reporting is managed |
543 */ | 543 */ |
544 public boolean isSafeBrowsingExtendedReportingManaged() { | 544 public boolean isSafeBrowsingExtendedReportingManaged() { |
545 return nativeGetSafeBrowsingExtendedReportingManaged(); | 545 return nativeGetSafeBrowsingExtendedReportingManaged(); |
546 } | 546 } |
547 | 547 |
548 /** | 548 /** |
549 * @return Whether Safe Browsing is currently enabled. | 549 * @return Whether Safe Browsing is currently enabled. |
550 */ | 550 */ |
551 public boolean isSafeBrowsingEnabled() { | 551 public boolean isSafeBrowsingEnabled() { |
552 return nativeGetSafeBrowsingEnabled(); | 552 return nativeGetSafeBrowsingEnabled(); |
553 } | 553 } |
554 | 554 |
555 /** | 555 /** |
556 * @param Whether Safe Browsing should be enabled. | 556 * @param enabled Whether Safe Browsing should be enabled. |
557 */ | 557 */ |
558 public void setSafeBrowsingEnabled(boolean enabled) { | 558 public void setSafeBrowsingEnabled(boolean enabled) { |
559 nativeSetSafeBrowsingEnabled(enabled); | 559 nativeSetSafeBrowsingEnabled(enabled); |
560 } | 560 } |
561 | 561 |
562 /** | 562 /** |
563 * @return Whether Safe Browsing is managed | 563 * @return Whether Safe Browsing is managed |
564 */ | 564 */ |
565 public boolean isSafeBrowsingManaged() { | 565 public boolean isSafeBrowsingManaged() { |
566 return nativeGetSafeBrowsingManaged(); | 566 return nativeGetSafeBrowsingManaged(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 * Sets whether the web service to resolve navigation error should be enable
d. | 643 * Sets whether the web service to resolve navigation error should be enable
d. |
644 */ | 644 */ |
645 public void setResolveNavigationErrorEnabled(boolean enabled) { | 645 public void setResolveNavigationErrorEnabled(boolean enabled) { |
646 nativeSetResolveNavigationErrorEnabled(enabled); | 646 nativeSetResolveNavigationErrorEnabled(enabled); |
647 } | 647 } |
648 | 648 |
649 /** | 649 /** |
650 * Checks the state of deletion preference for a certain browsing data type. | 650 * Checks the state of deletion preference for a certain browsing data type. |
651 * @param dataType The requested browsing data type (from the shared enum | 651 * @param dataType The requested browsing data type (from the shared enum |
652 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). | 652 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). |
| 653 * @param preferenceType Indicates if this is a checkbox on the default, bas
ic or advanced tab |
| 654 * to apply the right preference. |
653 * @return The state of the corresponding deletion preference. | 655 * @return The state of the corresponding deletion preference. |
654 */ | 656 */ |
655 public boolean getBrowsingDataDeletionPreference(int dataType) { | 657 public boolean getBrowsingDataDeletionPreference(int dataType, int preferenc
eType) { |
656 return nativeGetBrowsingDataDeletionPreference(dataType); | 658 return nativeGetBrowsingDataDeletionPreference(dataType, preferenceType)
; |
657 } | 659 } |
658 | 660 |
659 /** | 661 /** |
660 * Sets the state of deletion preference for a certain browsing data type. | 662 * Sets the state of deletion preference for a certain browsing data type. |
661 * @param dataType The requested browsing data type (from the shared enum | 663 * @param dataType The requested browsing data type (from the shared enum |
662 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). | 664 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). |
| 665 * @param preferenceType Indicates if this is a checkbox on the default, bas
ic or advanced tab |
| 666 * to apply the right preference. |
663 * @param value The state to be set. | 667 * @param value The state to be set. |
664 */ | 668 */ |
665 public void setBrowsingDataDeletionPreference(int dataType, boolean value) { | 669 public void setBrowsingDataDeletionPreference(int dataType, int preferenceTy
pe, boolean value) { |
666 nativeSetBrowsingDataDeletionPreference(dataType, value); | 670 nativeSetBrowsingDataDeletionPreference(dataType, preferenceType, value)
; |
667 } | 671 } |
668 | 672 |
669 /** | 673 /** |
670 * Gets the time period for which browsing data will be deleted. | 674 * Gets the time period for which browsing data will be deleted. |
| 675 * @param preferenceType Indicates if this is a timeperiod on the default, b
asic or advanced tab |
| 676 * to apply the right preference. |
671 * @return The currently selected browsing data deletion time period (from t
he shared enum | 677 * @return The currently selected browsing data deletion time period (from t
he shared enum |
672 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). | 678 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). |
673 */ | 679 */ |
674 public int getBrowsingDataDeletionTimePeriod() { | 680 public int getBrowsingDataDeletionTimePeriod(int preferenceType) { |
675 return nativeGetBrowsingDataDeletionTimePeriod(); | 681 return nativeGetBrowsingDataDeletionTimePeriod(preferenceType); |
676 } | 682 } |
677 | 683 |
678 /** | 684 /** |
679 * Sets the time period for which browsing data will be deleted. | 685 * Sets the time period for which browsing data will be deleted. |
| 686 * @param preferenceType Indicates if this is a timeperiod on the default, b
asic or advanced tab |
| 687 * to apply the right preference. |
| 688 |
680 * @param timePeriod The selected browsing data deletion time period (from t
he shared enum | 689 * @param timePeriod The selected browsing data deletion time period (from t
he shared enum |
681 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). | 690 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). |
682 */ | 691 */ |
683 public void setBrowsingDataDeletionTimePeriod(int timePeriod) { | 692 public void setBrowsingDataDeletionTimePeriod(int preferenceType, int timePe
riod) { |
684 nativeSetBrowsingDataDeletionTimePeriod(timePeriod); | 693 nativeSetBrowsingDataDeletionTimePeriod(preferenceType, timePeriod); |
685 } | 694 } |
686 | 695 |
687 /** | 696 /** |
688 * Clear the specified types of browsing data asynchronously. | 697 * Clear the specified types of browsing data asynchronously. |
689 * |listener| is an object to be notified when clearing completes. | 698 * |listener| is an object to be notified when clearing completes. |
690 * It can be null, but many operations (e.g. navigation) are | 699 * It can be null, but many operations (e.g. navigation) are |
691 * ill-advised while browsing data is being cleared. | 700 * ill-advised while browsing data is being cleared. |
692 * @param listener A listener to call back when the clearing is finished. | 701 * @param listener A listener to call back when the clearing is finished. |
693 * @param dataTypes An array of browsing data types to delete, represented a
s values from | 702 * @param dataTypes An array of browsing data types to delete, represented a
s values from |
694 * the shared enum {@link org.chromium.chrome.browser.browsing_data.Bro
wsingDataType}. | 703 * the shared enum {@link org.chromium.chrome.browser.browsing_data.Bro
wsingDataType}. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 745 |
737 /** | 746 /** |
738 * Set the index of the tab last visited by the user. | 747 * Set the index of the tab last visited by the user. |
739 * @param tabIndex The last visited tab index, 0 for basic, 1 for advanced. | 748 * @param tabIndex The last visited tab index, 0 for basic, 1 for advanced. |
740 */ | 749 */ |
741 public void setLastSelectedClearBrowsingDataTab(int tabIndex) { | 750 public void setLastSelectedClearBrowsingDataTab(int tabIndex) { |
742 nativeSetLastClearBrowsingDataTab(tabIndex); | 751 nativeSetLastClearBrowsingDataTab(tabIndex); |
743 } | 752 } |
744 | 753 |
745 /** | 754 /** |
| 755 * Migrate browsing data preferences when new "clear browsing data" dialog |
| 756 * with tabs is visited. |
| 757 */ |
| 758 public void migrateBrowsingDataPreferences() { |
| 759 nativeMigrateBrowsingDataPreferences(); |
| 760 } |
| 761 |
| 762 /** |
746 * @return Whether browser history can be deleted by the user. | 763 * @return Whether browser history can be deleted by the user. |
747 */ | 764 */ |
748 public boolean canDeleteBrowsingHistory() { | 765 public boolean canDeleteBrowsingHistory() { |
749 return nativeCanDeleteBrowsingHistory(); | 766 return nativeCanDeleteBrowsingHistory(); |
750 } | 767 } |
751 | 768 |
752 @CalledByNative | 769 @CalledByNative |
753 private void browsingDataCleared() { | 770 private void browsingDataCleared() { |
754 if (mClearBrowsingDataListener != null) { | 771 if (mClearBrowsingDataListener != null) { |
755 mClearBrowsingDataListener.onBrowsingDataCleared(); | 772 mClearBrowsingDataListener.onBrowsingDataCleared(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 private native boolean nativeGetResolveNavigationErrorManaged(); | 1109 private native boolean nativeGetResolveNavigationErrorManaged(); |
1093 private native boolean nativeGetProtectedMediaIdentifierEnabled(); | 1110 private native boolean nativeGetProtectedMediaIdentifierEnabled(); |
1094 private native boolean nativeGetIncognitoModeEnabled(); | 1111 private native boolean nativeGetIncognitoModeEnabled(); |
1095 private native boolean nativeGetIncognitoModeManaged(); | 1112 private native boolean nativeGetIncognitoModeManaged(); |
1096 private native boolean nativeGetPrintingEnabled(); | 1113 private native boolean nativeGetPrintingEnabled(); |
1097 private native boolean nativeGetPrintingManaged(); | 1114 private native boolean nativeGetPrintingManaged(); |
1098 private native boolean nativeGetSupervisedUserSafeSitesEnabled(); | 1115 private native boolean nativeGetSupervisedUserSafeSitesEnabled(); |
1099 private native void nativeSetTranslateEnabled(boolean enabled); | 1116 private native void nativeSetTranslateEnabled(boolean enabled); |
1100 private native void nativeResetTranslateDefaults(); | 1117 private native void nativeResetTranslateDefaults(); |
1101 private native void nativeMigrateJavascriptPreference(); | 1118 private native void nativeMigrateJavascriptPreference(); |
1102 private native boolean nativeGetBrowsingDataDeletionPreference(int dataType)
; | 1119 private native boolean nativeGetBrowsingDataDeletionPreference( |
1103 private native void nativeSetBrowsingDataDeletionPreference(int dataType, bo
olean value); | 1120 int dataType, int preferenceType); |
1104 private native int nativeGetBrowsingDataDeletionTimePeriod(); | 1121 private native void nativeSetBrowsingDataDeletionPreference( |
1105 private native void nativeSetBrowsingDataDeletionTimePeriod(int timePeriod); | 1122 int dataType, int preferenceType, boolean value); |
| 1123 private native int nativeGetBrowsingDataDeletionTimePeriod(int preferenceTyp
e); |
| 1124 private native void nativeSetBrowsingDataDeletionTimePeriod(int preferenceTy
pe, int timePeriod); |
1106 private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod, | 1125 private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod, |
1107 String[] blacklistDomains, int[] blacklistedDomainReasons, String[]
ignoredDomains, | 1126 String[] blacklistDomains, int[] blacklistedDomainReasons, String[]
ignoredDomains, |
1108 int[] ignoredDomainReasons); | 1127 int[] ignoredDomainReasons); |
1109 private native int nativeGetLastClearBrowsingDataTab(); | 1128 private native int nativeGetLastClearBrowsingDataTab(); |
1110 private native void nativeSetLastClearBrowsingDataTab(int lastTab); | 1129 private native void nativeSetLastClearBrowsingDataTab(int lastTab); |
| 1130 private native void nativeMigrateBrowsingDataPreferences(); |
1111 private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory( | 1131 private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory( |
1112 OtherFormsOfBrowsingHistoryListener listener); | 1132 OtherFormsOfBrowsingHistoryListener listener); |
1113 private native boolean nativeCanDeleteBrowsingHistory(); | 1133 private native boolean nativeCanDeleteBrowsingHistory(); |
1114 private static native void nativeFetchImportantSites(ImportantSitesCallback
callback); | 1134 private static native void nativeFetchImportantSites(ImportantSitesCallback
callback); |
1115 private static native int nativeGetMaxImportantSites(); | 1135 private static native int nativeGetMaxImportantSites(); |
1116 private static native void nativeMarkOriginAsImportantForTesting(String orig
in); | 1136 private static native void nativeMarkOriginAsImportantForTesting(String orig
in); |
1117 private native void nativeSetAutoplayEnabled(boolean allow); | 1137 private native void nativeSetAutoplayEnabled(boolean allow); |
1118 private native void nativeSetAllowCookiesEnabled(boolean allow); | 1138 private native void nativeSetAllowCookiesEnabled(boolean allow); |
1119 private native void nativeSetBackgroundSyncEnabled(boolean allow); | 1139 private native void nativeSetBackgroundSyncEnabled(boolean allow); |
1120 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled); | 1140 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL(
); | 1182 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL(
); |
1163 private native boolean nativeIsMetricsReportingEnabled(); | 1183 private native boolean nativeIsMetricsReportingEnabled(); |
1164 private native void nativeSetMetricsReportingEnabled(boolean enabled); | 1184 private native void nativeSetMetricsReportingEnabled(boolean enabled); |
1165 private native boolean nativeIsMetricsReportingManaged(); | 1185 private native boolean nativeIsMetricsReportingManaged(); |
1166 private native void nativeSetClickedUpdateMenuItem(boolean clicked); | 1186 private native void nativeSetClickedUpdateMenuItem(boolean clicked); |
1167 private native boolean nativeGetClickedUpdateMenuItem(); | 1187 private native boolean nativeGetClickedUpdateMenuItem(); |
1168 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v
ersion); | 1188 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v
ersion); |
1169 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); | 1189 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); |
1170 private native void nativeSetSupervisedUserId(String supervisedUserId); | 1190 private native void nativeSetSupervisedUserId(String supervisedUserId); |
1171 } | 1191 } |
OLD | NEW |