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

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: Migration code added. 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 368 }
369 369
370 static void SetAllowLocationEnabled(JNIEnv* env, jobject obj, jboolean allow) { 370 static void SetAllowLocationEnabled(JNIEnv* env, jobject obj, jboolean allow) {
371 GetPrefService()->SetBoolean(prefs::kGeolocationEnabled, allow); 371 GetPrefService()->SetBoolean(prefs::kGeolocationEnabled, allow);
372 } 372 }
373 373
374 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { 374 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) {
375 HostContentSettingsMap* host_content_settings_map = 375 HostContentSettingsMap* host_content_settings_map =
376 GetOriginalProfile()->GetHostContentSettingsMap(); 376 GetOriginalProfile()->GetHostContentSettingsMap();
377 host_content_settings_map->SetDefaultContentSetting( 377 host_content_settings_map->SetDefaultContentSetting(
378 CONTENT_SETTINGS_TYPE_MEDIASTREAM, 378 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
379 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
380 host_content_settings_map->SetDefaultContentSetting(
381 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
379 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 382 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
380 } 383 }
381 384
382 static void SetPushNotificationsEnabled(JNIEnv* env, 385 static void SetPushNotificationsEnabled(JNIEnv* env,
383 jobject obj, 386 jobject obj,
384 jboolean allow) { 387 jboolean allow) {
385 HostContentSettingsMap* host_content_settings_map = 388 HostContentSettingsMap* host_content_settings_map =
386 GetOriginalProfile()->GetHostContentSettingsMap(); 389 GetOriginalProfile()->GetHostContentSettingsMap();
387 host_content_settings_map->SetDefaultContentSetting( 390 host_content_settings_map->SetDefaultContentSetting(
388 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 391 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) { 470 static void SetAllowPopupsEnabled(JNIEnv* env, jobject obj, jboolean allow) {
468 HostContentSettingsMap* host_content_settings_map = 471 HostContentSettingsMap* host_content_settings_map =
469 GetOriginalProfile()->GetHostContentSettingsMap(); 472 GetOriginalProfile()->GetHostContentSettingsMap();
470 host_content_settings_map->SetDefaultContentSetting( 473 host_content_settings_map->SetDefaultContentSetting(
471 CONTENT_SETTINGS_TYPE_POPUPS, 474 CONTENT_SETTINGS_TYPE_POPUPS,
472 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); 475 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
473 } 476 }
474 477
475 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) { 478 static jboolean GetCameraMicEnabled(JNIEnv* env, jobject obj) {
476 PrefService* prefs = GetPrefService(); 479 PrefService* prefs = GetPrefService();
477 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM) && 480 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
481 GetBooleanForContentSetting(
482 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) &&
478 prefs->GetBoolean(prefs::kAudioCaptureAllowed) && 483 prefs->GetBoolean(prefs::kAudioCaptureAllowed) &&
479 prefs->GetBoolean(prefs::kVideoCaptureAllowed); 484 prefs->GetBoolean(prefs::kVideoCaptureAllowed);
480 } 485 }
481 486
482 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) { 487 static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) {
483 PrefService* prefs = GetPrefService(); 488 PrefService* prefs = GetPrefService();
484 return IsContentSettingUserModifiable(CONTENT_SETTINGS_TYPE_MEDIASTREAM) && 489 return IsContentSettingUserModifiable(
490 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
491 IsContentSettingUserModifiable(
492 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) &&
485 prefs->IsUserModifiablePreference(prefs::kAudioCaptureAllowed) && 493 prefs->IsUserModifiablePreference(prefs::kAudioCaptureAllowed) &&
486 prefs->IsUserModifiablePreference(prefs::kVideoCaptureAllowed); 494 prefs->IsUserModifiablePreference(prefs::kVideoCaptureAllowed);
487 } 495 }
488 496
489 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) { 497 static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) {
490 return IsContentSettingManagedByCustodian(CONTENT_SETTINGS_TYPE_MEDIASTREAM); 498 return IsContentSettingManagedByCustodian(CONTENT_SETTINGS_TYPE_MEDIASTREAM);
491 } 499 }
492 500
493 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) { 501 static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) {
494 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled); 502 return GetPrefService()->GetBoolean(prefs::kAutologinEnabled);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 jobject obj) { 739 jobject obj) {
732 return ConvertUTF8ToJavaString( 740 return ConvertUTF8ToJavaString(
733 env, 741 env,
734 GetPrefService()->GetString( 742 GetPrefService()->GetString(
735 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); 743 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release();
736 } 744 }
737 745
738 bool RegisterPrefServiceBridge(JNIEnv* env) { 746 bool RegisterPrefServiceBridge(JNIEnv* env) {
739 return RegisterNativesImpl(env); 747 return RegisterNativesImpl(env);
740 } 748 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698