| 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 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 incognito_pref == IncognitoModePrefs::DISABLED) << | 288 incognito_pref == IncognitoModePrefs::DISABLED) << |
| 289 "Unsupported incognito mode preference: " << incognito_pref; | 289 "Unsupported incognito mode preference: " << incognito_pref; |
| 290 return incognito_pref != IncognitoModePrefs::DISABLED; | 290 return incognito_pref != IncognitoModePrefs::DISABLED; |
| 291 } | 291 } |
| 292 | 292 |
| 293 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { | 293 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { |
| 294 return GetPrefService()->IsManagedPreference( | 294 return GetPrefService()->IsManagedPreference( |
| 295 prefs::kIncognitoModeAvailability); | 295 prefs::kIncognitoModeAvailability); |
| 296 } | 296 } |
| 297 | 297 |
| 298 static jboolean GetMetricsReportingEnabled(JNIEnv* env, jobject obj) { |
| 299 PrefService* local_state = g_browser_process->local_state(); |
| 300 return local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
| 301 } |
| 302 |
| 303 static void SetMetricsReportingEnabled(JNIEnv* env, |
| 304 jobject obj, |
| 305 jboolean enabled) { |
| 306 PrefService* local_state = g_browser_process->local_state(); |
| 307 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled); |
| 308 } |
| 309 |
| 310 static jboolean HasSetMetricsReporting(JNIEnv* env, jobject obj) { |
| 311 PrefService* local_state = g_browser_process->local_state(); |
| 312 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled); |
| 313 } |
| 314 |
| 298 namespace { | 315 namespace { |
| 299 | 316 |
| 300 // Redirects a BrowsingDataRemover completion callback back into Java. | 317 // Redirects a BrowsingDataRemover completion callback back into Java. |
| 301 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { | 318 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { |
| 302 public: | 319 public: |
| 303 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a | 320 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a |
| 304 // ChromePreference. | 321 // ChromePreference. |
| 305 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) | 322 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) |
| 306 : weak_chrome_native_preferences_(env, obj) { | 323 : weak_chrome_native_preferences_(env, obj) { |
| 307 } | 324 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 jobject obj) { | 767 jobject obj) { |
| 751 return ConvertUTF8ToJavaString( | 768 return ConvertUTF8ToJavaString( |
| 752 env, | 769 env, |
| 753 GetPrefService()->GetString( | 770 GetPrefService()->GetString( |
| 754 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 771 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
| 755 } | 772 } |
| 756 | 773 |
| 757 bool RegisterPrefServiceBridge(JNIEnv* env) { | 774 bool RegisterPrefServiceBridge(JNIEnv* env) { |
| 758 return RegisterNativesImpl(env); | 775 return RegisterNativesImpl(env); |
| 759 } | 776 } |
| OLD | NEW |