Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 965103004: Stop using the MEDIASTREAM content setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated policy Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 358 }
359 359
360 static void SetAllowLocationEnabled(JNIEnv* env, jobject obj, jboolean allow) { 360 static void SetAllowLocationEnabled(JNIEnv* env, jobject obj, jboolean allow) {
361 GetPrefService()->SetBoolean(prefs::kGeolocationEnabled, allow); 361 GetPrefService()->SetBoolean(prefs::kGeolocationEnabled, allow);
362 } 362 }
363 363
364 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { 364 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) {
365 HostContentSettingsMap* host_content_settings_map = 365 HostContentSettingsMap* host_content_settings_map =
366 GetOriginalProfile()->GetHostContentSettingsMap(); 366 GetOriginalProfile()->GetHostContentSettingsMap();
367 host_content_settings_map->SetDefaultContentSetting( 367 host_content_settings_map->SetDefaultContentSetting(
368 CONTENT_SETTINGS_TYPE_MEDIASTREAM, 368 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
369 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
370 host_content_settings_map->SetDefaultContentSetting(
371 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
369 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 372 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
370 } 373 }
371 374
372 static void SetPushNotificationsEnabled(JNIEnv* env, 375 static void SetPushNotificationsEnabled(JNIEnv* env,
373 jobject obj, 376 jobject obj,
374 jboolean allow) { 377 jboolean allow) {
375 HostContentSettingsMap* host_content_settings_map = 378 HostContentSettingsMap* host_content_settings_map =
376 GetOriginalProfile()->GetHostContentSettingsMap(); 379 GetOriginalProfile()->GetHostContentSettingsMap();
377 host_content_settings_map->SetDefaultContentSetting( 380 host_content_settings_map->SetDefaultContentSetting(
378 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 381 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) { 460 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) {
458 HostContentSettingsMap* host_content_settings_map = 461 HostContentSettingsMap* host_content_settings_map =
459 GetOriginalProfile()->GetHostContentSettingsMap(); 462 GetOriginalProfile()->GetHostContentSettingsMap();
460 host_content_settings_map->SetDefaultContentSetting( 463 host_content_settings_map->SetDefaultContentSetting(
461 CONTENT_SETTINGS_TYPE_POPUPS, 464 CONTENT_SETTINGS_TYPE_POPUPS,
462 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); 465 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
463 } 466 }
464 467
465 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) { 468 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) {
466 PrefService* prefs = GetPrefService(); 469 PrefService* prefs = GetPrefService();
467 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM) && 470 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
471 GetBooleanForContentSetting(
472 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) &&
468 prefs->GetBoolean(prefs::kAudioCaptureAllowed) && 473 prefs->GetBoolean(prefs::kAudioCaptureAllowed) &&
469 prefs->GetBoolean(prefs::kVideoCaptureAllowed); 474 prefs->GetBoolean(prefs::kVideoCaptureAllowed);
470 } 475 }
471 476
472 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) { 477 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) {
473 PrefService* prefs = GetPrefService(); 478 PrefService* prefs = GetPrefService();
474 return IsContentSettingUserModifiable(CONTENT_SETTINGS_TYPE_MEDIASTREAM) && 479 return IsContentSettingUserModifiable(
480 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
481 IsContentSettingUserModifiable(
482 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) &&
475 prefs->IsUserModifiablePreference(prefs::kAudioCaptureAllowed) && 483 prefs->IsUserModifiablePreference(prefs::kAudioCaptureAllowed) &&
476 prefs->IsUserModifiablePreference(prefs::kVideoCaptureAllowed); 484 prefs->IsUserModifiablePreference(prefs::kVideoCaptureAllowed);
477 } 485 }
478 486
479 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) { 487 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) {
480 PrefService* prefs = GetPrefService(); 488 PrefService* prefs = GetPrefService();
481 if (prefs->IsPreferenceManagedByCustodian(prefs::kVideoCaptureAllowed)) 489 if (prefs->IsPreferenceManagedByCustodian(prefs::kVideoCaptureAllowed))
482 return true; 490 return true;
483 if (prefs->IsPreferenceManagedByCustodian(prefs::kAudioCaptureAllowed)) 491 if (prefs->IsPreferenceManagedByCustodian(prefs::kAudioCaptureAllowed))
484 return true; 492 return true;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 jobject obj) { 734 jobject obj) {
727 return ConvertUTF8ToJavaString( 735 return ConvertUTF8ToJavaString(
728 env, 736 env,
729 GetPrefService()->GetString( 737 GetPrefService()->GetString(
730 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); 738 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release();
731 } 739 }
732 740
733 bool RegisterPrefServiceBridge(JNIEnv* env) { 741 bool RegisterPrefServiceBridge(JNIEnv* env) {
734 return RegisterNativesImpl(env); 742 return RegisterNativesImpl(env);
735 } 743 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698