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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 static void SetAllowLocationEnabled(JNIEnv* env, | 481 static void SetAllowLocationEnabled(JNIEnv* env, |
482 jobject obj, | 482 jobject obj, |
483 jboolean is_enabled) { | 483 jboolean is_enabled) { |
484 HostContentSettingsMap* host_content_settings_map = | 484 HostContentSettingsMap* host_content_settings_map = |
485 GetOriginalProfile()->GetHostContentSettingsMap(); | 485 GetOriginalProfile()->GetHostContentSettingsMap(); |
486 host_content_settings_map->SetDefaultContentSetting( | 486 host_content_settings_map->SetDefaultContentSetting( |
487 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 487 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
488 is_enabled ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); | 488 is_enabled ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
489 } | 489 } |
490 | 490 |
491 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { | 491 static void SetCameraEnabled(JNIEnv* env, jobject obj, jboolean allow) { |
| 492 HostContentSettingsMap* host_content_settings_map = |
| 493 GetOriginalProfile()->GetHostContentSettingsMap(); |
| 494 host_content_settings_map->SetDefaultContentSetting( |
| 495 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
| 496 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
| 497 } |
| 498 |
| 499 static void SetMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { |
492 HostContentSettingsMap* host_content_settings_map = | 500 HostContentSettingsMap* host_content_settings_map = |
493 GetOriginalProfile()->GetHostContentSettingsMap(); | 501 GetOriginalProfile()->GetHostContentSettingsMap(); |
494 host_content_settings_map->SetDefaultContentSetting( | 502 host_content_settings_map->SetDefaultContentSetting( |
495 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 503 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
496 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); | 504 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
497 host_content_settings_map->SetDefaultContentSetting( | |
498 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | |
499 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); | |
500 } | 505 } |
501 | 506 |
502 static void SetFullscreenAllowed(JNIEnv* env, jobject obj, jboolean allow) { | 507 static void SetFullscreenAllowed(JNIEnv* env, jobject obj, jboolean allow) { |
503 HostContentSettingsMap* host_content_settings_map = | 508 HostContentSettingsMap* host_content_settings_map = |
504 GetOriginalProfile()->GetHostContentSettingsMap(); | 509 GetOriginalProfile()->GetHostContentSettingsMap(); |
505 host_content_settings_map->SetDefaultContentSetting( | 510 host_content_settings_map->SetDefaultContentSetting( |
506 CONTENT_SETTINGS_TYPE_FULLSCREEN, | 511 CONTENT_SETTINGS_TYPE_FULLSCREEN, |
507 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK); | 512 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK); |
508 } | 513 } |
509 | 514 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 GetPrefService()->ClearPref(prefs::kProtectedMediaIdentifierEnabled); | 596 GetPrefService()->ClearPref(prefs::kProtectedMediaIdentifierEnabled); |
592 } | 597 } |
593 | 598 |
594 static void SetPasswordEchoEnabled(JNIEnv* env, | 599 static void SetPasswordEchoEnabled(JNIEnv* env, |
595 jobject obj, | 600 jobject obj, |
596 jboolean passwordEchoEnabled) { | 601 jboolean passwordEchoEnabled) { |
597 GetPrefService()->SetBoolean(prefs::kWebKitPasswordEchoEnabled, | 602 GetPrefService()->SetBoolean(prefs::kWebKitPasswordEchoEnabled, |
598 passwordEchoEnabled); | 603 passwordEchoEnabled); |
599 } | 604 } |
600 | 605 |
601 | 606 static jboolean GetCameraEnabled(JNIEnv* env, jobject obj) { |
602 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) { | 607 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
603 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && | |
604 GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | |
605 } | 608 } |
606 | 609 |
607 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) { | 610 static jboolean GetCameraUserModifiable(JNIEnv* env, jobject obj) { |
608 return IsContentSettingUserModifiable( | 611 return IsContentSettingUserModifiable( |
609 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && | |
610 IsContentSettingUserModifiable( | |
611 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 612 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
612 } | 613 } |
613 | 614 |
614 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) { | 615 static jboolean GetCameraManagedByCustodian(JNIEnv* env, jobject obj) { |
615 return IsContentSettingManagedByCustodian( | 616 return IsContentSettingManagedByCustodian( |
616 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && | |
617 IsContentSettingManagedByCustodian( | |
618 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 617 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
619 } | 618 } |
620 | 619 |
| 620 static jboolean GetMicEnabled(JNIEnv* env, jobject obj) { |
| 621 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 622 } |
| 623 |
| 624 static jboolean GetMicUserModifiable(JNIEnv* env, jobject obj) { |
| 625 return IsContentSettingUserModifiable( |
| 626 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 627 } |
| 628 |
| 629 static jboolean GetMicManagedByCustodian(JNIEnv* env, jobject obj) { |
| 630 return IsContentSettingManagedByCustodian( |
| 631 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 632 } |
| 633 |
621 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) { | 634 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) { |
622 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled); | 635 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled); |
623 } | 636 } |
624 | 637 |
625 static void SetAutologinEnabled(JNIEnv* env, jobject obj, | 638 static void SetAutologinEnabled(JNIEnv* env, jobject obj, |
626 jboolean autologinEnabled) { | 639 jboolean autologinEnabled) { |
627 GetPrefService()->SetBoolean(prefs::kAutologinEnabled, autologinEnabled); | 640 GetPrefService()->SetBoolean(prefs::kAutologinEnabled, autologinEnabled); |
628 } | 641 } |
629 | 642 |
630 static void SetJavaScriptAllowed(JNIEnv* env, jobject obj, jstring pattern, | 643 static void SetJavaScriptAllowed(JNIEnv* env, jobject obj, jstring pattern, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 jobject obj) { | 838 jobject obj) { |
826 return ConvertUTF8ToJavaString( | 839 return ConvertUTF8ToJavaString( |
827 env, | 840 env, |
828 GetPrefService()->GetString( | 841 GetPrefService()->GetString( |
829 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 842 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
830 } | 843 } |
831 | 844 |
832 bool RegisterPrefServiceBridge(JNIEnv* env) { | 845 bool RegisterPrefServiceBridge(JNIEnv* env) { |
833 return RegisterNativesImpl(env); | 846 return RegisterNativesImpl(env); |
834 } | 847 } |
OLD | NEW |