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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 incognito_pref == IncognitoModePrefs::DISABLED) << | 266 incognito_pref == IncognitoModePrefs::DISABLED) << |
267 "Unsupported incognito mode preference: " << incognito_pref; | 267 "Unsupported incognito mode preference: " << incognito_pref; |
268 return incognito_pref != IncognitoModePrefs::DISABLED; | 268 return incognito_pref != IncognitoModePrefs::DISABLED; |
269 } | 269 } |
270 | 270 |
271 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { | 271 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { |
272 return GetPrefService()->IsManagedPreference( | 272 return GetPrefService()->IsManagedPreference( |
273 prefs::kIncognitoModeAvailability); | 273 prefs::kIncognitoModeAvailability); |
274 } | 274 } |
275 | 275 |
276 static jboolean GetMetricsReportingEnabled(JNIEnv* env, jobject obj) { | |
277 PrefService* local_state = g_browser_process->local_state(); | |
278 return local_state->GetBoolean(prefs::kMetricsReportingEnabled); | |
279 } | |
280 | |
281 static void SetMetricsReportingEnabled(JNIEnv* env, | |
282 jobject obj, | |
283 jboolean enabled) { | |
284 PrefService* local_state = g_browser_process->local_state(); | |
285 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled); | |
286 } | |
287 | |
288 static jboolean IsSetMetricsReporting(JNIEnv* env, jobject obj) { | |
289 PrefService* local_state = g_browser_process->local_state(); | |
290 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled); | |
gone
2015/03/09 19:53:29
the function name is more confusing when I look at
gayane -on leave until 09-2017
2015/03/09 23:07:26
changed to hasSetMetricsReporting.
| |
291 } | |
292 | |
276 namespace { | 293 namespace { |
277 | 294 |
278 // Redirects a BrowsingDataRemover completion callback back into Java. | 295 // Redirects a BrowsingDataRemover completion callback back into Java. |
279 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { | 296 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { |
280 public: | 297 public: |
281 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a | 298 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a |
282 // ChromePreference. | 299 // ChromePreference. |
283 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) | 300 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) |
284 : weak_chrome_native_preferences_(env, obj) { | 301 : weak_chrome_native_preferences_(env, obj) { |
285 } | 302 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 jobject obj) { | 743 jobject obj) { |
727 return ConvertUTF8ToJavaString( | 744 return ConvertUTF8ToJavaString( |
728 env, | 745 env, |
729 GetPrefService()->GetString( | 746 GetPrefService()->GetString( |
730 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 747 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
731 } | 748 } |
732 | 749 |
733 bool RegisterPrefServiceBridge(JNIEnv* env) { | 750 bool RegisterPrefServiceBridge(JNIEnv* env) { |
734 return RegisterNativesImpl(env); | 751 return RegisterNativesImpl(env); |
735 } | 752 } |
OLD | NEW |