| 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> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "components/browsing_data/core/browsing_data_utils.h" | 48 #include "components/browsing_data/core/browsing_data_utils.h" |
| 49 #include "components/browsing_data/core/history_notice_utils.h" | 49 #include "components/browsing_data/core/history_notice_utils.h" |
| 50 #include "components/browsing_data/core/pref_names.h" | 50 #include "components/browsing_data/core/pref_names.h" |
| 51 #include "components/content_settings/core/browser/host_content_settings_map.h" | 51 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 52 #include "components/content_settings/core/common/content_settings.h" | 52 #include "components/content_settings/core/common/content_settings.h" |
| 53 #include "components/content_settings/core/common/content_settings_pattern.h" | 53 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 54 #include "components/content_settings/core/common/pref_names.h" | 54 #include "components/content_settings/core/common/pref_names.h" |
| 55 #include "components/metrics/metrics_pref_names.h" | 55 #include "components/metrics/metrics_pref_names.h" |
| 56 #include "components/password_manager/core/common/password_manager_pref_names.h" | 56 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 57 #include "components/prefs/pref_service.h" | 57 #include "components/prefs/pref_service.h" |
| 58 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 58 #include "components/signin/core/common/signin_pref_names.h" | 59 #include "components/signin/core/common/signin_pref_names.h" |
| 59 #include "components/strings/grit/components_locale_settings.h" | 60 #include "components/strings/grit/components_locale_settings.h" |
| 60 #include "components/translate/core/browser/translate_prefs.h" | 61 #include "components/translate/core/browser/translate_prefs.h" |
| 61 #include "components/translate/core/common/translate_pref_names.h" | 62 #include "components/translate/core/common/translate_pref_names.h" |
| 62 #include "components/version_info/version_info.h" | 63 #include "components/version_info/version_info.h" |
| 63 #include "components/web_resource/web_resource_pref_names.h" | 64 #include "components/web_resource/web_resource_pref_names.h" |
| 64 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
| 65 #include "jni/PrefServiceBridge_jni.h" | 66 #include "jni/PrefServiceBridge_jni.h" |
| 66 #include "ui/base/l10n/l10n_util.h" | 67 #include "ui/base/l10n/l10n_util.h" |
| 67 | 68 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 309 } |
| 309 | 310 |
| 310 static jboolean GetSearchSuggestManaged(JNIEnv* env, | 311 static jboolean GetSearchSuggestManaged(JNIEnv* env, |
| 311 const JavaParamRef<jobject>& obj) { | 312 const JavaParamRef<jobject>& obj) { |
| 312 return GetPrefService()->IsManagedPreference(prefs::kSearchSuggestEnabled); | 313 return GetPrefService()->IsManagedPreference(prefs::kSearchSuggestEnabled); |
| 313 } | 314 } |
| 314 | 315 |
| 315 static jboolean GetSafeBrowsingExtendedReportingEnabled( | 316 static jboolean GetSafeBrowsingExtendedReportingEnabled( |
| 316 JNIEnv* env, | 317 JNIEnv* env, |
| 317 const JavaParamRef<jobject>& obj) { | 318 const JavaParamRef<jobject>& obj) { |
| 318 return GetPrefService()->GetBoolean( | 319 return safe_browsing::IsExtendedReportingEnabled(*GetPrefService()); |
| 319 prefs::kSafeBrowsingExtendedReportingEnabled); | |
| 320 } | 320 } |
| 321 | 321 |
| 322 static void SetSafeBrowsingExtendedReportingEnabled( | 322 static void SetSafeBrowsingExtendedReportingEnabled( |
| 323 JNIEnv* env, | 323 JNIEnv* env, |
| 324 const JavaParamRef<jobject>& obj, | 324 const JavaParamRef<jobject>& obj, |
| 325 jboolean enabled) { | 325 jboolean enabled) { |
| 326 GetPrefService()->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, | 326 GetPrefService()->SetBoolean(safe_browsing::GetExtendedReportingPrefName(), |
| 327 enabled); | 327 enabled); |
| 328 } | 328 } |
| 329 | 329 |
| 330 static jboolean GetSafeBrowsingExtendedReportingManaged( | 330 static jboolean GetSafeBrowsingExtendedReportingManaged( |
| 331 JNIEnv* env, | 331 JNIEnv* env, |
| 332 const JavaParamRef<jobject>& obj) { | 332 const JavaParamRef<jobject>& obj) { |
| 333 return GetPrefService()->IsManagedPreference( | 333 return GetPrefService()->IsManagedPreference( |
| 334 prefs::kSafeBrowsingExtendedReportingEnabled); | 334 safe_browsing::GetExtendedReportingPrefName()); |
| 335 } | 335 } |
| 336 | 336 |
| 337 static jboolean GetSafeBrowsingEnabled(JNIEnv* env, | 337 static jboolean GetSafeBrowsingEnabled(JNIEnv* env, |
| 338 const JavaParamRef<jobject>& obj) { | 338 const JavaParamRef<jobject>& obj) { |
| 339 return GetPrefService()->GetBoolean(prefs::kSafeBrowsingEnabled); | 339 return GetPrefService()->GetBoolean(prefs::kSafeBrowsingEnabled); |
| 340 } | 340 } |
| 341 | 341 |
| 342 static void SetSafeBrowsingEnabled(JNIEnv* env, | 342 static void SetSafeBrowsingEnabled(JNIEnv* env, |
| 343 const JavaParamRef<jobject>& obj, | 343 const JavaParamRef<jobject>& obj, |
| 344 jboolean enabled) { | 344 jboolean enabled) { |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 | 1220 |
| 1221 return ConvertJavaStringToUTF8(android_permission); | 1221 return ConvertJavaStringToUTF8(android_permission); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 static void SetSupervisedUserId(JNIEnv* env, | 1224 static void SetSupervisedUserId(JNIEnv* env, |
| 1225 const JavaParamRef<jobject>& obj, | 1225 const JavaParamRef<jobject>& obj, |
| 1226 const JavaParamRef<jstring>& pref) { | 1226 const JavaParamRef<jstring>& pref) { |
| 1227 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1227 GetPrefService()->SetString(prefs::kSupervisedUserId, |
| 1228 ConvertJavaStringToUTF8(env, pref)); | 1228 ConvertJavaStringToUTF8(env, pref)); |
| 1229 } | 1229 } |
| OLD | NEW |