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

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

Issue 1757163002: [ImportantSites] JNI bindings for CBD filtering and Important Sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/android/preferences/important_sites_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25953f931889d2c80aead61edeec3b117f2d01d1..faff43e8edccc80c3b32112da20a97ade07c4d57 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
@@ -80,6 +80,20 @@ public final class PrefServiceBridge {
}
/**
+ * 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.
+ */
+ @CalledByNative("ImportantSitesCallback")
+ void onImportantRegisterableDomainsReady(String[] domains);
+ }
+
+ /**
* Interface to a class that receives callbacks instructing it to inform the user about other
* forms of browsing history.
*/
@@ -730,9 +744,26 @@ public final class PrefServiceBridge {
*/
public void clearBrowsingData(
OnClearBrowsingDataListener listener, int[] dataTypes, int timePeriod) {
+ clearBrowsingDataExcludingDomains(listener, dataTypes, timePeriod, new String[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.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.TimePeriod}.
+ * @param blacklistDomains A list of registerable domains that we don't clear data for.
+ */
+ public void clearBrowsingDataExcludingDomains(OnClearBrowsingDataListener listener,
+ int[] dataTypes, int timePeriod, String[] blacklistDomains) {
assert mClearBrowsingDataListener == null;
mClearBrowsingDataListener = listener;
- nativeClearBrowsingData(dataTypes, timePeriod);
+ nativeClearBrowsingData(dataTypes, timePeriod, blacklistDomains);
}
/*
@@ -751,6 +782,19 @@ public final class PrefServiceBridge {
}
/**
+ * 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);
+ }
+
+ /**
* 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}.
@@ -1050,10 +1094,12 @@ public final class PrefServiceBridge {
private native void nativeSetBrowsingDataDeletionPreference(int dataType, boolean value);
private native int nativeGetBrowsingDataDeletionTimePeriod();
private native void nativeSetBrowsingDataDeletionTimePeriod(int timePeriod);
- private native void nativeClearBrowsingData(int[] dataTypes, int timePeriod);
+ private native void nativeClearBrowsingData(
+ int[] dataTypes, int timePeriod, String[] blacklistDomains);
private native void nativeRequestInfoAboutOtherFormsOfBrowsingHistory(
OtherFormsOfBrowsingHistoryListener listener);
private native boolean nativeCanDeleteBrowsingHistory();
+ private static native void nativeFetchImportantSites(ImportantSitesCallback callback);
private native void nativeSetAllowCookiesEnabled(boolean allow);
private native void nativeSetBackgroundSyncEnabled(boolean allow);
private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled);
« no previous file with comments | « no previous file | chrome/browser/android/preferences/important_sites_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698