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

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: 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 f7bf301aa826b245cc3c057026efad4509a7e044..8484588d346943e027068896a0aca3e011f3ac96 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -25,13 +25,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,46 @@ static jboolean CanDeleteBrowsingHistory(JNIEnv* env,
return GetPrefService()->GetBoolean(prefs::kAllowDeletingBrowserHistory);
}
+static void showNoticeAboutOtherFormsOfBrowsingHistory(
gone 2016/04/07 22:27:55 nit: You're in C++ land: ShowNoticeAboutOtherForm
msramek 2016/04/08 16:03:18 Done.
+ JavaObjectWeakGlobalRef* weak_chrome_native_preferences,
+ bool show) {
+ JNIEnv* env = AttachCurrentThread();
+ if (weak_chrome_native_preferences->get(env).is_null())
+ return;
+
+ Java_PrefServiceBridge_showNoticeAboutOtherFormsOfBrowsingHistory(
+ env, weak_chrome_native_preferences->get(env).obj(), show);
+}
+
+static void enableDialogAboutOtherFormsOfBrowsingHistory(
+ JavaObjectWeakGlobalRef* weak_chrome_native_preferences,
+ bool enabled) {
+ JNIEnv* env = AttachCurrentThread();
+ if (weak_chrome_native_preferences->get(env).is_null())
+ return;
+
+ Java_PrefServiceBridge_enableDialogAboutOtherFormsOfBrowsingHistory(
+ env, weak_chrome_native_preferences->get(env).obj(), enabled);
+}
+
+static void RequestInfoAboutOtherFormsOfBrowsingHistory(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& obj) {
+ // The permanent notice in the footer.
+ browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
+ ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()),
+ WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
+ base::Bind(&showNoticeAboutOtherFormsOfBrowsingHistory,
+ base::Owned(new JavaObjectWeakGlobalRef(env, obj))));
+
+ // The one-time notice in the dialog.
+ browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory(
+ ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()),
+ WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()),
+ base::Bind(&enableDialogAboutOtherFormsOfBrowsingHistory,
+ base::Owned(new JavaObjectWeakGlobalRef(env, obj))));
+}
+
static void SetAllowCookiesEnabled(JNIEnv* env,
const JavaParamRef<jobject>& obj,
jboolean allow) {

Powered by Google App Engine
This is Rietveld 408576698