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

Unified Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 1870703002: Connect the "other forms of browsing history" frontend on Android to backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-dialog-rebased
Patch Set: Addressed comments. 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
Index: chrome/browser/android/preferences/pref_service_bridge.cc
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc
index 6b1fe8066726b64f36f91229301fffd1e4437d83..65eff4b91db7f4b087e349cb6f8a67b108c73cdf 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -26,13 +26,16 @@
#include "chrome/browser/browsing_data/browsing_data_remover.h"
#include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/android/android_about_app_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/locale_settings.h"
+#include "components/browsing_data_ui/history_notice_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
@@ -607,6 +610,45 @@ static jboolean CanDeleteBrowsingHistory(JNIEnv* env,
return GetPrefService()->GetBoolean(prefs::kAllowDeletingBrowserHistory);
}
+static void ShowNoticeAboutOtherFormsOfBrowsingHistory(
+ ScopedJavaGlobalRef<jobject>* listener,
+ bool show) {
+ JNIEnv* env = AttachCurrentThread();
+ if (!show)
+ return;
+ Java_OtherFormsOfBrowsingHistoryListener_showNoticeAboutOtherFormsOfBrowsingHistory(
+ env, listener->obj());
+}
+
+static void EnableDialogAboutOtherFormsOfBrowsingHistory(
+ ScopedJavaGlobalRef<jobject>* listener,
+ bool enabled) {
+ JNIEnv* env = AttachCurrentThread();
+ if (!enabled)
+ return;
+ Java_OtherFormsOfBrowsingHistoryListener_enableDialogAboutOtherFormsOfBrowsingHistory(
gone 2016/04/08 17:44:58 <random comment about how hilariously long JNI cal
msramek 2016/04/08 18:31:30 Yes, I have first searched for "file:.cc Java_.{74
+ env, listener->obj());
+}
+
+static void RequestInfoAboutOtherFormsOfBrowsingHistory(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ const JavaParamRef<jobject>& listener) {
+ // The permanent notice in the footer.
+ browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
+ ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()),
+ WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
+ base::Bind(&ShowNoticeAboutOtherFormsOfBrowsingHistory,
+ base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener))));
+
+ // The one-time notice in the dialog.
+ browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory(
+ ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()),
+ WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
+ base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory,
+ base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener))));
+}
+
static void SetAllowCookiesEnabled(JNIEnv* env,
const JavaParamRef<jobject>& obj,
jboolean allow) {

Powered by Google App Engine
This is Rietveld 408576698