| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/preferences/pref_service_bridge.h" | 5 #include "chrome/browser/android/preferences/pref_service_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/android/build_info.h" | 13 #include "base/android/build_info.h" |
| 14 #include "base/android/jni_android.h" | 14 #include "base/android/jni_android.h" |
| 15 #include "base/android/jni_array.h" | 15 #include "base/android/jni_array.h" |
| 16 #include "base/android/jni_string.h" | 16 #include "base/android/jni_string.h" |
| 17 #include "base/android/jni_weak_ref.h" | 17 #include "base/android/jni_weak_ref.h" |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| 20 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/scoped_observer.h" | 21 #include "base/scoped_observer.h" |
| 21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 22 #include "base/values.h" | 23 #include "base/values.h" |
| 23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | 25 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
| 25 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 26 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 26 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 27 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 27 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 28 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 29 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 29 #include "chrome/browser/history/web_history_service_factory.h" | 30 #include "chrome/browser/history/web_history_service_factory.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 608 |
| 608 static jboolean CanDeleteBrowsingHistory(JNIEnv* env, | 609 static jboolean CanDeleteBrowsingHistory(JNIEnv* env, |
| 609 const JavaParamRef<jobject>& obj) { | 610 const JavaParamRef<jobject>& obj) { |
| 610 return GetPrefService()->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 611 return GetPrefService()->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
| 611 } | 612 } |
| 612 | 613 |
| 613 static void ShowNoticeAboutOtherFormsOfBrowsingHistory( | 614 static void ShowNoticeAboutOtherFormsOfBrowsingHistory( |
| 614 ScopedJavaGlobalRef<jobject>* listener, | 615 ScopedJavaGlobalRef<jobject>* listener, |
| 615 bool show) { | 616 bool show) { |
| 616 JNIEnv* env = AttachCurrentThread(); | 617 JNIEnv* env = AttachCurrentThread(); |
| 618 UMA_HISTOGRAM_BOOLEAN( |
| 619 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", show); |
| 617 if (!show) | 620 if (!show) |
| 618 return; | 621 return; |
| 619 Java_OtherFormsOfBrowsingHistoryListener_showNoticeAboutOtherFormsOfBrowsingHi
story( | 622 Java_OtherFormsOfBrowsingHistoryListener_showNoticeAboutOtherFormsOfBrowsingHi
story( |
| 620 env, listener->obj()); | 623 env, listener->obj()); |
| 621 } | 624 } |
| 622 | 625 |
| 623 static void EnableDialogAboutOtherFormsOfBrowsingHistory( | 626 static void EnableDialogAboutOtherFormsOfBrowsingHistory( |
| 624 ScopedJavaGlobalRef<jobject>* listener, | 627 ScopedJavaGlobalRef<jobject>* listener, |
| 625 bool enabled) { | 628 bool enabled) { |
| 626 JNIEnv* env = AttachCurrentThread(); | 629 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 | 1068 |
| 1066 return ConvertJavaStringToUTF8(android_permission); | 1069 return ConvertJavaStringToUTF8(android_permission); |
| 1067 } | 1070 } |
| 1068 | 1071 |
| 1069 static void SetSupervisedUserId(JNIEnv* env, | 1072 static void SetSupervisedUserId(JNIEnv* env, |
| 1070 const JavaParamRef<jobject>& obj, | 1073 const JavaParamRef<jobject>& obj, |
| 1071 const JavaParamRef<jstring>& pref) { | 1074 const JavaParamRef<jstring>& pref) { |
| 1072 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1075 GetPrefService()->SetString(prefs::kSupervisedUserId, |
| 1073 ConvertJavaStringToUTF8(env, pref)); | 1076 ConvertJavaStringToUTF8(env, pref)); |
| 1074 } | 1077 } |
| OLD | NEW |