зеркало из https://github.com/mozilla/gecko-dev.git
Bug 158968 - Implement kiosk mode. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D41848 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f80662b1b5
Коммит
d3547ee818
|
@ -8,6 +8,17 @@
|
||||||
|
|
||||||
ChromeUtils.import("resource:///modules/PermissionUI.jsm", this);
|
ChromeUtils.import("resource:///modules/PermissionUI.jsm", this);
|
||||||
|
|
||||||
|
var { XPCOMUtils } = ChromeUtils.import(
|
||||||
|
"resource://gre/modules/XPCOMUtils.jsm"
|
||||||
|
);
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(
|
||||||
|
this,
|
||||||
|
"BrowserHandler",
|
||||||
|
"@mozilla.org/browser/clh;1",
|
||||||
|
"nsIBrowserHandler"
|
||||||
|
);
|
||||||
|
|
||||||
var PointerlockFsWarning = {
|
var PointerlockFsWarning = {
|
||||||
_element: null,
|
_element: null,
|
||||||
_origin: null,
|
_origin: null,
|
||||||
|
@ -649,6 +660,9 @@ var FullScreen = {
|
||||||
},
|
},
|
||||||
|
|
||||||
showNavToolbox(trackMouse = true) {
|
showNavToolbox(trackMouse = true) {
|
||||||
|
if (BrowserHandler.kiosk) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._fullScrToggler.hidden = true;
|
this._fullScrToggler.hidden = true;
|
||||||
gNavToolbox.removeAttribute("fullscreenShouldAnimate");
|
gNavToolbox.removeAttribute("fullscreenShouldAnimate");
|
||||||
gNavToolbox.style.marginTop = "";
|
gNavToolbox.style.marginTop = "";
|
||||||
|
@ -690,11 +704,13 @@ var FullScreen = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// a textbox in chrome is focused (location bar anyone?): don't collapse chrome
|
// a textbox in chrome is focused (location bar anyone?): don't collapse chrome
|
||||||
|
// unless we are kiosk mode
|
||||||
let focused = document.commandDispatcher.focusedElement;
|
let focused = document.commandDispatcher.focusedElement;
|
||||||
if (
|
if (
|
||||||
focused &&
|
focused &&
|
||||||
focused.ownerDocument == document &&
|
focused.ownerDocument == document &&
|
||||||
focused.localName == "input"
|
focused.localName == "input" &&
|
||||||
|
!BrowserHandler.kiosk
|
||||||
) {
|
) {
|
||||||
// But try collapse the chrome again when anything happens which can make
|
// But try collapse the chrome again when anything happens which can make
|
||||||
// it lose the focus. We cannot listen on "blur" event on focused here
|
// it lose the focus. We cannot listen on "blur" event on focused here
|
||||||
|
@ -725,7 +741,8 @@ var FullScreen = {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
aAnimate &&
|
aAnimate &&
|
||||||
Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")
|
Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled") &&
|
||||||
|
!BrowserHandler.kiosk
|
||||||
) {
|
) {
|
||||||
gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
|
gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
|
||||||
// Hide the fullscreen toggler until the transition ends.
|
// Hide the fullscreen toggler until the transition ends.
|
||||||
|
|
|
@ -266,6 +266,7 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||||
],
|
],
|
||||||
Marionette: ["@mozilla.org/remote/marionette;1", "nsIMarionette"],
|
Marionette: ["@mozilla.org/remote/marionette;1", "nsIMarionette"],
|
||||||
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
|
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
|
||||||
|
BrowserHandler: ["@mozilla.org/browser/clh;1", "nsIBrowserHandler"],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||||
|
@ -2178,6 +2179,15 @@ var gBrowserInit = {
|
||||||
|
|
||||||
Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
|
Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
|
||||||
TelemetryTimestamps.add("delayedStartupFinished");
|
TelemetryTimestamps.add("delayedStartupFinished");
|
||||||
|
|
||||||
|
if (BrowserHandler.kiosk) {
|
||||||
|
// We don't modify popup windows for kiosk mode
|
||||||
|
if (!gURLBar.readOnly) {
|
||||||
|
// Don't show status tooltips in kiosk mode
|
||||||
|
document.getElementById("statuspanel").hidden = true;
|
||||||
|
window.fullScreen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setInitialFocus() {
|
_setInitialFocus() {
|
||||||
|
@ -3853,7 +3863,7 @@ function getDefaultHomePage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function BrowserFullScreen() {
|
function BrowserFullScreen() {
|
||||||
window.fullScreen = !window.fullScreen;
|
window.fullScreen = !window.fullScreen || BrowserHandler.kiosk;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWebNavigation() {
|
function getWebNavigation() {
|
||||||
|
|
|
@ -35,9 +35,20 @@ XPCOMUtils.defineLazyGetter(this, "ReferrerInfo", () =>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(
|
||||||
|
this,
|
||||||
|
"BrowserHandler",
|
||||||
|
"@mozilla.org/browser/clh;1",
|
||||||
|
"nsIBrowserHandler"
|
||||||
|
);
|
||||||
|
|
||||||
var gContextMenuContentData = null;
|
var gContextMenuContentData = null;
|
||||||
|
|
||||||
function openContextMenu(aMessage, aBrowser, aActor) {
|
function openContextMenu(aMessage, aBrowser, aActor) {
|
||||||
|
if (BrowserHandler.kiosk) {
|
||||||
|
// Don't display context menus in kiosk mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
let data = aMessage.data;
|
let data = aMessage.data;
|
||||||
let browser = aBrowser;
|
let browser = aBrowser;
|
||||||
let actor = aActor;
|
let actor = aActor;
|
||||||
|
|
|
@ -93,6 +93,8 @@ function resolveURIInternal(aCmdLine, aArgument) {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let gKiosk = false;
|
||||||
|
|
||||||
let gRemoteInstallPage = null;
|
let gRemoteInstallPage = null;
|
||||||
|
|
||||||
function getNewInstallPage() {
|
function getNewInstallPage() {
|
||||||
|
@ -393,6 +395,9 @@ nsBrowserContentHandler.prototype = {
|
||||||
|
|
||||||
/* nsICommandLineHandler */
|
/* nsICommandLineHandler */
|
||||||
handle: function bch_handle(cmdLine) {
|
handle: function bch_handle(cmdLine) {
|
||||||
|
if (cmdLine.handleFlag("kiosk", false)) {
|
||||||
|
gKiosk = true;
|
||||||
|
}
|
||||||
if (cmdLine.handleFlag("browser", false)) {
|
if (cmdLine.handleFlag("browser", false)) {
|
||||||
openBrowserWindow(cmdLine, gSystemPrincipal);
|
openBrowserWindow(cmdLine, gSystemPrincipal);
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
|
@ -606,6 +611,7 @@ nsBrowserContentHandler.prototype = {
|
||||||
info += " --setDefaultBrowser Set this app as the default browser.\n";
|
info += " --setDefaultBrowser Set this app as the default browser.\n";
|
||||||
info +=
|
info +=
|
||||||
" --first-startup Run post-install actions before opening a new window.\n";
|
" --first-startup Run post-install actions before opening a new window.\n";
|
||||||
|
info += " --kiosk Start the browser in kiosk mode.\n";
|
||||||
return info;
|
return info;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -821,6 +827,10 @@ nsBrowserContentHandler.prototype = {
|
||||||
return this.mFeatures;
|
return this.mFeatures;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get kiosk() {
|
||||||
|
return gKiosk;
|
||||||
|
},
|
||||||
|
|
||||||
/* nsIContentHandler */
|
/* nsIContentHandler */
|
||||||
|
|
||||||
handleContent: function bch_handleContent(contentType, context, request) {
|
handleContent: function bch_handleContent(contentType, context, request) {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
Enterprise Policies
|
||||||
|
===================
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
Firefox provides policies to manage various aspects of Firefox. The best documentation is in `GitHub <https://github.com/mozilla/policy-templates/>`_.
|
||||||
|
|
||||||
|
Kiosk Mode
|
||||||
|
----------
|
||||||
|
|
||||||
|
The kiosk mode provided by Firefox on the command line (--kiosk) is a very basic mode intended for kiosks where the content loaded in the browser is strictly limited by the owner of the kiosk and either there is no keyboard or keyboard access is limited (particularly Ctrl and Alt). It is their responsibility to ensure the content does not surprise/confuse users or break browser UI in this setup.
|
||||||
|
|
||||||
|
It does three main things:
|
||||||
|
|
||||||
|
1. Switch all main browser windows (not popup windows) into full screen mode.
|
||||||
|
2. Don't show the context menu.
|
||||||
|
3. Don't show status for URLs or pageloading.
|
|
@ -7,6 +7,8 @@
|
||||||
with Files("**"):
|
with Files("**"):
|
||||||
BUG_COMPONENT = ("Firefox", "Enterprise Policies")
|
BUG_COMPONENT = ("Firefox", "Enterprise Policies")
|
||||||
|
|
||||||
|
SPHINX_TREES['docs'] = 'docs'
|
||||||
|
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'helpers',
|
'helpers',
|
||||||
'schemas',
|
'schemas',
|
||||||
|
|
|
@ -11,6 +11,7 @@ interface nsIBrowserHandler : nsISupports
|
||||||
{
|
{
|
||||||
attribute AUTF8String startPage;
|
attribute AUTF8String startPage;
|
||||||
attribute AUTF8String defaultArgs;
|
attribute AUTF8String defaultArgs;
|
||||||
|
attribute boolean kiosk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the width and height specified on the command line, if present.
|
* Extract the width and height specified on the command line, if present.
|
||||||
|
|
|
@ -9,6 +9,7 @@ This is the nascent documentation of the Firefox front-end code.
|
||||||
|
|
||||||
urlbar/index
|
urlbar/index
|
||||||
BrowserUsageTelemetry
|
BrowserUsageTelemetry
|
||||||
|
components/enterprisepolicies/docs/index
|
||||||
extensions/formautofill/docs/index
|
extensions/formautofill/docs/index
|
||||||
components/newtab/docs/index
|
components/newtab/docs/index
|
||||||
installer/windows/installer/index
|
installer/windows/installer/index
|
||||||
|
|
Загрузка…
Ссылка в новой задаче