| 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 | |
| 400 namespace { | 383 namespace { |
| 401 | 384 |
| 402 // Redirects a BrowsingDataRemover completion callback back into Java. | 385 // Redirects a BrowsingDataRemover completion callback back into Java. |
| 403 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { | 386 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { |
| 404 public: | 387 public: |
| 405 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a | 388 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a |
| 406 // ChromePreference. | 389 // ChromePreference. |
| 407 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) | 390 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) |
| 408 : weak_chrome_native_preferences_(env, obj) { | 391 : weak_chrome_native_preferences_(env, obj) { |
| 409 } | 392 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 jobject obj) { | 825 jobject obj) { |
| 843 return ConvertUTF8ToJavaString( | 826 return ConvertUTF8ToJavaString( |
| 844 env, | 827 env, |
| 845 GetPrefService()->GetString( | 828 GetPrefService()->GetString( |
| 846 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 829 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
| 847 } | 830 } |
| 848 | 831 |
| 849 bool RegisterPrefServiceBridge(JNIEnv* env) { | 832 bool RegisterPrefServiceBridge(JNIEnv* env) { |
| 850 return RegisterNativesImpl(env); | 833 return RegisterNativesImpl(env); |
| 851 } | 834 } |
| OLD | NEW |