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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 incognito_pref == IncognitoModePrefs::DISABLED) << | 298 incognito_pref == IncognitoModePrefs::DISABLED) << |
299 "Unsupported incognito mode preference: " << incognito_pref; | 299 "Unsupported incognito mode preference: " << incognito_pref; |
300 return incognito_pref != IncognitoModePrefs::DISABLED; | 300 return incognito_pref != IncognitoModePrefs::DISABLED; |
301 } | 301 } |
302 | 302 |
303 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { | 303 static jboolean GetIncognitoModeManaged(JNIEnv* env, jobject obj) { |
304 return GetPrefService()->IsManagedPreference( | 304 return GetPrefService()->IsManagedPreference( |
305 prefs::kIncognitoModeAvailability); | 305 prefs::kIncognitoModeAvailability); |
306 } | 306 } |
307 | 307 |
308 static jboolean GetMetricsReportingEnabled(JNIEnv* env, jobject obj) { | |
309 PrefService* local_state = g_browser_process->local_state(); | |
310 return local_state->GetBoolean(prefs::kMetricsReportingEnabled); | |
311 } | |
312 | |
313 static void SetMetricsReportingEnabled(JNIEnv* env, | |
314 jobject obj, | |
315 jboolean enabled) { | |
316 PrefService* local_state = g_browser_process->local_state(); | |
317 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled); | |
318 } | |
319 | |
320 static jboolean HasSetMetricsReporting(JNIEnv* env, jobject obj) { | |
321 PrefService* local_state = g_browser_process->local_state(); | |
322 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled); | |
323 } | |
324 | |
325 static jboolean GetFullscreenManaged(JNIEnv* env, jobject obj) { | 308 static jboolean GetFullscreenManaged(JNIEnv* env, jobject obj) { |
326 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN); | 309 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN); |
327 } | 310 } |
328 | 311 |
329 static jboolean GetFullscreenAllowed(JNIEnv* env, jobject obj) { | 312 static jboolean GetFullscreenAllowed(JNIEnv* env, jobject obj) { |
330 HostContentSettingsMap* content_settings = | 313 HostContentSettingsMap* content_settings = |
331 GetOriginalProfile()->GetHostContentSettingsMap(); | 314 GetOriginalProfile()->GetHostContentSettingsMap(); |
332 return content_settings->GetDefaultContentSetting( | 315 return content_settings->GetDefaultContentSetting( |
333 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW; | 316 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW; |
334 } | 317 } |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 jobject obj) { | 796 jobject obj) { |
814 return ConvertUTF8ToJavaString( | 797 return ConvertUTF8ToJavaString( |
815 env, | 798 env, |
816 GetPrefService()->GetString( | 799 GetPrefService()->GetString( |
817 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 800 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
818 } | 801 } |
819 | 802 |
820 bool RegisterPrefServiceBridge(JNIEnv* env) { | 803 bool RegisterPrefServiceBridge(JNIEnv* env) { |
821 return RegisterNativesImpl(env); | 804 return RegisterNativesImpl(env); |
822 } | 805 } |
OLD | NEW |