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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 | 516 |
517 /** | 517 /** |
518 * @return Whether the Contextual Search feature is uninitialized (preferenc e unset by the | 518 * @return Whether the Contextual Search feature is uninitialized (preferenc e unset by the |
519 * user). | 519 * user). |
520 */ | 520 */ |
521 public boolean isContextualSearchUninitialized() { | 521 public boolean isContextualSearchUninitialized() { |
522 return getContextualSearchPreference().isEmpty(); | 522 return getContextualSearchPreference().isEmpty(); |
523 } | 523 } |
524 | 524 |
525 /** | 525 /** |
526 * @param Whether Contextual Search should be enabled. | 526 * @param enabled Whether Contextual Search should be enabled. |
527 */ | 527 */ |
528 public void setContextualSearchState(boolean enabled) { | 528 public void setContextualSearchState(boolean enabled) { |
529 setContextualSearchPreference(enabled | 529 setContextualSearchPreference(enabled |
530 ? CONTEXTUAL_SEARCH_ENABLED : CONTEXTUAL_SEARCH_DISABLED); | 530 ? CONTEXTUAL_SEARCH_ENABLED : CONTEXTUAL_SEARCH_DISABLED); |
531 } | 531 } |
532 | 532 |
533 /** | 533 /** |
534 * @return Whether the active Safe Browsing Extended Reporting pref is the n ew Scout pref. | 534 * @return Whether the active Safe Browsing Extended Reporting pref is the n ew Scout pref. |
535 */ | 535 */ |
536 public boolean isSafeBrowsingScoutReportingActive() { | 536 public boolean isSafeBrowsingScoutReportingActive() { |
537 return nativeIsScoutExtendedReportingActive(); | 537 return nativeIsScoutExtendedReportingActive(); |
538 } | 538 } |
539 | 539 |
540 /** | 540 /** |
541 * @return Whether Safe Browsing Extended Reporting is currently enabled. | 541 * @return Whether Safe Browsing Extended Reporting is currently enabled. |
542 */ | 542 */ |
543 public boolean isSafeBrowsingExtendedReportingEnabled() { | 543 public boolean isSafeBrowsingExtendedReportingEnabled() { |
544 return nativeGetSafeBrowsingExtendedReportingEnabled(); | 544 return nativeGetSafeBrowsingExtendedReportingEnabled(); |
545 } | 545 } |
546 | 546 |
547 /** | 547 /** |
548 * @param Whether Safe Browsing Extended Reporting should be enabled. | 548 * @param enabled Whether Safe Browsing Extended Reporting should be enabled . |
549 */ | 549 */ |
550 public void setSafeBrowsingExtendedReportingEnabled(boolean enabled) { | 550 public void setSafeBrowsingExtendedReportingEnabled(boolean enabled) { |
551 nativeSetSafeBrowsingExtendedReportingEnabled(enabled); | 551 nativeSetSafeBrowsingExtendedReportingEnabled(enabled); |
552 } | 552 } |
553 | 553 |
554 /** | 554 /** |
555 * @return Whether Safe Browsing Extended Reporting is managed | 555 * @return Whether Safe Browsing Extended Reporting is managed |
556 */ | 556 */ |
557 public boolean isSafeBrowsingExtendedReportingManaged() { | 557 public boolean isSafeBrowsingExtendedReportingManaged() { |
558 return nativeGetSafeBrowsingExtendedReportingManaged(); | 558 return nativeGetSafeBrowsingExtendedReportingManaged(); |
559 } | 559 } |
560 | 560 |
561 /** | 561 /** |
562 * @return Whether Safe Browsing is currently enabled. | 562 * @return Whether Safe Browsing is currently enabled. |
563 */ | 563 */ |
564 public boolean isSafeBrowsingEnabled() { | 564 public boolean isSafeBrowsingEnabled() { |
565 return nativeGetSafeBrowsingEnabled(); | 565 return nativeGetSafeBrowsingEnabled(); |
566 } | 566 } |
567 | 567 |
568 /** | 568 /** |
569 * @param Whether Safe Browsing should be enabled. | 569 * @param enabled Whether Safe Browsing should be enabled. |
570 */ | 570 */ |
571 public void setSafeBrowsingEnabled(boolean enabled) { | 571 public void setSafeBrowsingEnabled(boolean enabled) { |
572 nativeSetSafeBrowsingEnabled(enabled); | 572 nativeSetSafeBrowsingEnabled(enabled); |
573 } | 573 } |
574 | 574 |
575 /** | 575 /** |
576 * @return Whether Safe Browsing is managed | 576 * @return Whether Safe Browsing is managed |
577 */ | 577 */ |
578 public boolean isSafeBrowsingManaged() { | 578 public boolean isSafeBrowsingManaged() { |
579 return nativeGetSafeBrowsingManaged(); | 579 return nativeGetSafeBrowsingManaged(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
656 * Sets whether the web service to resolve navigation error should be enable d. | 656 * Sets whether the web service to resolve navigation error should be enable d. |
657 */ | 657 */ |
658 public void setResolveNavigationErrorEnabled(boolean enabled) { | 658 public void setResolveNavigationErrorEnabled(boolean enabled) { |
659 nativeSetResolveNavigationErrorEnabled(enabled); | 659 nativeSetResolveNavigationErrorEnabled(enabled); |
660 } | 660 } |
661 | 661 |
662 /** | 662 /** |
663 * Checks the state of deletion preference for a certain browsing data type. | 663 * Checks the state of deletion preference for a certain browsing data type. |
664 * @param dataType The requested browsing data type (from the shared enum | 664 * @param dataType The requested browsing data type (from the shared enum |
665 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). | 665 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). |
666 * @param clearBrowsingDataTab Indicates if this is a checkbox on the defaul t, basic or advanced | |
667 * tab to apply the right preference. | |
666 * @return The state of the corresponding deletion preference. | 668 * @return The state of the corresponding deletion preference. |
667 */ | 669 */ |
668 public boolean getBrowsingDataDeletionPreference(int dataType) { | 670 public boolean getBrowsingDataDeletionPreference(int dataType, int clearBrow singDataTab) { |
669 return nativeGetBrowsingDataDeletionPreference(dataType); | 671 return nativeGetBrowsingDataDeletionPreference(dataType, clearBrowsingDa taTab); |
670 } | 672 } |
671 | 673 |
672 /** | 674 /** |
673 * Sets the state of deletion preference for a certain browsing data type. | 675 * Sets the state of deletion preference for a certain browsing data type. |
674 * @param dataType The requested browsing data type (from the shared enum | 676 * @param dataType The requested browsing data type (from the shared enum |
675 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). | 677 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). |
678 * @param clearBrowsingDataTab Indicates if this is a checkbox on the defaul t, basic or advanced | |
679 * tab to apply the right preference. | |
676 * @param value The state to be set. | 680 * @param value The state to be set. |
677 */ | 681 */ |
678 public void setBrowsingDataDeletionPreference(int dataType, boolean value) { | 682 public void setBrowsingDataDeletionPreference( |
679 nativeSetBrowsingDataDeletionPreference(dataType, value); | 683 int dataType, int clearBrowsingDataTab, boolean value) { |
684 nativeSetBrowsingDataDeletionPreference(dataType, clearBrowsingDataTab, value); | |
680 } | 685 } |
681 | 686 |
682 /** | 687 /** |
683 * Gets the time period for which browsing data will be deleted. | 688 * Gets the time period for which browsing data will be deleted. |
689 * @param clearBrowsingDataTab Indicates if this is a timeperiod on the defa ult, basic or | |
690 * advanced tab to apply the right preference. | |
684 * @return The currently selected browsing data deletion time period (from t he shared enum | 691 * @return The currently selected browsing data deletion time period (from t he shared enum |
685 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). | 692 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). |
686 */ | 693 */ |
687 public int getBrowsingDataDeletionTimePeriod() { | 694 public int getBrowsingDataDeletionTimePeriod(int clearBrowsingDataTab) { |
688 return nativeGetBrowsingDataDeletionTimePeriod(); | 695 return nativeGetBrowsingDataDeletionTimePeriod(clearBrowsingDataTab); |
689 } | 696 } |
690 | 697 |
691 /** | 698 /** |
692 * Sets the time period for which browsing data will be deleted. | 699 * Sets the time period for which browsing data will be deleted. |
700 * @param clearBrowsingDataTab Indicates if this is a timeperiod on the defa ult, basic or | |
701 * advanced tab to apply the right preference. | |
693 * @param timePeriod The selected browsing data deletion time period (from t he shared enum | 702 * @param timePeriod The selected browsing data deletion time period (from t he shared enum |
694 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). | 703 * {@link org.chromium.chrome.browser.browsing_data.TimePeriod}). |
695 */ | 704 */ |
696 public void setBrowsingDataDeletionTimePeriod(int timePeriod) { | 705 public void setBrowsingDataDeletionTimePeriod(int clearBrowsingDataTab, int timePeriod) { |
697 nativeSetBrowsingDataDeletionTimePeriod(timePeriod); | 706 nativeSetBrowsingDataDeletionTimePeriod(clearBrowsingDataTab, timePeriod ); |
698 } | 707 } |
699 | 708 |
700 /** | 709 /** |
701 * Clear the specified types of browsing data asynchronously. | 710 * Clear the specified types of browsing data asynchronously. |
702 * |listener| is an object to be notified when clearing completes. | 711 * |listener| is an object to be notified when clearing completes. |
703 * It can be null, but many operations (e.g. navigation) are | 712 * It can be null, but many operations (e.g. navigation) are |
704 * ill-advised while browsing data is being cleared. | 713 * ill-advised while browsing data is being cleared. |
705 * @param listener A listener to call back when the clearing is finished. | 714 * @param listener A listener to call back when the clearing is finished. |
706 * @param dataTypes An array of browsing data types to delete, represented a s values from | 715 * @param dataTypes An array of browsing data types to delete, represented a s values from |
707 * the shared enum {@link org.chromium.chrome.browser.browsing_data.Bro wsingDataType}. | 716 * 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... | |
749 | 758 |
750 /** | 759 /** |
751 * Set the index of the tab last visited by the user. | 760 * Set the index of the tab last visited by the user. |
752 * @param tabIndex The last visited tab index, 0 for basic, 1 for advanced. | 761 * @param tabIndex The last visited tab index, 0 for basic, 1 for advanced. |
753 */ | 762 */ |
754 public void setLastSelectedClearBrowsingDataTab(int tabIndex) { | 763 public void setLastSelectedClearBrowsingDataTab(int tabIndex) { |
755 nativeSetLastClearBrowsingDataTab(tabIndex); | 764 nativeSetLastClearBrowsingDataTab(tabIndex); |
756 } | 765 } |
757 | 766 |
758 /** | 767 /** |
768 * Migrate browsing data preferences when new "clear browsing data" dialog | |
769 * with tabs is visited. | |
Theresa
2017/03/01 17:45:45
nit: Does this fit on the line above?
dullweber
2017/03/02 09:24:38
not completely but I moved some words up
| |
770 */ | |
771 public void migrateBrowsingDataPreferences() { | |
772 nativeMigrateBrowsingDataPreferences(); | |
773 } | |
774 | |
775 /** | |
759 * @return Whether browser history can be deleted by the user. | 776 * @return Whether browser history can be deleted by the user. |
760 */ | 777 */ |
761 public boolean canDeleteBrowsingHistory() { | 778 public boolean canDeleteBrowsingHistory() { |
762 return nativeCanDeleteBrowsingHistory(); | 779 return nativeCanDeleteBrowsingHistory(); |
763 } | 780 } |
764 | 781 |
765 @CalledByNative | 782 @CalledByNative |
766 private void browsingDataCleared() { | 783 private void browsingDataCleared() { |
767 if (mClearBrowsingDataListener != null) { | 784 if (mClearBrowsingDataListener != null) { |
768 mClearBrowsingDataListener.onBrowsingDataCleared(); | 785 mClearBrowsingDataListener.onBrowsingDataCleared(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1105 private native boolean nativeGetResolveNavigationErrorManaged(); | 1122 private native boolean nativeGetResolveNavigationErrorManaged(); |
1106 private native boolean nativeGetProtectedMediaIdentifierEnabled(); | 1123 private native boolean nativeGetProtectedMediaIdentifierEnabled(); |
1107 private native boolean nativeGetIncognitoModeEnabled(); | 1124 private native boolean nativeGetIncognitoModeEnabled(); |
1108 private native boolean nativeGetIncognitoModeManaged(); | 1125 private native boolean nativeGetIncognitoModeManaged(); |
1109 private native boolean nativeGetPrintingEnabled(); | 1126 private native boolean nativeGetPrintingEnabled(); |
1110 private native boolean nativeGetPrintingManaged(); | 1127 private native boolean nativeGetPrintingManaged(); |
1111 private native boolean nativeGetSupervisedUserSafeSitesEnabled(); | 1128 private native boolean nativeGetSupervisedUserSafeSitesEnabled(); |
1112 private native void nativeSetTranslateEnabled(boolean enabled); | 1129 private native void nativeSetTranslateEnabled(boolean enabled); |
1113 private native void nativeResetTranslateDefaults(); | 1130 private native void nativeResetTranslateDefaults(); |
1114 private native void nativeMigrateJavascriptPreference(); | 1131 private native void nativeMigrateJavascriptPreference(); |
1115 private native boolean nativeGetBrowsingDataDeletionPreference(int dataType) ; | 1132 private native boolean nativeGetBrowsingDataDeletionPreference( |
1116 private native void nativeSetBrowsingDataDeletionPreference(int dataType, bo olean value); | 1133 int dataType, int clearBrowsingDataTab); |
1117 private native int nativeGetBrowsingDataDeletionTimePeriod(); | 1134 private native void nativeSetBrowsingDataDeletionPreference( |
1118 private native void nativeSetBrowsingDataDeletionTimePeriod(int timePeriod); | 1135 int dataType, int clearBrowsingDataTab, boolean value); |
1136 private native int nativeGetBrowsingDataDeletionTimePeriod(int clearBrowsing DataTab); | |
1137 private native void nativeSetBrowsingDataDeletionTimePeriod( | |
1138 int clearBrowsingDataTab, int timePeriod); | |
1119 private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod, | 1139 private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod, |
1120 String[] blacklistDomains, int[] blacklistedDomainReasons, String[] ignoredDomains, | 1140 String[] blacklistDomains, int[] blacklistedDomainReasons, String[] ignoredDomains, |
1121 int[] ignoredDomainReasons); | 1141 int[] ignoredDomainReasons); |
1122 private native int nativeGetLastClearBrowsingDataTab(); | 1142 private native int nativeGetLastClearBrowsingDataTab(); |
1123 private native void nativeSetLastClearBrowsingDataTab(int lastTab); | 1143 private native void nativeSetLastClearBrowsingDataTab(int lastTab); |
1144 private native void nativeMigrateBrowsingDataPreferences(); | |
1124 private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory( | 1145 private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory( |
1125 OtherFormsOfBrowsingHistoryListener listener); | 1146 OtherFormsOfBrowsingHistoryListener listener); |
1126 private native boolean nativeCanDeleteBrowsingHistory(); | 1147 private native boolean nativeCanDeleteBrowsingHistory(); |
1127 private static native void nativeFetchImportantSites(ImportantSitesCallback callback); | 1148 private static native void nativeFetchImportantSites(ImportantSitesCallback callback); |
1128 private static native int nativeGetMaxImportantSites(); | 1149 private static native int nativeGetMaxImportantSites(); |
1129 private static native void nativeMarkOriginAsImportantForTesting(String orig in); | 1150 private static native void nativeMarkOriginAsImportantForTesting(String orig in); |
1130 private native void nativeSetAutoplayEnabled(boolean allow); | 1151 private native void nativeSetAutoplayEnabled(boolean allow); |
1131 private native void nativeSetAllowCookiesEnabled(boolean allow); | 1152 private native void nativeSetAllowCookiesEnabled(boolean allow); |
1132 private native void nativeSetBackgroundSyncEnabled(boolean allow); | 1153 private native void nativeSetBackgroundSyncEnabled(boolean allow); |
1133 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled); | 1154 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1175 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); | 1196 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); |
1176 private native boolean nativeIsMetricsReportingEnabled(); | 1197 private native boolean nativeIsMetricsReportingEnabled(); |
1177 private native void nativeSetMetricsReportingEnabled(boolean enabled); | 1198 private native void nativeSetMetricsReportingEnabled(boolean enabled); |
1178 private native boolean nativeIsMetricsReportingManaged(); | 1199 private native boolean nativeIsMetricsReportingManaged(); |
1179 private native void nativeSetClickedUpdateMenuItem(boolean clicked); | 1200 private native void nativeSetClickedUpdateMenuItem(boolean clicked); |
1180 private native boolean nativeGetClickedUpdateMenuItem(); | 1201 private native boolean nativeGetClickedUpdateMenuItem(); |
1181 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion); | 1202 private native void nativeSetLatestVersionWhenClickedUpdateMenuItem(String v ersion); |
1182 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); | 1203 private native String nativeGetLatestVersionWhenClickedUpdateMenuItem(); |
1183 private native void nativeSetSupervisedUserId(String supervisedUserId); | 1204 private native void nativeSetSupervisedUserId(String supervisedUserId); |
1184 } | 1205 } |
OLD | NEW |