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

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

Issue 986653004: Add fullscreen permission controls to settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 jboolean enabled) { 315 jboolean enabled) {
316 PrefService* local_state = g_browser_process->local_state(); 316 PrefService* local_state = g_browser_process->local_state();
317 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled); 317 local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled);
318 } 318 }
319 319
320 static jboolean HasSetMetricsReporting(JNIEnv* env, jobject obj) { 320 static jboolean HasSetMetricsReporting(JNIEnv* env, jobject obj) {
321 PrefService* local_state = g_browser_process->local_state(); 321 PrefService* local_state = g_browser_process->local_state();
322 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled); 322 return local_state->HasPrefPath(prefs::kMetricsReportingEnabled);
323 } 323 }
324 324
325 static jboolean GetFullscreenManaged(JNIEnv* env, jobject obj) {
326 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_FULLSCREEN);
327 }
328
329 static jboolean GetFullscreenAllowed(JNIEnv* env, jobject obj) {
330 HostContentSettingsMap* content_settings =
331 GetOriginalProfile()->GetHostContentSettingsMap();
332 return content_settings->GetDefaultContentSetting(
333 CONTENT_SETTINGS_TYPE_FULLSCREEN, NULL) == CONTENT_SETTING_ALLOW;
334 }
335
325 namespace { 336 namespace {
326 337
327 // Redirects a BrowsingDataRemover completion callback back into Java. 338 // Redirects a BrowsingDataRemover completion callback back into Java.
328 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { 339 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer {
329 public: 340 public:
330 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a 341 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a
331 // ChromePreference. 342 // ChromePreference.
332 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) 343 ClearBrowsingDataObserver(JNIEnv* env, jobject obj)
333 : weak_chrome_native_preferences_(env, obj) { 344 : weak_chrome_native_preferences_(env, obj) {
334 } 345 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 442 }
432 443
433 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) { 444 static void SetCameraMicEnabled(JNIEnv* env, jobject obj, jboolean allow) {
434 HostContentSettingsMap* host_content_settings_map = 445 HostContentSettingsMap* host_content_settings_map =
435 GetOriginalProfile()->GetHostContentSettingsMap(); 446 GetOriginalProfile()->GetHostContentSettingsMap();
436 host_content_settings_map->SetDefaultContentSetting( 447 host_content_settings_map->SetDefaultContentSetting(
437 CONTENT_SETTINGS_TYPE_MEDIASTREAM, 448 CONTENT_SETTINGS_TYPE_MEDIASTREAM,
438 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 449 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
439 } 450 }
440 451
452 static void SetFullscreenAllowed(JNIEnv* env, jobject obj, jboolean allow) {
453 HostContentSettingsMap* host_content_settings_map =
454 GetOriginalProfile()->GetHostContentSettingsMap();
455 host_content_settings_map->SetDefaultContentSetting(
456 CONTENT_SETTINGS_TYPE_FULLSCREEN,
457 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_ASK);
458 }
459
441 static void SetPushNotificationsEnabled(JNIEnv* env, 460 static void SetPushNotificationsEnabled(JNIEnv* env,
442 jobject obj, 461 jobject obj,
443 jboolean allow) { 462 jboolean allow) {
444 HostContentSettingsMap* host_content_settings_map = 463 HostContentSettingsMap* host_content_settings_map =
445 GetOriginalProfile()->GetHostContentSettingsMap(); 464 GetOriginalProfile()->GetHostContentSettingsMap();
446 host_content_settings_map->SetDefaultContentSetting( 465 host_content_settings_map->SetDefaultContentSetting(
447 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 466 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
448 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 467 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
449 } 468 }
450 469
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 jobject obj) { 803 jobject obj) {
785 return ConvertUTF8ToJavaString( 804 return ConvertUTF8ToJavaString(
786 env, 805 env,
787 GetPrefService()->GetString( 806 GetPrefService()->GetString(
788 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release(); 807 prefs::kSupervisedUserSecondCustodianProfileImageURL)).Release();
789 } 808 }
790 809
791 bool RegisterPrefServiceBridge(JNIEnv* env) { 810 bool RegisterPrefServiceBridge(JNIEnv* env) {
792 return RegisterNativesImpl(env); 811 return RegisterNativesImpl(env);
793 } 812 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698