// Copyright 2015 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() { /** @interface */ class ItemDelegate { /** @param {string} id */ deleteItem(id) {} /** * @param {string} id * @param {boolean} isEnabled */ setItemEnabled(id, isEnabled) {} /** * @param {string} id * @param {boolean} isAllowedIncognito */ setItemAllowedIncognito(id, isAllowedIncognito) {} /** * @param {string} id * @param {boolean} isAllowedOnFileUrls */ setItemAllowedOnFileUrls(id, isAllowedOnFileUrls) {} /** * @param {string} id * @param {!chrome.developerPrivate.HostAccess} hostAccess */ setItemHostAccess(id, hostAccess) {} /** * @param {string} id * @param {boolean} collectsErrors */ setItemCollectsErrors(id, collectsErrors) {} /** * @param {string} id * @param {chrome.developerPrivate.ExtensionView} view */ inspectItemView(id, view) {} /** * @param {string} url */ openUrl(url) {} /** * @param {string} id * @return {!Promise} */ reloadItem(id) {} /** @param {string} id */ repairItem(id) {} /** @param {!chrome.developerPrivate.ExtensionInfo} extension */ showItemOptionsPage(extension) {} /** @param {string} id */ showInFolder(id) {} /** * @param {string} id * @return {!Promise} */ getExtensionSize(id) {} /** * @param {string} id * @param {string} host * @return {!Promise} */ addRuntimeHostPermission(id, host) {} /** * @param {string} id * @param {string} host * @return {!Promise} */ removeRuntimeHostPermission(id, host) {} } const Item = Polymer({ is: 'extensions-item', behaviors: [I18nBehavior, extensions.ItemBehavior], properties: { // The item's delegate, or null. delegate: { type: Object, }, // Whether or not dev mode is enabled. inDevMode: { type: Boolean, value: false, }, // The underlying ExtensionInfo itself. Public for use in declarative // bindings. /** @type {chrome.developerPrivate.ExtensionInfo} */ data: { type: Object, }, // Whether or not the expanded view of the item is shown. /** @private */ showingDetails_: { type: Boolean, value: false, }, }, /** Prevents reloading the same item while it's already being reloaded. */ isReloading_: false, observers: [ 'observeIdVisibility_(inDevMode, showingDetails_, data.id)', ], /** @return {!HTMLElement} The "Details" button. */ getDetailsButton: function() { return this.$.detailsButton; }, /** @return {?HTMLElement} The "Errors" button, if it exists. */ getErrorsButton: function() { return /** @type {?HTMLElement} */ (this.$$('#errors-button')); }, /** @private string */ a11yAssociation_: function() { // Don't use I18nBehavior.i18n because of additional checks it performs. // Polymer ensures that this string is not stamped into arbitrary HTML. // |this.data.name| can contain any data including html tags. // ex: "My