diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 10:22:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 12:36:28 +0000 |
commit | 271a6c3487a14599023a9106329505597638d793 (patch) | |
tree | e040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/chrome/browser/resources/management | |
parent | 7b2ffa587235a47d4094787d72f38102089f402a (diff) |
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/management')
5 files changed, 323 insertions, 314 deletions
diff --git a/chromium/chrome/browser/resources/management/icons.html b/chromium/chrome/browser/resources/management/icons.html index dc4ca72a8f0..2311bf2ec29 100644 --- a/chromium/chrome/browser/resources/management/icons.html +++ b/chromium/chrome/browser/resources/management/icons.html @@ -12,6 +12,7 @@ <g id="report"><path d="M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.73 3zM12 17.3c-.72 0-1.3-.58-1.3-1.3 0-.72.58-1.3 1.3-1.3.72 0 1.3.58 1.3 1.3 0 .72-.58 1.3-1.3 1.3zm1-4.3h-2V7h2v6z"></path></g> <g id="supervised-user"><path d="M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm3.61 6.34c1.07 0 1.93.86 1.93 1.93 0 1.07-.86 1.93-1.93 1.93-1.07 0-1.93-.86-1.93-1.93-.01-1.07.86-1.93 1.93-1.93zm-6-1.58c1.3 0 2.36 1.06 2.36 2.36 0 1.3-1.06 2.36-2.36 2.36s-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36zm0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68zM11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09z"></path></g> <g id="timelapse"><path d="M16.24 7.76C15.07 6.59 13.54 6 12 6v6l-4.24 4.24c2.34 2.34 6.14 2.34 8.49 0 2.34-2.34 2.34-6.14-.01-8.48zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g> + <g id="linux"><path d="M 6.9375 22.042969 C 3.867188 20.457031 1.886719 17.347656 1.824219 13.234375 C 1.527344 13.378906 1.1875 13.402344 0.800781 13.265625 C -0.3125 12.875 -0.0625 11.578125 0.34375 10.421875 C 0.683594 9.460938 1.835938 8.761719 2.402344 8.613281 C 3.71875 3.78125 6.804688 0 12 0 C 17.257812 0 20.367188 3.625 21.644531 8.628906 C 22.222656 8.796875 23.324219 9.484375 23.65625 10.421875 C 24.0625 11.578125 24.3125 12.875 23.199219 13.265625 C 22.8125 13.402344 22.472656 13.378906 22.175781 13.234375 C 22.117188 17.375 20.140625 20.472656 17.070312 22.046875 C 17.257812 22.191406 17.363281 22.375 17.363281 22.613281 C 17.363281 23.378906 17.75 24 14.898438 24 C 12.8125 24 12.457031 23.578125 12.417969 23.117188 C 12.28125 23.035156 12.140625 22.910156 12 22.910156 C 11.859375 22.910156 11.71875 23.042969 11.582031 23.128906 C 11.535156 23.582031 11.171875 24 9.101562 24 C 6.25 24 6.636719 23.378906 6.636719 22.613281 C 6.636719 22.371094 6.746094 22.183594 6.9375 22.042969 Z M 12 21.222656 C 17.929688 21.222656 20.070312 17.1875 20.070312 11.820312 C 20.070312 7.371094 18.125 3.28125 14.898438 2.597656 C 13.863281 2.378906 13.136719 4.761719 12 4.761719 C 10.863281 4.761719 10.035156 2.378906 9.101562 2.597656 C 5.863281 3.359375 3.929688 7.605469 3.929688 11.820312 C 3.929688 16.882812 6.070312 21.222656 12 21.222656 Z M 8.277344 9.324219 C 7.589844 9.324219 7.035156 8.789062 7.035156 8.132812 C 7.035156 7.476562 7.589844 6.941406 8.277344 6.941406 C 8.960938 6.941406 9.515625 7.476562 9.515625 8.132812 C 9.515625 8.789062 8.960938 9.324219 8.277344 9.324219 Z M 15.722656 9.324219 C 15.039062 9.324219 14.484375 8.789062 14.484375 8.132812 C 14.484375 7.476562 15.039062 6.941406 15.722656 6.941406 C 16.410156 6.941406 16.964844 7.476562 16.964844 8.132812 C 16.964844 8.789062 16.410156 9.324219 15.722656 9.324219 Z M 12.226562 9.964844 L 13.929688 10.683594 C 14.222656 10.804688 14.355469 11.132812 14.226562 11.414062 C 14.199219 11.46875 14.164062 11.519531 14.121094 11.5625 L 12.425781 13.308594 C 12.210938 13.535156 11.839844 13.546875 11.601562 13.339844 C 11.589844 13.332031 11.578125 13.320312 11.566406 13.308594 L 9.878906 11.558594 C 9.660156 11.332031 9.675781 10.980469 9.914062 10.773438 C 9.960938 10.734375 10.011719 10.703125 10.070312 10.679688 L 11.75 9.964844 C 11.898438 9.902344 12.074219 9.902344 12.226562 9.964844 Z M 12.226562 9.964844"></path></g> </if> <g id="account-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path><path d="M0 0h24v24H0z" fill="none"></path></g> <g id="public"><path d="M0 0h24v24H0z" fill="none"></path><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"></path></g> diff --git a/chromium/chrome/browser/resources/management/management.html b/chromium/chrome/browser/resources/management/management.html index 62a62bf9147..8b4f15545d9 100644 --- a/chromium/chrome/browser/resources/management/management.html +++ b/chromium/chrome/browser/resources/management/management.html @@ -1,6 +1,5 @@ <!doctype html> -<html dir="$i18n{textdirection}" lang="$i18n{language}" class="loading" - $i18n{dark}> +<html dir="$i18n{textdirection}" lang="$i18n{language}" class="loading"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=yes"> diff --git a/chromium/chrome/browser/resources/management/management_browser_proxy.js b/chromium/chrome/browser/resources/management/management_browser_proxy.js index 3d73753a3e6..0633bdcb930 100644 --- a/chromium/chrome/browser/resources/management/management_browser_proxy.js +++ b/chromium/chrome/browser/resources/management/management_browser_proxy.js @@ -2,69 +2,69 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -cr.exportPath('management'); -/** - * @typedef {{ - * name: string, - * permissions: !Array<string> - * }} - */ -management.Extension; - -/** @enum {string} */ -management.ReportingType = { - SECURITY: 'security', - DEVICE: 'device', - USER: 'user', - USER_ACTIVITY: 'user-activity', - EXTENSIONS: 'extensions' -}; - -/** - * @typedef {{ - * messageId: string, - * reportingType: !management.ReportingType, - * }} - */ -management.BrowserReportingResponse; - -/** - * @typedef {{ - * browserManagementNotice: string, - * extensionReportingTitle: string, - * pageSubtitle: string, - * managed: boolean, - * overview: string, - * customerLogo: string, - * }} - */ -management.ManagedDataResponse; - -// <if expr="chromeos"> -/** - * @enum {string} Look at ToJSDeviceReportingType usage in - * management_ui_handler.cc for more details. - */ -management.DeviceReportingType = { - SUPERVISED_USER: 'supervised user', - DEVICE_ACTIVITY: 'device activity', - STATISTIC: 'device statistics', - DEVICE: 'device', - LOGS: 'logs', - PRINT: 'print' -}; - - -/** - * @typedef {{ - * messageId: string, - * reportingType: !management.DeviceReportingType, - * }} - */ -management.DeviceReportingResponse; -// </if> - cr.define('management', function() { + /** + * @typedef {{ + * name: string, + * permissions: !Array<string> + * }} + */ + let Extension; + + /** @enum {string} */ + const ReportingType = { + SECURITY: 'security', + DEVICE: 'device', + USER: 'user', + USER_ACTIVITY: 'user-activity', + EXTENSIONS: 'extensions' + }; + + /** + * @typedef {{ + * messageId: string, + * reportingType: !management.ReportingType, + * }} + */ + let BrowserReportingResponse; + + /** + * @typedef {{ + * browserManagementNotice: string, + * extensionReportingTitle: string, + * pageSubtitle: string, + * managed: boolean, + * overview: string, + * customerLogo: string, + * }} + */ + let ManagedDataResponse; + + // <if expr="chromeos"> + /** + * @enum {string} Look at ToJSDeviceReportingType usage in + * management_ui_handler.cc for more details. + */ + const DeviceReportingType = { + SUPERVISED_USER: 'supervised user', + DEVICE_ACTIVITY: 'device activity', + STATISTIC: 'device statistics', + DEVICE: 'device', + LOGS: 'logs', + PRINT: 'print', + CROSTINI: 'crostini' + }; + + + /** + * @typedef {{ + * messageId: string, + * reportingType: !management.DeviceReportingType, + * }} + */ + let DeviceReportingResponse; + // </if> + /** @interface */ class ManagementBrowserProxy { /** @return {!Promise<!Array<!management.Extension>>} */ @@ -127,7 +127,15 @@ cr.define('management', function() { cr.addSingletonGetter(ManagementBrowserProxyImpl); return { + BrowserReportingResponse: BrowserReportingResponse, + // <if expr="chromeos"> + DeviceReportingResponse: DeviceReportingResponse, + DeviceReportingType: DeviceReportingType, + // </if> + Extension: Extension, + ManagedDataResponse: ManagedDataResponse, + ManagementBrowserProxyImpl: ManagementBrowserProxyImpl, ManagementBrowserProxy: ManagementBrowserProxy, - ManagementBrowserProxyImpl: ManagementBrowserProxyImpl + ReportingType: ReportingType, }; }); diff --git a/chromium/chrome/browser/resources/management/management_ui.html b/chromium/chrome/browser/resources/management/management_ui.html index ee5a1aa1b05..725e38c4263 100644 --- a/chromium/chrome/browser/resources/management/management_ui.html +++ b/chromium/chrome/browser/resources/management/management_ui.html @@ -2,6 +2,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html"> +<link rel="import" href="chrome://resources/cr_elements/cr_page_host_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toolbar/cr_toolbar.html"> <link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> @@ -14,9 +15,9 @@ <dom-module id="management-ui"> <template> - <style include="cr-icons cr-hidden-style"> + <style include="cr-icons cr-hidden-style cr-page-host-style + cr-shared-style"> :host { - @apply --cr-page-host; color: var(--cr-secondary-text-color); display: flex; flex-direction: column; @@ -92,15 +93,6 @@ font-weight: 500; } - h2 { - @apply --cr-title-text; - font-size: 13px; - } - - .page-subtitle h2 { - font-size: 14px; - } - .subtitle { margin-top: 16px; } @@ -116,6 +108,7 @@ } section:not(.page-subtitle) h2 { + font-size: 100%; margin: 0; } @@ -190,7 +183,7 @@ <cr-icon-button class="icon-arrow-back" id="closeButton" on-click="onTapBack_" aria-label="$i18n{backButton}"> </cr-icon-button> - <h2> + <h2 class="cr-title-text"> [[subtitle_]] </h2> </section> @@ -209,7 +202,7 @@ <if expr="chromeos"> <div hidden="[[!localTrustRoots_]]"> <section> - <h2>$i18n{localTrustRoots}</h2> + <h2 class="cr-title-text">$i18n{localTrustRoots}</h2> <div class="subtitle" id="trust-roots-configuration"> [[localTrustRoots_]]</div> </section> @@ -217,7 +210,7 @@ <template is="dom-if" if="[[showDeviceReportingInfo_(deviceReportingInfo_)]]"> <section> - <h2>$i18n{deviceReporting}</h2> + <h2 class="cr-title-text">$i18n{deviceReporting}</h2> <div class="subtitle"> $i18n{deviceConfiguration} </div> @@ -237,7 +230,7 @@ <template is="dom-if" if="[[showBrowserReportingInfo_(browserReportingInfo_)]]"> <section> - <h2>$i18n{browserReporting}</h2> + <h2 class="cr-title-text">$i18n{browserReporting}</h2> <div class="subtitle"> $i18n{browserReportingExplanation} </div> @@ -260,7 +253,7 @@ <template is="dom-if" if="[[showExtensionReportingInfo_(extensions_)]]"> <section class="extension-reporting"> - <h2>$i18n{extensionReporting}</h2> + <h2 class="cr-title-text">$i18n{extensionReporting}</h2> <div class="subtitle"> [[extensionReportingSubtitle_]] </div> 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<string>, - * icon: string, - * }} - */ -management.BrowserReportingData; - -Polymer({ - is: 'management-ui', - - behaviors: [ - I18nBehavior, - WebUIListenerBehavior, - ], - - properties: { - /** - * List of messages related to browser reporting. - * @private {?Array<!management.BrowserReportingData>} - */ - browserReportingInfo_: Array, +cr.define('management', function() { + /** + * @typedef {{ + * messageIds: !Array<string>, + * icon: string, + * }} + */ + let BrowserReportingData; - /** - * List of messages related to browser reporting. - * @private {?Array<!management.Extension>} - */ - extensions_: Array, + Polymer({ + is: 'management-ui', - // <if expr="chromeos"> - /** - * List of messages related to device reporting. - * @private {?Array<!management.DeviceReportingResponse>} - */ - 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<!management.BrowserReportingData>} + */ + browserReportingInfo_: Array, - /** @private */ - customerLogo_: String, + /** + * List of messages related to browser reporting. + * @private {?Array<!management.Extension>} + */ + extensions_: Array, - /** @private */ - managementOverview_: String, + // <if expr="chromeos"> + /** + * List of messages related to device reporting. + * @private {?Array<!management.DeviceReportingResponse>} + */ + deviceReportingInfo_: Array, - // </if> + /** + * Message stating if the Trust Roots are configured. + * @private + */ + localTrustRoots_: String, - /** @private */ - subtitle_: String, + /** @private */ + customerLogo_: String, - // <if expr="not chromeos"> - /** @private */ - managementNoticeHtml_: String, - // </if> + /** @private */ + managementOverview_: String, - /** @private */ - managed_: Boolean, + // </if> - /** @private */ - extensionReportingSubtitle_: String, - }, + /** @private */ + subtitle_: String, + + // <if expr="not chromeos"> + /** @private */ + managementNoticeHtml_: String, + // </if> - /** @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_(); - // <if expr="chromeos"> - this.getDeviceReportingInfo_(); - this.getLocalTrustRootsInfo_(); - // </if> - }, + 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<!management.BrowserReportingResponse>} reportingInfo - * @private - */ - onBrowserReportingInfoReceived_(reportingInfo) { - const reportingInfoMap = reportingInfo.reduce((info, response) => { - info[response.reportingType] = info[response.reportingType] || { - icon: this.getIconForReportingType_(response.reportingType), - messageIds: [] + this.getExtensions_(); + // <if expr="chromeos"> + this.getDeviceReportingInfo_(); + this.getLocalTrustRootsInfo_(); + // </if> + }, + + /** @private */ + initBrowserReportingInfo_() { + this.browserProxy_.initBrowserReportingInfo().then( + reportingInfo => this.onBrowserReportingInfoReceived_(reportingInfo)); + }, + + /** + * @param {!Array<!management.BrowserReportingResponse>} 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; - }); - }, - - // <if expr="chromeos"> - /** @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'; - } - }, - // </if> + /** @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; - }, + // <if expr="chromeos"> + /** @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<string>} 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; - // <if expr="chromeos"> - this.customerLogo_ = data.customerLogo; - this.managementOverview_ = data.overview; - // </if> - // <if expr="not chromeos"> - this.managementNoticeHtml_ = data.browserManagementNotice; - // </if> - }); - }, + /** + * @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'; + } + }, + // </if> + + /** + * @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<string>} 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; + // <if expr="chromeos"> + this.customerLogo_ = data.customerLogo; + this.managementOverview_ = data.overview; + // </if> + // <if expr="not chromeos"> + this.managementNoticeHtml_ = data.browserManagementNotice; + // </if> + }); + }, + }); + + return { + BrowserReportingData: BrowserReportingData, + }; }); |