// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-<include src="../uber/uber_utils.js"></include>
-<include src="extension_code.js"></include>
-<include src="extension_commands_overlay.js"></include>
-<include src="extension_focus_manager.js"></include>
-<include src="extension_list.js"></include>
-<include src="pack_extension_overlay.js"></include>
-<include src="extension_error_overlay.js"></include>
-<include src="extension_loader.js"></include>
+<include src="../uber/uber_utils.js">
+<include src="extension_code.js">
+<include src="extension_commands_overlay.js">
+<include src="extension_error_overlay.js">
+<include src="extension_focus_manager.js">
+<include src="extension_list.js">
+<include src="pack_extension_overlay.js">
+<include src="extension_loader.js">
+<include src="extension_options_overlay.js">
<if expr="chromeos">
-<include src="chromeos/kiosk_apps.js"></include>
+<include src="chromeos/kiosk_apps.js">
</if>
+/**
+ * The type of the extension data object. The definition is based on
+ * chrome/browser/ui/webui/extensions/extension_settings_handler.cc:
+ * ExtensionSettingsHandler::HandleRequestExtensionsData()
+ * @typedef {{developerMode: boolean,
+ * extensions: Array,
+ * incognitoAvailable: boolean,
+ * loadUnpackedDisabled: boolean,
+ * profileIsSupervised: boolean,
+ * promoteAppsDevTools: boolean}}
+ */
+var ExtensionDataResponse;
+
// Used for observing function of the backend datasource for this page by
// tests.
var webuiResponded = false;
}
// Only process files that look like extensions. Other files should
// navigate the browser normally.
- if (!toSend && /\.(crx|user\.js)$/i.test(e.dataTransfer.files[0].name))
+ if (!toSend &&
+ /\.(crx|user\.js|zip)$/i.test(e.dataTransfer.files[0].name)) {
toSend = 'installDroppedFile';
+ }
if (toSend) {
e.preventDefault();
measureCheckboxStrings();
// Set the title.
- var title = loadTimeData.getString('extensionSettings');
- uber.invokeMethodOnParent('setTitle', {title: title});
+ uber.setTitle(loadTimeData.getString('extensionSettings'));
// This will request the data to show on the page and will get a response
// back in returnExtensionsData.
extensions.ExtensionErrorOverlay.getInstance().initializePage(
extensions.ExtensionSettings.showOverlay);
+ extensions.ExtensionOptionsOverlay.getInstance().initializePage(
+ extensions.ExtensionSettings.showOverlay);
+
// Initialize the kiosk overlay.
if (cr.isChromeOS) {
var kioskOverlay = extensions.KioskAppsOverlay.getInstance();
} else {
$('extension-settings').classList.remove('dev-mode');
}
- window.setTimeout(this.updatePromoVisibility_.bind(this));
+ window.setTimeout(this.updatePromoVisibility_.bind(this), 0);
chrome.send('extensionSettingsToggleDeveloperMode');
},
/**
* Called by the dom_ui_ to re-populate the page with data representing
* the current state of installed extensions.
+ * @param {ExtensionDataResponse} extensionsData
*/
ExtensionSettings.returnExtensionsData = function(extensionsData) {
// We can get called many times in short order, thus we need to
var pageDiv = $('extension-settings');
var marginTop = 0;
- if (extensionsData.profileIsManaged) {
- pageDiv.classList.add('profile-is-managed');
+ if (extensionsData.profileIsSupervised) {
+ pageDiv.classList.add('profile-is-supervised');
} else {
- pageDiv.classList.remove('profile-is-managed');
+ pageDiv.classList.remove('profile-is-supervised');
}
- if (extensionsData.profileIsManaged) {
+ if (extensionsData.profileIsSupervised) {
pageDiv.classList.add('showing-banner');
$('toggle-dev-on').disabled = true;
marginTop += 45;
ExtensionsList.prototype.data_ = extensionsData;
var extensionList = $('extension-settings-list');
ExtensionsList.decorate(extensionList);
- }
+ };
// Indicate that warning |message| has occured for pack of |crx_path| and
// |pem_path| files. Ask if user wants override the warning. Send
},
closeAlert);
ExtensionSettings.showOverlay($('alertOverlay'));
- }
+ };
/**
* Returns the current overlay or null if one does not exist.
*/
ExtensionSettings.getCurrentOverlay = function() {
return document.querySelector('#overlay .page.showing');
- }
+ };
/**
* Sets the given overlay to show. This hides whatever overlay is currently
pages[i].setAttribute('aria-hidden', node ? 'true' : 'false');
}
- overlay.hidden = !node;
+ $('overlay').hidden = !node;
uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' :
'stopInterceptingEvents');
- }
+ };
/**
* Utility function to find the width of various UI strings and synchronize
var measuringDiv = $('font-measuring-div');
measuringDiv.textContent =
loadTimeData.getString('extensionSettingsEnabled');
+ measuringDiv.className = 'enabled-text';
var pxWidth = measuringDiv.clientWidth + trashWidth;
measuringDiv.textContent =
loadTimeData.getString('extensionSettingsEnable');
+ measuringDiv.className = 'enable-text';
pxWidth = Math.max(measuringDiv.clientWidth + trashWidth, pxWidth);
measuringDiv.textContent =
loadTimeData.getString('extensionSettingsDeveloperMode');
+ measuringDiv.className = '';
pxWidth = Math.max(measuringDiv.clientWidth, pxWidth);
var style = document.createElement('style');
' min-width: ' + pxWidth + 'px;' +
'}';
document.querySelector('head').appendChild(style);
- }
+ };
// Export
return {