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

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

Issue 2470043002: Android: Clean up dead code involving now-removed Fullscreen permission. (Closed)
Patch Set: Created 4 years, 1 month 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 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 "Unsupported incognito mode preference: " << incognito_pref; 432 "Unsupported incognito mode preference: " << incognito_pref;
433 return incognito_pref != IncognitoModePrefs::DISABLED; 433 return incognito_pref != IncognitoModePrefs::DISABLED;
434 } 434 }
435 435
436 static jboolean GetIncognitoModeManaged(JNIEnv* env, 436 static jboolean GetIncognitoModeManaged(JNIEnv* env,
437 const JavaParamRef<jobject>& obj) { 437 const JavaParamRef<jobject>& obj) {
438 return GetPrefService()->IsManagedPreference( 438 return GetPrefService()->IsManagedPreference(
439 prefs::kIncognitoModeAvailability); 439 prefs::kIncognitoModeAvailability);
440 } 440 }
441 441
442 static jboolean GetFullscreenManaged(JNIEnv* env,
443 const JavaParamRef<jobject>& obj) {
444 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN);
445 }
446
447 static jboolean GetFullscreenAllowed(JNIEnv* env,
448 const JavaParamRef<jobject>& obj) {
449 // In the simplified fullscreen case, fullscreen is always allowed.
450 // TODO(mgiuca): Remove this pref once all data associated with it is deleted
451 // (https://crbug.com/591896).
452 if (base::FeatureList::IsEnabled(features::kSimplifiedFullscreenUI))
453 return true;
454
455 HostContentSettingsMap* content_settings =
456 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile());
457 return content_settings->GetDefaultContentSetting(
458 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW;
459 }
460
461 static jboolean IsMetricsReportingEnabled(JNIEnv* env, 442 static jboolean IsMetricsReportingEnabled(JNIEnv* env,
462 const JavaParamRef<jobject>& obj) { 443 const JavaParamRef<jobject>& obj) {
463 PrefService* local_state = g_browser_process->local_state(); 444 PrefService* local_state = g_browser_process->local_state();
464 return local_state->GetBoolean(metrics::prefs::kMetricsReportingEnabled); 445 return local_state->GetBoolean(metrics::prefs::kMetricsReportingEnabled);
465 } 446 }
466 447
467 static void SetMetricsReportingEnabled(JNIEnv* env, 448 static void SetMetricsReportingEnabled(JNIEnv* env,
468 const JavaParamRef<jobject>& obj, 449 const JavaParamRef<jobject>& obj,
469 jboolean enabled) { 450 jboolean enabled) {
470 PrefService* local_state = g_browser_process->local_state(); 451 PrefService* local_state = g_browser_process->local_state();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 static void SetMicEnabled(JNIEnv* env, 857 static void SetMicEnabled(JNIEnv* env,
877 const JavaParamRef<jobject>& obj, 858 const JavaParamRef<jobject>& obj,
878 jboolean allow) { 859 jboolean allow) {
879 HostContentSettingsMap* host_content_settings_map = 860 HostContentSettingsMap* host_content_settings_map =
880 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); 861 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile());
881 host_content_settings_map->SetDefaultContentSetting( 862 host_content_settings_map->SetDefaultContentSetting(
882 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 863 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
883 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 864 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
884 } 865 }
885 866
886 static void SetFullscreenAllowed(JNIEnv* env,
887 const JavaParamRef<jobject>& obj,
888 jboolean allow) {
889 HostContentSettingsMap* host_content_settings_map =
890 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile());
891 host_content_settings_map->SetDefaultContentSetting(
892 CONTENT_SETTINGS_TYPE_FULLSCREEN,
893 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK);
894 }
895
896 static void SetNotificationsEnabled(JNIEnv* env, 867 static void SetNotificationsEnabled(JNIEnv* env,
897 const JavaParamRef<jobject>& obj, 868 const JavaParamRef<jobject>& obj,
898 jboolean allow) { 869 jboolean allow) {
899 HostContentSettingsMap* host_content_settings_map = 870 HostContentSettingsMap* host_content_settings_map =
900 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); 871 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile());
901 host_content_settings_map->SetDefaultContentSetting( 872 host_content_settings_map->SetDefaultContentSetting(
902 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 873 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
903 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 874 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
904 } 875 }
905 876
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 1205
1235 return ConvertJavaStringToUTF8(android_permission); 1206 return ConvertJavaStringToUTF8(android_permission);
1236 } 1207 }
1237 1208
1238 static void SetSupervisedUserId(JNIEnv* env, 1209 static void SetSupervisedUserId(JNIEnv* env,
1239 const JavaParamRef<jobject>& obj, 1210 const JavaParamRef<jobject>& obj,
1240 const JavaParamRef<jstring>& pref) { 1211 const JavaParamRef<jstring>& pref) {
1241 GetPrefService()->SetString(prefs::kSupervisedUserId, 1212 GetPrefService()->SetString(prefs::kSupervisedUserId,
1242 ConvertJavaStringToUTF8(env, pref)); 1213 ConvertJavaStringToUTF8(env, pref));
1243 } 1214 }
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | chrome/browser/android/preferences/website_preference_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698