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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN); | 373 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN); |
374 } | 374 } |
375 | 375 |
376 static jboolean GetFullscreenAllowed(JNIEnv* env, jobject obj) { | 376 static jboolean GetFullscreenAllowed(JNIEnv* env, jobject obj) { |
377 HostContentSettingsMap* content_settings = | 377 HostContentSettingsMap* content_settings = |
378 GetOriginalProfile()->GetHostContentSettingsMap(); | 378 GetOriginalProfile()->GetHostContentSettingsMap(); |
379 return content_settings->GetDefaultContentSetting( | 379 return content_settings->GetDefaultContentSetting( |
380 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW; | 380 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW; |
381 } | 381 } |
382 | 382 |
| 383 static jboolean GetMetricsReportingEnabled(JNIEnv* env, jobject obj) { |
| 384 PrefService* local_state = g_browser_process->local_state(); |
| 385 return local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
| 386 } |
| 387 |
| 388 static void SetMetricsReportingEnabled(JNIEnv* env, |
| 389 jobject obj, |
| 390 jboolean enabled) { |
| 391 PrefService* local_state = g_browser_process->local_state(); |
| 392 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled); |
| 393 } |
| 394 |
| 395 static jboolean HasSetMetricsReporting(JNIEnv* env, jobject obj) { |
| 396 PrefService* local_state = g_browser_process->local_state(); |
| 397 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled); |
| 398 } |
| 399 |
383 namespace { | 400 namespace { |
384 | 401 |
385 // Redirects a BrowsingDataRemover completion callback back into Java. | 402 // Redirects a BrowsingDataRemover completion callback back into Java. |
386 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { | 403 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { |
387 public: | 404 public: |
388 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a | 405 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a |
389 // ChromePreference. | 406 // ChromePreference. |
390 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) | 407 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) |
391 : weak_chrome_native_preferences_(env, obj) { | 408 : weak_chrome_native_preferences_(env, obj) { |
392 } | 409 } |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 jobject obj) { | 842 jobject obj) { |
826 return ConvertUTF8ToJavaString( | 843 return ConvertUTF8ToJavaString( |
827 env, | 844 env, |
828 GetPrefService()->GetString( | 845 GetPrefService()->GetString( |
829 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 846 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
830 } | 847 } |
831 | 848 |
832 bool RegisterPrefServiceBridge(JNIEnv* env) { | 849 bool RegisterPrefServiceBridge(JNIEnv* env) { |
833 return RegisterNativesImpl(env); | 850 return RegisterNativesImpl(env); |
834 } | 851 } |
OLD | NEW |