summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-25 15:48:25 +0000
committerbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-25 15:48:25 +0000
commit32dfede31f73b2ad13b415d7c5ed21734b3ab8d1 (patch)
treea622d8ee73921661d3ac138bad86faedb56c1b4a /apps
parente5232a59005b3d5a9051c6061d97bdb46f71bc37 (diff)
downloadchromium_src-32dfede31f73b2ad13b415d7c5ed21734b3ab8d1.zip
chromium_src-32dfede31f73b2ad13b415d7c5ed21734b3ab8d1.tar.gz
chromium_src-32dfede31f73b2ad13b415d7c5ed21734b3ab8d1.tar.bz2
Add policy for fullscreen mode; disallow fullscreen in public sessions
This CL adds a user policy that determines whether fullscreen mode is allowed and uses it to disallow fullscreen mode in public sessions. BUG=275405 TEST=New browser tests Review URL: https://chromiumcodereview.appspot.com/22986010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/pref_names.cc4
-rw-r--r--apps/pref_names.h1
-rw-r--r--apps/prefs.cc6
-rw-r--r--apps/shell_window.cc15
4 files changed, 26 insertions, 0 deletions
diff --git a/apps/pref_names.cc b/apps/pref_names.cc
index 02b652c..2ca3a4a 100644
--- a/apps/pref_names.cc
+++ b/apps/pref_names.cc
@@ -8,6 +8,10 @@ namespace apps {
namespace prefs {
+// A boolean that tracks whether apps are allowed to enter fullscreen mode.
+extern const char kAppFullscreenAllowed[] =
+ "apps.fullscreen.allowed";
+
// A boolean that tracks whether the user has ever enabled the app launcher.
const char kAppLauncherHasBeenEnabled[] =
"apps.app_launcher.has_been_enabled";
diff --git a/apps/pref_names.h b/apps/pref_names.h
index 55af7d0..6a03b861 100644
--- a/apps/pref_names.h
+++ b/apps/pref_names.h
@@ -10,6 +10,7 @@ namespace prefs {
// Alphabetical list of preference names specific to Apps component.
// Keep alphabetized and document each one in the source file.
+extern const char kAppFullscreenAllowed[];
extern const char kAppLauncherHasBeenEnabled[];
extern const char kAppLauncherIsEnabled[];
extern const char kAppLauncherShortcutVersion[];
diff --git a/apps/prefs.cc b/apps/prefs.cc
index 9347783..d53be17 100644
--- a/apps/prefs.cc
+++ b/apps/prefs.cc
@@ -38,6 +38,12 @@ void RegisterPrefs(PrefRegistrySimple* registry) {
}
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
+#if !defined(OS_MACOSX)
+ registry->RegisterBooleanPref(
+ prefs::kAppFullscreenAllowed, true,
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+#endif
+
// Indicates whether app shortcuts have been created.
registry->RegisterBooleanPref(
prefs::kShortcutsHaveBeenCreated, false,
diff --git a/apps/shell_window.cc b/apps/shell_window.cc
index 425adf6..96c6abd 100644
--- a/apps/shell_window.cc
+++ b/apps/shell_window.cc
@@ -37,6 +37,11 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/screen.h"
+#if !defined(OS_MACOSX)
+#include "apps/pref_names.h"
+#include "base/prefs/pref_service.h"
+#endif
+
using content::ConsoleMessageLevel;
using content::WebContents;
using extensions::APIPermission;
@@ -494,6 +499,16 @@ void ShellWindow::NavigationStateChanged(
void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
bool enter_fullscreen) {
+#if !defined(OS_MACOSX)
+ // Do not enter fullscreen mode if disallowed by pref.
+ // TODO(bartfab): Add a test once it becomes possible to simulate a user
+ // gesture. http://crbug.com/174178
+ if (enter_fullscreen &&
+ !profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed)) {
+ return;
+ }
+#endif
+
if (!IsExtensionWithPermissionOrSuggestInConsole(
APIPermission::kFullscreen,
extension_,