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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 GetOriginalProfile()->GetHostContentSettingsMap(); | 438 GetOriginalProfile()->GetHostContentSettingsMap(); |
439 host_content_settings_map->SetDefaultContentSetting( | 439 host_content_settings_map->SetDefaultContentSetting( |
440 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 440 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
441 is_enabled ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); | 441 is_enabled ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
442 } | 442 } |
443 | 443 |
444 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { | 444 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { |
445 HostContentSettingsMap* host_content_settings_map = | 445 HostContentSettingsMap* host_content_settings_map = |
446 GetOriginalProfile()->GetHostContentSettingsMap(); | 446 GetOriginalProfile()->GetHostContentSettingsMap(); |
447 host_content_settings_map->SetDefaultContentSetting( | 447 host_content_settings_map->SetDefaultContentSetting( |
448 CONTENT_SETTINGS_TYPE_MEDIASTREAM, | 448 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
| 449 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
| 450 host_content_settings_map->SetDefaultContentSetting( |
| 451 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
449 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); | 452 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); |
450 } | 453 } |
451 | 454 |
452 static void SetFullscreenAllowed(JNIEnv* env, jobject obj, jboolean allow) { | 455 static void SetFullscreenAllowed(JNIEnv* env, jobject obj, jboolean allow) { |
453 HostContentSettingsMap* host_content_settings_map = | 456 HostContentSettingsMap* host_content_settings_map = |
454 GetOriginalProfile()->GetHostContentSettingsMap(); | 457 GetOriginalProfile()->GetHostContentSettingsMap(); |
455 host_content_settings_map->SetDefaultContentSetting( | 458 host_content_settings_map->SetDefaultContentSetting( |
456 CONTENT_SETTINGS_TYPE_FULLSCREEN, | 459 CONTENT_SETTINGS_TYPE_FULLSCREEN, |
457 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK); | 460 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK); |
458 } | 461 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 547 |
545 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) { | 548 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) { |
546 HostContentSettingsMap* host_content_settings_map = | 549 HostContentSettingsMap* host_content_settings_map = |
547 GetOriginalProfile()->GetHostContentSettingsMap(); | 550 GetOriginalProfile()->GetHostContentSettingsMap(); |
548 host_content_settings_map->SetDefaultContentSetting( | 551 host_content_settings_map->SetDefaultContentSetting( |
549 CONTENT_SETTINGS_TYPE_POPUPS, | 552 CONTENT_SETTINGS_TYPE_POPUPS, |
550 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 553 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
551 } | 554 } |
552 | 555 |
553 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) { | 556 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) { |
554 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 557 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && |
| 558 GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
555 } | 559 } |
556 | 560 |
557 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) { | 561 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) { |
558 return IsContentSettingUserModifiable(CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 562 return IsContentSettingUserModifiable( |
| 563 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && |
| 564 IsContentSettingUserModifiable( |
| 565 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
559 } | 566 } |
560 | 567 |
561 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) { | 568 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) { |
562 return IsContentSettingManagedByCustodian(CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 569 return IsContentSettingManagedByCustodian( |
| 570 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && |
| 571 IsContentSettingManagedByCustodian( |
| 572 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
563 } | 573 } |
564 | 574 |
565 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) { | 575 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) { |
566 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled); | 576 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled); |
567 } | 577 } |
568 | 578 |
569 static void SetAutologinEnabled(JNIEnv* env, jobject obj, | 579 static void SetAutologinEnabled(JNIEnv* env, jobject obj, |
570 jboolean autologinEnabled) { | 580 jboolean autologinEnabled) { |
571 GetPrefService()->SetBoolean(prefs::kAutologinEnabled, autologinEnabled); | 581 GetPrefService()->SetBoolean(prefs::kAutologinEnabled, autologinEnabled); |
572 } | 582 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 jobject obj) { | 813 jobject obj) { |
804 return ConvertUTF8ToJavaString( | 814 return ConvertUTF8ToJavaString( |
805 env, | 815 env, |
806 GetPrefService()->GetString( | 816 GetPrefService()->GetString( |
807 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); | 817 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); |
808 } | 818 } |
809 | 819 |
810 bool RegisterPrefServiceBridge(JNIEnv* env) { | 820 bool RegisterPrefServiceBridge(JNIEnv* env) { |
811 return RegisterNativesImpl(env); | 821 return RegisterNativesImpl(env); |
812 } | 822 } |
OLD | NEW |