From 271a6c3487a14599023a9106329505597638d793 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 30 Aug 2019 10:22:43 +0200 Subject: BASELINE: Update Chromium to 77.0.3865.59 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21 Reviewed-by: Michael BrĂ¼ning --- .../browser/resources/management/management_ui.js | 474 +++++++++++---------- 1 file changed, 241 insertions(+), 233 deletions(-) (limited to 'chromium/chrome/browser/resources/management/management_ui.js') diff --git a/chromium/chrome/browser/resources/management/management_ui.js b/chromium/chrome/browser/resources/management/management_ui.js index afc2712d517..a4984aa83d7 100644 --- a/chromium/chrome/browser/resources/management/management_ui.js +++ b/chromium/chrome/browser/resources/management/management_ui.js @@ -2,262 +2,270 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -cr.exportPath('management'); -/** - * @typedef {{ - * messageIds: !Array, - * icon: string, - * }} - */ -management.BrowserReportingData; - -Polymer({ - is: 'management-ui', - - behaviors: [ - I18nBehavior, - WebUIListenerBehavior, - ], - - properties: { - /** - * List of messages related to browser reporting. - * @private {?Array} - */ - browserReportingInfo_: Array, +cr.define('management', function() { + /** + * @typedef {{ + * messageIds: !Array, + * icon: string, + * }} + */ + let BrowserReportingData; - /** - * List of messages related to browser reporting. - * @private {?Array} - */ - extensions_: Array, + Polymer({ + is: 'management-ui', - // - /** - * List of messages related to device reporting. - * @private {?Array} - */ - deviceReportingInfo_: Array, + behaviors: [ + I18nBehavior, + WebUIListenerBehavior, + ], - /** - * Message stating if the Trust Roots are configured. - * @private - */ - localTrustRoots_: String, + properties: { + /** + * List of messages related to browser reporting. + * @private {?Array} + */ + browserReportingInfo_: Array, - /** @private */ - customerLogo_: String, + /** + * List of messages related to browser reporting. + * @private {?Array} + */ + extensions_: Array, - /** @private */ - managementOverview_: String, + // + /** + * List of messages related to device reporting. + * @private {?Array} + */ + deviceReportingInfo_: Array, - // + /** + * Message stating if the Trust Roots are configured. + * @private + */ + localTrustRoots_: String, - /** @private */ - subtitle_: String, + /** @private */ + customerLogo_: String, - // - /** @private */ - managementNoticeHtml_: String, - // + /** @private */ + managementOverview_: String, - /** @private */ - managed_: Boolean, + // - /** @private */ - extensionReportingSubtitle_: String, - }, + /** @private */ + subtitle_: String, + + // + /** @private */ + managementNoticeHtml_: String, + // - /** @private {?management.ManagementBrowserProxy} */ - browserProxy_: null, + /** @private */ + managed_: Boolean, - /** @override */ - attached() { - document.documentElement.classList.remove('loading'); - this.browserProxy_ = management.ManagementBrowserProxyImpl.getInstance(); - this.updateManagedFields_(); - this.initBrowserReportingInfo_(); + /** @private */ + extensionReportingSubtitle_: String, + }, - this.addWebUIListener( - 'browser-reporting-info-updated', - reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); + /** @private {?management.ManagementBrowserProxy} */ + browserProxy_: null, - this.addWebUIListener('managed_data_changed', () => { + /** @override */ + attached() { + document.documentElement.classList.remove('loading'); + this.browserProxy_ = management.ManagementBrowserProxyImpl.getInstance(); this.updateManagedFields_(); - }); + this.initBrowserReportingInfo_(); - this.getExtensions_(); - // - this.getDeviceReportingInfo_(); - this.getLocalTrustRootsInfo_(); - // - }, + this.addWebUIListener( + 'browser-reporting-info-updated', + reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); - /** @private */ - initBrowserReportingInfo_() { - this.browserProxy_.initBrowserReportingInfo().then( - reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); - }, + this.addWebUIListener('managed_data_changed', () => { + this.updateManagedFields_(); + }); - /** - * @param {!Array} reportingInfo - * @private - */ - onBrowserReportingInfoReceived_(reportingInfo) { - const reportingInfoMap = reportingInfo.reduce((info, response) => { - info[response.reportingType] = info[response.reportingType] || { - icon: this.getIconForReportingType_(response.reportingType), - messageIds: [] + this.getExtensions_(); + // + this.getDeviceReportingInfo_(); + this.getLocalTrustRootsInfo_(); + // + }, + + /** @private */ + initBrowserReportingInfo_() { + this.browserProxy_.initBrowserReportingInfo().then( + reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); + }, + + /** + * @param {!Array} reportingInfo + * @private + */ + onBrowserReportingInfoReceived_(reportingInfo) { + const reportingInfoMap = reportingInfo.reduce((info, response) => { + info[response.reportingType] = info[response.reportingType] || { + icon: this.getIconForReportingType_(response.reportingType), + messageIds: [] + }; + info[response.reportingType].messageIds.push(response.messageId); + return info; + }, {}); + + const reportingTypeOrder = { + [management.ReportingType.SECURITY]: 1, + [management.ReportingType.EXTENSIONS]: 2, + [management.ReportingType.USER]: 3, + [management.ReportingType.USER_ACTIVITY]: 4, + [management.ReportingType.DEVICE]: 5, }; - info[response.reportingType].messageIds.push(response.messageId); - return info; - }, {}); - - const reportingTypeOrder = { - [management.ReportingType.SECURITY]: 1, - [management.ReportingType.EXTENSIONS]: 2, - [management.ReportingType.USER]: 3, - [management.ReportingType.USER_ACTIVITY]: 4, - [management.ReportingType.DEVICE]: 5, - }; - - this.browserReportingInfo_ = - Object.keys(reportingInfoMap) - .sort((a, b) => reportingTypeOrder[a] - reportingTypeOrder[b]) - .map(reportingType => reportingInfoMap[reportingType]); - }, - - /** @private */ - getExtensions_() { - this.browserProxy_.getExtensions().then(extensions => { - this.extensions_ = extensions; - }); - }, - - // - /** @private */ - getLocalTrustRootsInfo_() { - this.browserProxy_.getLocalTrustRootsInfo().then(trustRootsConfigured => { - this.localTrustRoots_ = trustRootsConfigured ? - loadTimeData.getString('managementTrustRootsConfigured') : - ''; - }); - }, - - /** @private */ - getDeviceReportingInfo_() { - this.browserProxy_.getDeviceReportingInfo().then(reportingInfo => { - this.deviceReportingInfo_ = reportingInfo; - }); - }, - /** - * @return {boolean} True of there are device reporting info to show. - * @private - */ - showDeviceReportingInfo_() { - return !!this.deviceReportingInfo_ && this.deviceReportingInfo_.length > 0; - }, + this.browserReportingInfo_ = + Object.keys(reportingInfoMap) + .sort((a, b) => reportingTypeOrder[a] - reportingTypeOrder[b]) + .map(reportingType => reportingInfoMap[reportingType]); + }, - /** - * @param {management.DeviceReportingType} reportingType - * @return {string} The associated icon. - * @private - */ - getIconForDeviceReportingType_(reportingType) { - switch (reportingType) { - case management.DeviceReportingType.SUPERVISED_USER: - return 'management:supervised-user'; - case management.DeviceReportingType.DEVICE_ACTIVITY: - return 'management:timelapse'; - case management.DeviceReportingType.STATISTIC: - return 'management:bar-chart'; - case management.DeviceReportingType.DEVICE: - return 'cr:computer'; - case management.DeviceReportingType.LOGS: - return 'management:report'; - case management.DeviceReportingType.PRINT: - return 'cr:print'; - default: - return 'cr:computer'; - } - }, - // + /** @private */ + getExtensions_() { + this.browserProxy_.getExtensions().then(extensions => { + this.extensions_ = extensions; + }); + }, - /** - * @return {boolean} True of there are browser reporting info to show. - * @private - */ - showBrowserReportingInfo_() { - return !!this.browserReportingInfo_ && - this.browserReportingInfo_.length > 0; - }, + // + /** @private */ + getLocalTrustRootsInfo_() { + this.browserProxy_.getLocalTrustRootsInfo().then(trustRootsConfigured => { + this.localTrustRoots_ = trustRootsConfigured ? + loadTimeData.getString('managementTrustRootsConfigured') : + ''; + }); + }, - /** - * @return {boolean} True of there are extension reporting info to show. - * @private - */ - showExtensionReportingInfo_() { - return !!this.extensions_ && this.extensions_.length > 0; - }, + /** @private */ + getDeviceReportingInfo_() { + this.browserProxy_.getDeviceReportingInfo().then(reportingInfo => { + this.deviceReportingInfo_ = reportingInfo; + }); + }, - /** - * @param {management.ReportingType} reportingType - * @returns {string} The associated icon. - * @private - */ - getIconForReportingType_(reportingType) { - switch (reportingType) { - case management.ReportingType.SECURITY: - return 'cr:security'; - case management.ReportingType.DEVICE: - return 'cr:computer'; - case management.ReportingType.EXTENSIONS: - return 'cr:extension'; - case management.ReportingType.USER: - return 'management:account-circle'; - case management.ReportingType.USER_ACTIVITY: - return 'management:public'; - default: - return 'cr:security'; - } - }, + /** + * @return {boolean} True of there are device reporting info to show. + * @private + */ + showDeviceReportingInfo_() { + return !!this.deviceReportingInfo_ && + this.deviceReportingInfo_.length > 0; + }, - /** - * Handles the 'search-changed' event fired from the toolbar. - * Redirects to the settings page initialized the the current - * search query. - * @param {!CustomEvent} e - * @private - */ - onSearchChanged_: function(e) { - const query = e.detail; - window.location.href = - `chrome://settings?search=${encodeURIComponent(query)}`; - }, - - /** @private */ - onTapBack_() { - if (history.length > 1) { - history.back(); - } else { - window.location.href = 'chrome://settings/help'; - } - }, - - /** @private */ - updateManagedFields_() { - this.browserProxy_.getContextualManagedData().then(data => { - this.managed_ = data.managed; - this.extensionReportingSubtitle_ = data.extensionReportingTitle; - this.subtitle_ = data.pageSubtitle; - // - this.customerLogo_ = data.customerLogo; - this.managementOverview_ = data.overview; - // - // - this.managementNoticeHtml_ = data.browserManagementNotice; - // - }); - }, + /** + * @param {management.DeviceReportingType} reportingType + * @return {string} The associated icon. + * @private + */ + getIconForDeviceReportingType_(reportingType) { + switch (reportingType) { + case management.DeviceReportingType.SUPERVISED_USER: + return 'management:supervised-user'; + case management.DeviceReportingType.DEVICE_ACTIVITY: + return 'management:timelapse'; + case management.DeviceReportingType.STATISTIC: + return 'management:bar-chart'; + case management.DeviceReportingType.DEVICE: + return 'cr:computer'; + case management.DeviceReportingType.LOGS: + return 'management:report'; + case management.DeviceReportingType.PRINT: + return 'cr:print'; + case management.DeviceReportingType.CROSTINI: + return 'management:linux'; + default: + return 'cr:computer'; + } + }, + // + + /** + * @return {boolean} True of there are browser reporting info to show. + * @private + */ + showBrowserReportingInfo_() { + return !!this.browserReportingInfo_ && + this.browserReportingInfo_.length > 0; + }, + + /** + * @return {boolean} True of there are extension reporting info to show. + * @private + */ + showExtensionReportingInfo_() { + return !!this.extensions_ && this.extensions_.length > 0; + }, + + /** + * @param {management.ReportingType} reportingType + * @returns {string} The associated icon. + * @private + */ + getIconForReportingType_(reportingType) { + switch (reportingType) { + case management.ReportingType.SECURITY: + return 'cr:security'; + case management.ReportingType.DEVICE: + return 'cr:computer'; + case management.ReportingType.EXTENSIONS: + return 'cr:extension'; + case management.ReportingType.USER: + return 'management:account-circle'; + case management.ReportingType.USER_ACTIVITY: + return 'management:public'; + default: + return 'cr:security'; + } + }, + + /** + * Handles the 'search-changed' event fired from the toolbar. + * Redirects to the settings page initialized the the current + * search query. + * @param {!CustomEvent} e + * @private + */ + onSearchChanged_: function(e) { + const query = e.detail; + window.location.href = + `chrome://settings?search=${encodeURIComponent(query)}`; + }, + + /** @private */ + onTapBack_() { + if (history.length > 1) { + history.back(); + } else { + window.location.href = 'chrome://settings/help'; + } + }, + + /** @private */ + updateManagedFields_() { + this.browserProxy_.getContextualManagedData().then(data => { + this.managed_ = data.managed; + this.extensionReportingSubtitle_ = data.extensionReportingTitle; + this.subtitle_ = data.pageSubtitle; + // + this.customerLogo_ = data.customerLogo; + this.managementOverview_ = data.overview; + // + // + this.managementNoticeHtml_ = data.browserManagementNotice; + // + }); + }, + }); + + return { + BrowserReportingData: BrowserReportingData, + }; }); -- cgit v1.2.3