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

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: rebase 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..d9b624837961ccd7136b0e2fb0e14d3884594a0b 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
@@ -41,6 +41,8 @@ public final class PrefServiceBridge {
// Object to notify when "clear browsing data" completes.
private OnClearBrowsingDataListener mClearBrowsingDataListener;
+ // Object to notify when we finished fetching important sites.
+ private ImportantSitesCallback mImportantSitesCallback;
private static final String LOG_TAG = "PrefServiceBridge";
// Constants related to the Contextual Search preference.
@@ -80,6 +82,19 @@ public final class PrefServiceBridge {
}
/**
+ * Interface for a class that is fetching important site information.
+ */
+ public interface ImportantSitesCallback {
+ /**
+ * Called by native code to populate the set of important registerable domains.
Theresa 2016/04/21 16:05:28 Technically this isn't called by native code (it's
dmurph 2016/04/21 18:53:25 Done.
+ * 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.
+ */
+ public abstract void setImportantRegisterableDomains(String[] domains);
+ }
+
+ /**
* Interface to a class that receives callbacks instructing it to inform the user about other
* forms of browsing history.
*/
@@ -730,9 +745,20 @@ 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.
+ */
+ public void clearBrowsingDataExcludingDomains(OnClearBrowsingDataListener listener,
Theresa 2016/04/21 16:05:28 add JavaDocs for the params (or at least the extra
dmurph 2016/04/21 18:53:25 Done.
dmurph 2016/04/21 18:53:25 Done.
+ int[] dataTypes, int timePeriod, String[] origins) {
assert mClearBrowsingDataListener == null;
mClearBrowsingDataListener = listener;
- nativeClearBrowsingData(dataTypes, timePeriod);
+ nativeClearBrowsingData(dataTypes, timePeriod, origins);
}
/*
@@ -751,6 +777,29 @@ 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.
Theresa 2016/04/21 16:05:28 nit: capitalize The
dmurph 2016/04/21 18:53:25 Done.
+ */
+ public void fetchImportantSites(ImportantSitesCallback callback) {
+ assert mImportantSitesCallback == null;
+ mImportantSitesCallback = callback;
+ nativeFetchImportantSites();
+ }
+
+ @CalledByNative
+ private void importantSitesFetched(String[] domains) {
+ if (mImportantSitesCallback != null) {
+ mImportantSitesCallback.setImportantRegisterableDomains(domains);
+ mImportantSitesCallback = null;
+ }
+ }
+
+ /**
* 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 +1099,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 native void nativeFetchImportantSites();
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