Commit 3a5d08dc authored by Scott Chen's avatar Scott Chen Committed by Commit Bot

MD Extensions: port over consumer kiosk management dialog.

This CL ports over the kiosk app management modal from the existing
extensions page to the MD extensions page.

Bug: 764943
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ib35d989227aa023dc08673fb54d8f38275abad80
Reviewed-on: https://chromium-review.googlesource.com/671905
Commit-Queue: Scott Chen <scottchen@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505122}
parent b48a34b0
......@@ -166,4 +166,37 @@
<message name="IDS_MD_EXTENSIONS_TYPE_A_SHORTCUT" desc="The prompt to the user to enter a keyboard shortcut in order to assign it to an extension.">
Type a shortcut
</message>
<if expr="chromeos">
<!-- Extensions Kiosk apps -->
<message name="IDS_MD_EXTENSIONS_MANAGE_KIOSK_APP" desc="Label of the button to bring up kiosk management overlay on chrome extensions page.">
Manage kiosk applications
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_ADD_APP" desc="Label above the application id text input in the kiosk settings overlay.">
Add kiosk application
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_ADD_APP_HINT" desc="Placeholder hint in the application id text input in the kiosk settings overlay.">
Enter application ID or webstore URL
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_ENABLE_AUTO_LAUNCH" desc="Text for a button that enables an application to auto launch on startup in the kiosk settings overlay.">
Set to auto-launch
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_DISABLE_AUTO_LAUNCH" desc="Text for a button that disables an application to auto launch on startup in the kiosk settings overlay.">
Disable auto-launch
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_AUTO_LAUNCH" desc="Text shows besides an application that is set to auto launch on start up in the kiosk settings overlay.">
(auto-launched)
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_INVALID_APP" desc="Text shows besides an application that is not valid in the kiosk settings overlay.">
Invalid application
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_LABEL" desc="Label text for a checkbox to disable kiosk application launch bail out shortcut.">
Permanently keep this device in kiosk mode
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE" desc="Bold text of the warning dialog for disabling kiosk application launch bail out shortcut.">
Are you sure you want to permanently keep this device in kiosk mode?
</message>
<message name="IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_BODY" desc="Warning text of disabling kiosk application launch bail out shortcut.">
The only way to undo this is to re-install <ph name="IDS_SHORT_PRODUCT_OS_NAME">$1<ex>Chrome OS</ex></ph>
</message>
</if>
</grit-part>
......@@ -190,8 +190,14 @@
<include name="IDR_MD_EXTENSIONS_ERROR_PAGE_JS" file="resources\md_extensions\error_page.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML" file="resources\md_extensions\keyboard_shortcuts.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_JS" file="resources\md_extensions\keyboard_shortcuts.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_MANAGER_HTML" file="resources\md_extensions\manager.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_MANAGER_JS" file="resources\md_extensions\manager.js" type="BINDATA" />
<if expr="chromeos">
<include name="IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_HTML" file="resources\md_extensions\kiosk_browser_proxy.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_JS" file="resources\md_extensions\kiosk_browser_proxy.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_KIOSK_DIALOG_HTML" file="resources\md_extensions\kiosk_dialog.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_KIOSK_DIALOG_JS" file="resources\md_extensions\kiosk_dialog.js" type="BINDATA" />
</if>
<include name="IDR_MD_EXTENSIONS_MANAGER_HTML" file="resources\md_extensions\manager.html" type="BINDATA" flattenhtml="true" />
<include name="IDR_MD_EXTENSIONS_MANAGER_JS" file="resources\md_extensions\manager.js" type="BINDATA" flattenhtml="true" />
<include name="IDR_MD_EXTENSIONS_ICONS_HTML" file="resources\md_extensions\icons.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_ITEM_HTML" file="resources\md_extensions\item.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_ITEM_JS" file="resources\md_extensions\item.js" type="BINDATA" />
......@@ -215,8 +221,8 @@
<include name="IDR_MD_EXTENSIONS_SHORTCUT_INPUT_JS" file="resources\md_extensions\shortcut_input.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_SIDEBAR_HTML" file="resources\md_extensions\sidebar.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_SIDEBAR_JS" file="resources\md_extensions\sidebar.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_TOOLBAR_HTML" file="resources\md_extensions\toolbar.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_TOOLBAR_JS" file="resources\md_extensions\toolbar.js" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_TOOLBAR_HTML" file="resources\md_extensions\toolbar.html" type="BINDATA" flattenhtml="true" />
<include name="IDR_MD_EXTENSIONS_TOOLBAR_JS" file="resources\md_extensions\toolbar.js" type="BINDATA" flattenhtml="true" />
<include name="IDR_MD_EXTENSIONS_STRINGS_HTML" file="resources\md_extensions\strings.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_VIEW_MANAGER_HTML" file="resources\md_extensions\view_manager.html" type="BINDATA" />
<include name="IDR_MD_EXTENSIONS_VIEW_MANAGER_JS" file="resources\md_extensions\view_manager.js" type="BINDATA" />
......
......@@ -101,6 +101,22 @@
],
'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
},
{
'target_name': 'kiosk_browser_proxy',
'dependencies': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
],
'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
},
{
'target_name': 'kiosk_dialog',
'dependencies': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:web_ui_listener_behavior',
'kiosk_browser_proxy',
],
'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
},
{
'target_name': 'load_error',
'dependencies': [
......@@ -125,6 +141,7 @@
'item_util',
'load_error',
'keyboard_shortcuts',
'kiosk_browser_proxy',
'navigation_helper',
'sidebar',
'toolbar',
......
<link rel="import" href="chrome://resources/html/cr.html">
<script src="kiosk_browser_proxy.js"></script>
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview A helper object used from the "Kiosk" dialog to interact with
* the browser.
*/
/**
* @typedef {{
* kioskEnabled: boolean,
* autoLaunchEnabled: boolean
* }}
*/
let KioskSettings;
/**
* @typedef {{
* id: string,
* name: string,
* iconURL: string,
* autoLaunch: boolean,
* isLoading: boolean
* }}
*/
let KioskApp;
/**
* @typedef {{
* apps: !Array<!KioskApp>,
* disableBailout: boolean,
* hasAutoLaunchApp: boolean
* }}
*/
let KioskAppSettings;
cr.define('extensions', function() {
/** @interface */
class KioskBrowserProxy {
/** @param {string} appId */
addKioskApp(appId) {}
/** @param {string} appId */
disableKioskAutoLaunch(appId) {}
/** @param {string} appId */
enableKioskAutoLaunch(appId) {}
/** @return {!Promise<!KioskAppSettings>} */
getKioskAppSettings() {}
/** @return {!Promise<!KioskSettings>} */
initializeKioskAppSettings() {}
/** @param {string} appId */
removeKioskApp(appId) {}
/** @param {boolean} disableBailout */
setDisableBailoutShortcut(disableBailout) {}
}
/** @implements {extensions.KioskBrowserProxy} */
class KioskBrowserProxyImpl {
/** @override */
initializeKioskAppSettings() {
return cr.sendWithPromise('initializeKioskAppSettings');
}
/** @override */
getKioskAppSettings() {
return cr.sendWithPromise('getKioskAppSettings');
}
/** @override */
addKioskApp(appId) {
chrome.send('addKioskApp', [appId]);
}
/** @override */
disableKioskAutoLaunch(appId) {
chrome.send('disableKioskAutoLaunch', [appId]);
}
/** @override */
enableKioskAutoLaunch(appId) {
chrome.send('enableKioskAutoLaunch', [appId]);
}
/** @override */
removeKioskApp(appId) {
chrome.send('removeKioskApp', [appId]);
}
/** @override */
setDisableBailoutShortcut(disableBailout) {
chrome.send('setDisableBailoutShortcut', [disableBailout]);
}
}
cr.addSingletonGetter(KioskBrowserProxyImpl);
return {
KioskBrowserProxy: KioskBrowserProxy,
KioskBrowserProxyImpl: KioskBrowserProxyImpl,
};
});
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-checkbox/paper-checkbox.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input.html">
<link rel="import" href="kiosk_browser_proxy.html">
<dom-module id="extensions-kiosk-dialog">
<template>
<style include="cr-shared-style paper-button-style cr-icons">
#add-kiosk-app {
--paper-input-container-input: {
font-size: inherit;
};
align-items: center;
display: flex;
margin-bottom: 10px;
margin-top: 20px;
width: 350px;
}
#add-kiosk-app paper-input {
flex: 1;
}
#add-kiosk-app paper-button {
-webkit-margin-start: 10px;
}
paper-button {
color: var(--google-blue-500);
}
#kiosk-apps-list {
border: 1px solid var(--paper-grey-300);
padding: 10px;
}
.list-item {
align-items: center;
border-bottom: 1px solid var(--paper-grey-300);
display: flex;
justify-content: space-between;
padding: 5px;
}
.list-item:last-of-type {
border-bottom: none;
}
.list-item:hover {
background-color: var(--paper-grey-300);
}
.item-icon {
vertical-align: middle;
width: 25px;
}
.item-controls {
visibility: hidden;
}
.list-item:hover .item-controls {
visibility: visible;
}
</style>
<dialog is="cr-dialog" id="dialog" close-text="$i18n{close}"
ignore-enter-key>
<div slot="title">$i18n{manageKioskApp}</div>
<div slot="body">
<div id="kiosk-apps-list">
<template is="dom-repeat" items="[[apps_]]">
<div class="list-item">
<div class="item-name">
<img class="item-icon" src="[[item.iconURL]]">
[[item.name]]
<span hidden="[[!item.autoLaunch]]">
$i18n{kioskAutoLaunch}
</span>
</div>
<div class="item-controls">
<paper-button hidden="[[!canEditAutoLaunch_]]"
on-tap="onAutoLaunchButtonTap_">
[[getAutoLaunchButtonLabel_(item.autoLaunch,
'$i18nPolymer{kioskDisableAutoLaunch}',
'$i18nPolymer{kioskEnableAutoLaunch}')]]
</paper-button>
<button is="paper-icon-button-light" class="icon-delete-gray"
on-tap="onDeleteAppTap_"></button>
</div>
</div>
</template>
</div>
<div id="add-kiosk-app">
<paper-input id="add-input" label="$i18n{kioskAddApp}"
placeholder="$i18n{kioskAddAppHint}" value="{{addAppInput_}}"
always-float-label invalid="[[errorAppId_]]"
error-message="[[getErrorMessage_(
'$i18nPolymer{kioskInvalidApp}', errorAppId_)]]"
on-keydown="clearInputInvalid_">
</paper-input>
<paper-button id="add-button" on-tap="onAddAppTap_"
disabled="[[!addAppInput_]]">
$i18n{add}
</paper-button>
</div>
<paper-checkbox disabled="[[!canEditBailout_]]"
on-pointerdown="onBailoutTap_" checked="[[bailoutDisabled_]]"
hidden="[[!canEditAutoLaunch_]]">
$i18n{kioskDisableBailout}
</paper-checkbox>
</div>
<div slot="button-container">
<paper-button class="action-button" on-tap="onDoneTap_">
$i18n{done}
</paper-button>
</div>
</dialog>
<dialog is="cr-dialog" id="confirm-dialog" close-text="$i18n{close}"
ignore-enter-key on-close="stopPropagation_">
<div slot="title">$i18n{kioskDisableBailoutWarningTitle}</div>
<div slot="body">$i18n{kioskDisableBailoutWarningBody}</div>
<div slot="button-container">
<paper-button class="cancel-button" on-tap="onBailoutDialogCancelTap_">
$i18n{cancel}
</paper-button>
<paper-button class="action-button" on-tap="onBailoutDialogConfirmTap_">
$i18n{confirm}
</paper-button>
</div>
</dialog>
</template>
<script src="chrome://extensions/kiosk_dialog.js"></script>
</dom-module>
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('extensions', function() {
'use strict';
const KioskDialog = Polymer({
is: 'extensions-kiosk-dialog',
behaviors: [WebUIListenerBehavior],
properties: {
/** @private {?string} */
addAppInput_: {
type: String,
value: null,
},
/** @private {!Array<!KioskApp>} */
apps_: Array,
/** @private */
bailoutDisabled_: Boolean,
/** @private */
canEditAutoLaunch_: Boolean,
/** @private */
canEditBailout_: Boolean,
/** @private {?string} */
errorAppId_: String,
},
/** @private {?extensions.KioskBrowserProxy} */
kioskBrowserProxy_: null,
/** @override */
ready: function() {
this.kioskBrowserProxy_ = extensions.KioskBrowserProxyImpl.getInstance();
},
/** @override */
attached: function() {
this.kioskBrowserProxy_.initializeKioskAppSettings()
.then(params => {
this.canEditAutoLaunch_ = params.autoLaunchEnabled;
return this.kioskBrowserProxy_.getKioskAppSettings();
})
.then(this.setSettings_.bind(this));
this.addWebUIListener(
'kiosk-app-settings-changed', this.setSettings_.bind(this));
this.addWebUIListener('kiosk-app-updated', this.updateApp_.bind(this));
this.addWebUIListener('kiosk-app-error', this.showError_.bind(this));
this.$.dialog.showModal();
},
/**
* @param {!KioskAppSettings} settings
* @private
*/
setSettings_: function(settings) {
this.apps_ = settings.apps;
this.bailoutDisabled_ = settings.disableBailout;
this.canEditBailout_ = settings.hasAutoLaunchApp;
},
/**
* @param {!KioskApp} app
* @private
*/
updateApp_: function(app) {
const index = this.apps_.findIndex(a => a.id == app.id);
assert(index < this.apps_.length);
this.set('apps_.' + index, app);
},
/**
* @param {string} appId
* @private
*/
showError_: function(appId) {
this.errorAppId_ = appId;
},
/**
* @param {string} errorMessage
* @return {string}
* @private
*/
getErrorMessage_: function(errorMessage) {
return this.errorAppId_ + ' ' + errorMessage;
},
/** @private */
onAddAppTap_: function() {
assert(this.addAppInput_);
this.kioskBrowserProxy_.addKioskApp(this.addAppInput_);
this.addAppInput_ = null;
},
/** @private */
clearInputInvalid_: function() {
this.errorAppId_ = null;
},
/**
* @param {{model: {item: !KioskApp}}} event
* @private
*/
onAutoLaunchButtonTap_: function(event) {
const app = event.model.item;
if (app.autoLaunch) { // If the app is originally set to
// auto-launch.
this.kioskBrowserProxy_.disableKioskAutoLaunch(app.id);
} else {
this.kioskBrowserProxy_.enableKioskAutoLaunch(app.id);
}
},
/**
* @param {!Event} event
* @private
*/
onBailoutTap_: function(event) {
event.preventDefault();
if (this.bailoutDisabled_) {
this.kioskBrowserProxy_.setDisableBailoutShortcut(false);
this.bailoutDisabled_ = false;
this.$['confirm-dialog'].close();
} else {
this.$['confirm-dialog'].showModal();
}
},
/** @private */
onBailoutDialogCancelTap_: function() {
this.$['confirm-dialog'].cancel();
},
/** @private */
onBailoutDialogConfirmTap_: function() {
this.kioskBrowserProxy_.setDisableBailoutShortcut(true);
this.bailoutDisabled_ = true;
this.$['confirm-dialog'].close();
},
/** @private */
onDoneTap_: function() {
this.$.dialog.close();
},
/**
* @param {{model: {item: !KioskApp}}} event
* @private
*/
onDeleteAppTap_: function(event) {
this.kioskBrowserProxy_.removeKioskApp(event.model.item.id);
},
/**
* @param {boolean} autoLaunched
* @param {string} disableStr
* @param {string} enableStr
* @return {string}
* @private
*/
getAutoLaunchButtonLabel_: function(autoLaunched, disableStr, enableStr) {
return autoLaunched ? disableStr : enableStr;
},
/**
* @param {!Event} e
* @private
*/
stopPropagation_: function(e) {
e.stopPropagation();
},
});
return {
KioskDialog: KioskDialog,
};
});
......@@ -24,6 +24,11 @@
<link rel="import" href="chrome://extensions/view_manager.html">
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<if expr="chromeos">
<link rel="import" href="chrome://extensions/kiosk_browser_proxy.html">
<link rel="import" href="chrome://extensions/kiosk_dialog.html">
</if>
<dom-module id="extensions-manager">
<template>
<style include="cr-shared-style">
......@@ -60,7 +65,12 @@
<extensions-toolbar in-dev-mode="[[inDevMode]]"
on-pack-tap="onPackTap_" delegate="[[delegate]]"
on-cr-toolbar-menu-tap="onMenuButtonTap_"
on-search-changed="onFilterChanged_">
on-search-changed="onFilterChanged_"
<if expr="chromeos">
on-kiosk-tap="onKioskTap_"
kiosk-enabled="[[kioskEnabled_]]"
</if>
>
</extensions-toolbar>
<dialog id="drawer" is="cr-drawer" align="$i18n{textdirection}">
<div class="drawer-content">
......@@ -91,6 +101,13 @@
</extensions-pack-dialog>
<extensions-load-error id="load-error" delegate="[[delegate]]">
</extensions-load-error>
<if expr="chromeos">
<template is="dom-if" if="[[showKioskDialog_]]" restamp>
<extensions-kiosk-dialog id="kiosk-dialog"
on-close="onKioskDialogClose_">
</extensions-kiosk-dialog>
</template>
</if>
</div>
</template>
<script src="chrome://extensions/manager.js"></script>
......
......@@ -101,6 +101,20 @@ cr.define('extensions', function() {
type: Boolean,
value: false,
},
// <if expr="chromeos">
/** @private */
kioskEnabled_: {
type: Boolean,
value: false,
},
/** @private */
showKioskDialog_: {
type: Boolean,
value: false,
},
// </if>
},
/**
......@@ -110,10 +124,12 @@ cr.define('extensions', function() {
*/
currentPage_: null,
/** @override */
created: function() {
this.readyPromiseResolver = new PromiseResolver();
},
/** @override */
ready: function() {
this.toolbar =
/** @type {extensions.Toolbar} */ (this.$$('extensions-toolbar'));
......@@ -121,6 +137,14 @@ cr.define('extensions', function() {
extensions.navigation.onRouteChanged(newPage => {
this.changePage_(newPage);
});
// <if expr="chromeos">
extensions.KioskBrowserProxyImpl.getInstance()
.initializeKioskAppSettings()
.then(params => {
this.kioskEnabled_ = params.kioskEnabled;
});
// </if>
},
get keyboardShortcuts() {
......@@ -336,6 +360,17 @@ cr.define('extensions', function() {
this.$['pack-dialog'].show();
},
// <if expr="chromeos">
/** @private */
onKioskTap_: function() {
this.showKioskDialog_ = true;
},
onKioskDialogClose_: function() {
this.showKioskDialog_ = false;
},
// </if>
/**
* @param {!extensions.ShowingType} listType
* @private
......
......@@ -84,6 +84,12 @@
<paper-button id="update-now" on-tap="onUpdateNowTap_">
$i18n{toolbarUpdateNow}
</paper-button>
<if expr="chromeos">
<paper-button id="kiosk-extensions" on-tap="onKioskTap_"
hidden$="[[!kioskEnabled]]">
$i18n{manageKioskApp}
</paper-button>
</if>
</div>
</div>
</template>
......
......@@ -35,6 +35,10 @@ cr.define('extensions', function() {
type: Boolean,
value: false,
},
// <if expr="chromeos">
kioskEnabled: Boolean,
// </if>
},
/** @private */
......@@ -52,6 +56,13 @@ cr.define('extensions', function() {
this.fire('pack-tap');
},
// <if expr="chromeos">
/** @private */
onKioskTap_: function() {
this.fire('kiosk-tap');
},
// </if>
/** @private */
onUpdateNowTap_: function() {
this.delegate.updateAllExtensions();
......
......@@ -108,9 +108,12 @@ content::WebUIDataSource* CreateMdExtensionsSource() {
source->SetJsonPath("strings.js");
// Add common strings.
source->AddLocalizedString("add", IDS_ADD);
source->AddLocalizedString("cancel", IDS_CANCEL);
source->AddLocalizedString("close", IDS_CLOSE);
source->AddLocalizedString("confirm", IDS_CONFIRM);
source->AddLocalizedString("done", IDS_DONE);
source->AddLocalizedString("ok", IDS_OK);
source->AddLocalizedString("cancel", IDS_CANCEL);
// Add extension-specific strings.
source->AddLocalizedString("title",
......@@ -253,6 +256,32 @@ content::WebUIDataSource* CreateMdExtensionsSource() {
IDS_EXTENSIONS_VIEW_INACTIVE);
source->AddLocalizedString("viewIframe",
IDS_EXTENSIONS_VIEW_IFRAME);
#if defined(OS_CHROMEOS)
source->AddLocalizedString("manageKioskApp",
IDS_MD_EXTENSIONS_MANAGE_KIOSK_APP);
source->AddLocalizedString("kioskAddApp", IDS_MD_EXTENSIONS_KIOSK_ADD_APP);
source->AddLocalizedString("kioskAddAppHint",
IDS_MD_EXTENSIONS_KIOSK_ADD_APP_HINT);
source->AddLocalizedString("kioskEnableAutoLaunch",
IDS_MD_EXTENSIONS_KIOSK_ENABLE_AUTO_LAUNCH);
source->AddLocalizedString("kioskDisableAutoLaunch",
IDS_MD_EXTENSIONS_KIOSK_DISABLE_AUTO_LAUNCH);
source->AddLocalizedString("kioskAutoLaunch",
IDS_MD_EXTENSIONS_KIOSK_AUTO_LAUNCH);
source->AddLocalizedString("kioskInvalidApp",
IDS_MD_EXTENSIONS_KIOSK_INVALID_APP);
source->AddLocalizedString(
"kioskDisableBailout",
IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_LABEL);
source->AddLocalizedString(
"kioskDisableBailoutWarningTitle",
IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_TITLE);
source->AddString(
"kioskDisableBailoutWarningBody",
l10n_util::GetStringFUTF16(
IDS_MD_EXTENSIONS_KIOSK_DISABLE_BAILOUT_SHORTCUT_WARNING_BODY,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME)));
#endif
source->AddString(
"getMoreExtensionsUrl",
base::ASCIIToUTF16(
......@@ -280,6 +309,15 @@ content::WebUIDataSource* CreateMdExtensionsSource() {
IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML);
source->AddResourcePath("keyboard_shortcuts.js",
IDR_MD_EXTENSIONS_KEYBOARD_SHORTCUTS_JS);
#if defined(OS_CHROMEOS)
source->AddResourcePath("kiosk_browser_proxy.html",
IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_HTML);
source->AddResourcePath("kiosk_browser_proxy.js",
IDR_MD_EXTENSIONS_KIOSK_BROWSER_PROXY_JS);
source->AddResourcePath("kiosk_dialog.html",
IDR_MD_EXTENSIONS_KIOSK_DIALOG_HTML);
source->AddResourcePath("kiosk_dialog.js", IDR_MD_EXTENSIONS_KIOSK_DIALOG_JS);
#endif
source->AddResourcePath("manager.html", IDR_MD_EXTENSIONS_MANAGER_HTML);
source->AddResourcePath("manager.js", IDR_MD_EXTENSIONS_MANAGER_JS);
source->AddResourcePath("icons.html", IDR_MD_EXTENSIONS_ICONS_HTML);
......@@ -380,18 +418,18 @@ ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
web_ui->AddMessageHandler(std::move(install_extension_handler));
install_handler->GetLocalizedValues(source);
#if defined(OS_CHROMEOS)
auto kiosk_app_handler = base::MakeUnique<chromeos::KioskAppsHandler>(
chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
profile));
chromeos::KioskAppsHandler* kiosk_handler = kiosk_app_handler.get();
web_ui->AddMessageHandler(std::move(kiosk_app_handler));
kiosk_handler->GetLocalizedValues(source);
#endif
web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>());
}
#if defined(OS_CHROMEOS)
auto kiosk_app_handler = base::MakeUnique<chromeos::KioskAppsHandler>(
chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
profile));
chromeos::KioskAppsHandler* kiosk_handler = kiosk_app_handler.get();
web_ui->AddMessageHandler(std::move(kiosk_app_handler));
kiosk_handler->GetLocalizedValues(source);
#endif
// Need to allow <object> elements so that the <extensionoptions> browser
// plugin can be loaded within chrome://extensions.
source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment