Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3491)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java

Issue 2756173002: Move code about browsing data from PrefServiceBridge to BrowsingDataBridge. (Closed)
Patch Set: fix comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
index 9d5a3398ad64c41da0a7d81dc154d03e037b45fb..57ccf7f6260fbddb72c020f917d973701f172f20 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
@@ -50,8 +50,6 @@ public final class PrefServiceBridge {
/** Signifies there are no permissions associated. */
private static final String[] EMPTY_PERMISSIONS = {};
- // Object to notify when "clear browsing data" completes.
- private OnClearBrowsingDataListener mClearBrowsingDataListener;
private static final String LOG_TAG = "PrefServiceBridge";
// Constants related to the Contextual Search preference.
@@ -83,54 +81,6 @@ public final class PrefServiceBridge {
}
}
- /**
- * Interface for a class that is listening to clear browser data events.
- */
- public interface OnClearBrowsingDataListener {
- public abstract void onBrowsingDataCleared();
- }
-
- /**
- * Interface for a class that is fetching important site information.
- */
- public interface ImportantSitesCallback {
- /**
- * Called when the list of important registerable domains has been fetched from cpp.
- * See net/base/registry_controlled_domains/registry_controlled_domain.h for more details on
- * registrable domains and the current list of effective eTLDs.
- * @param domains Important registerable domains.
- * @param exampleOrigins Example origins for each domain. These can be used to retrieve
- * favicons.
- * @param importantReasons Bitfield of reasons why this domain was selected. Pass this back
- * to clearBrowinsgData so we can record metrics.
- * @param dialogDisabled If the important dialog has been ignored too many times and should
- * not be shown.
- */
- @CalledByNative("ImportantSitesCallback")
- void onImportantRegisterableDomainsReady(String[] domains, String[] exampleOrigins,
- int[] importantReasons, boolean dialogDisabled);
- }
-
- /**
- * Interface to a class that receives callbacks instructing it to inform the user about other
- * forms of browsing history.
- */
- public interface OtherFormsOfBrowsingHistoryListener {
- /**
- * Called by the web history service when it discovers that other forms of browsing history
- * exist.
- */
- @CalledByNative("OtherFormsOfBrowsingHistoryListener")
- public abstract void enableDialogAboutOtherFormsOfBrowsingHistory();
-
- /**
- * Called by the web history service when the conditions for showing the dialog about
- * other forms of browsing history are met.
- */
- @CalledByNative("OtherFormsOfBrowsingHistoryListener")
- public abstract void showNoticeAboutOtherFormsOfBrowsingHistory();
- }
-
@CalledByNative
private static AboutVersionStrings createAboutVersionStrings(String applicationVersion,
String osVersion) {
@@ -714,47 +664,7 @@ public final class PrefServiceBridge {
nativeSetBrowsingDataDeletionTimePeriod(clearBrowsingDataTab, timePeriod);
}
- /**
- * Clear the specified types of browsing data asynchronously.
- * |listener| is an object to be notified when clearing completes.
- * It can be null, but many operations (e.g. navigation) are
- * ill-advised while browsing data is being cleared.
- * @param listener A listener to call back when the clearing is finished.
- * @param dataTypes An array of browsing data types to delete, represented as values from
- * the shared enum {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}.
- * @param timePeriod The time period for which to delete the data, represented as a value from
- * the shared enum {@link org.chromium.chrome.browser.browsing_data.TimePeriod}.
- */
- public void clearBrowsingData(
- OnClearBrowsingDataListener listener, int[] dataTypes, int timePeriod) {
- clearBrowsingDataExcludingDomains(listener, dataTypes, timePeriod, new String[0],
- new int[0], new String[0], new int[0]);
- }
- /**
- * Same as above, but now we can specify a list of domains to exclude from clearing browsing
- * data.
- * Do not use this method unless caller knows what they're doing. Not all backends are supported
- * yet, and more data than expected could be deleted. See crbug.com/113621.
- * @param listener A listener to call back when the clearing is finished.
- * @param dataTypes An array of browsing data types to delete, represented as values from
- * the shared enum {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}.
- * @param timePeriod The time period for which to delete the data, represented as a value from
- * the shared enum {@link org.chromium.chrome.browser.browsing_data.TimePeriod}.
- * @param blacklistDomains A list of registerable domains that we don't clear data for.
- * @param blacklistedDomainReasons A list of the reason metadata for the blacklisted domains.
- * @param ignoredDomains A list of ignored domains that the user chose to not blacklist. We use
- * these to remove important site entries if the user ignores them enough.
- * @param ignoredDomainReasons A list of reason metadata for the ignored domains.
- */
- public void clearBrowsingDataExcludingDomains(OnClearBrowsingDataListener listener,
- int[] dataTypes, int timePeriod, String[] blacklistDomains,
- int[] blacklistedDomainReasons, String[] ignoredDomains, int[] ignoredDomainReasons) {
- assert mClearBrowsingDataListener == null;
- mClearBrowsingDataListener = listener;
- nativeClearBrowsingData(dataTypes, timePeriod, blacklistDomains, blacklistedDomainReasons,
- ignoredDomains, ignoredDomainReasons);
- }
/**
* @return The index of the tab last visited by the user in the CBD dialog.
@@ -787,51 +697,6 @@ public final class PrefServiceBridge {
return nativeCanDeleteBrowsingHistory();
}
- @CalledByNative
- private void browsingDataCleared() {
- if (mClearBrowsingDataListener != null) {
- mClearBrowsingDataListener.onBrowsingDataCleared();
- mClearBrowsingDataListener = null;
- }
- }
-
- /**
- * This fetches sites (registerable domains) that we consider important. This combines many
- * pieces of information, including site engagement and permissions. The callback is called
- * with the list of important registerable domains.
- *
- * See net/base/registry_controlled_domains/registry_controlled_domain.h for more details on
- * registrable domains and the current list of effective eTLDs.
- * @param callback The callback that will be used to set the list of important sites.
- */
- public static void fetchImportantSites(ImportantSitesCallback callback) {
- nativeFetchImportantSites(callback);
- }
-
- /**
- * @return The maximum number of important sites that will be returned from the call above.
- * This is a constant that won't change.
- */
- public static int getMaxImportantSites() {
- return nativeGetMaxImportantSites();
- }
-
- /** This lets us mark an origin as important for testing. */
- @VisibleForTesting
- public static void markOriginAsImportantForTesting(String origin) {
- nativeMarkOriginAsImportantForTesting(origin);
- }
-
- /**
- * Requests that the web history service finds out if we should inform the user about the
- * existence of other forms of browsing history. The response will be asynchronous, through
- * {@link OtherFormsOfBrowsingHistoryListener}.
- */
- public void requestInfoAboutOtherFormsOfBrowsingHistory(
- OtherFormsOfBrowsingHistoryListener listener) {
- nativeRequestInfoAboutOtherFormsOfBrowsingHistory(listener);
- }
-
public void setAllowCookiesEnabled(boolean allow) {
nativeSetAllowCookiesEnabled(allow);
}
@@ -1145,18 +1010,10 @@ public final class PrefServiceBridge {
private native int nativeGetBrowsingDataDeletionTimePeriod(int clearBrowsingDataTab);
private native void nativeSetBrowsingDataDeletionTimePeriod(
int clearBrowsingDataTab, int timePeriod);
- private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod,
- String[] blacklistDomains, int[] blacklistedDomainReasons, String[] ignoredDomains,
- int[] ignoredDomainReasons);
private native int nativeGetLastClearBrowsingDataTab();
private native void nativeSetLastClearBrowsingDataTab(int lastTab);
private native void nativeMigrateBrowsingDataPreferences();
- private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory(
- OtherFormsOfBrowsingHistoryListener listener);
private native boolean nativeCanDeleteBrowsingHistory();
- private static native void nativeFetchImportantSites(ImportantSitesCallback callback);
- private static native int nativeGetMaxImportantSites();
- private static native void nativeMarkOriginAsImportantForTesting(String origin);
private native void nativeSetAutoplayEnabled(boolean allow);
private native void nativeSetAllowCookiesEnabled(boolean allow);
private native void nativeSetBackgroundSyncEnabled(boolean allow);

Powered by Google App Engine
This is Rietveld 408576698