Commit 62b27f8a authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

Moves policy webui resources to components/policy/resources/webui.

Resources in //components can be shared by desktop and iOS.

BUG=1027249

Change-Id: I8f262f7b5cba0bb500b596340b63ee518d6552f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929554
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719114}
parent 22d5de04
......@@ -216,10 +216,6 @@
<if expr="desktop_linux">
<include name="IDR_PLUGIN_DB_JSON" file="resources\plugin_metadata\plugins_linux.json" type="BINDATA" />
</if>
<include name="IDR_POLICY_CSS" file="resources\policy\policy.css" preprocess="true" type="BINDATA" compress="gzip" />
<include name="IDR_POLICY_HTML" file="resources\policy\policy.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_POLICY_BASE_JS" file="resources\policy\policy_base.js" type="BINDATA" compress="gzip" preprocess="true" />
<include name="IDR_POLICY_JS" file="resources\policy\policy.js" type="BINDATA" compress="gzip" />
<if expr="not is_android">
<include name="IDR_MANAGEMENT_HTML" file="resources\management\management.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_MANAGEMENT_UI_JS" file="${root_gen_dir}/chrome/browser/resources/management/management_ui.js" use_base_dir="false" type="BINDATA" compress="gzip" preprocess="true" />
......
file://chromeos/policy/OWNERS
# COMPONENT: Enterprise
\ No newline at end of file
......@@ -11,7 +11,7 @@
#include "chrome/browser/ui/webui/policy_ui_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "components/grit/components_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
......
......@@ -91,7 +91,7 @@ body > main {
white-space: pre-wrap;
}
<if expr="not is_android">
<if expr="not is_android and not is_ios">
.errors.row .name,
.warnings.row .name,
.conflict.row .name,
......@@ -182,7 +182,7 @@ a {
display: none;
}
<if expr="is_android">
<if expr="is_android or is_ios">
body > main {
padding: 0;
}
......
......@@ -8,6 +8,11 @@
<link rel="stylesheet" href="chrome://policy/policy.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<if expr="is_ios">
<!-- TODO(crbug.com/487000): Remove this once injected by web. -->
<script src="chrome://resources/js/ios/web_ui.js"></script>
</if>
<script src="chrome://resources/js/action_link.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/cr/ui.js"></script>
......
......@@ -125,12 +125,13 @@ cr.define('policy', function() {
this.setLabelAndShow_(
'.directory-api-id', status.directoryApiId || notSpecifiedString);
this.setLabelAndShow_('.client-id', status.clientId);
//For off-hours policy, indicate if it's active or not.
// For off-hours policy, indicate if it's active or not.
if (status.isOffHoursActive != null) {
this.setLabelAndShow_(
'.is-offhours-active',
loadTimeData.getString(
status.isOffHoursActive ? 'offHoursActive' : 'offHoursNotActive'));
status.isOffHoursActive ? 'offHoursActive' :
'offHoursNotActive'));
}
} else if (scope == 'machine') {
// For machine policy, set the appropriate title and populate
......@@ -495,29 +496,28 @@ cr.define('policy', function() {
* @private
*/
onPoliciesReceived_(policyNames, policyValues) {
/** @type {Array<!PolicyTableModel>} */ const policyGroups =
policyValues.map(value => {
const knownPolicyNames =
(policyNames[value.id] || policyNames.chrome).policyNames;
const knownPolicyNamesSet = new Set(knownPolicyNames);
const receivedPolicyNames = Object.keys(value.policies);
const allPolicyNames = Array.from(
new Set([...knownPolicyNames, ...receivedPolicyNames]));
const policies = allPolicyNames.map(
name => Object.assign(
{
name,
link:
knownPolicyNames === policyNames.chrome.policyNames &&
knownPolicyNamesSet.has(name) ?
`https://cloud.google.com/docs/chrome-enterprise/policies/?policy=${
name}` :
undefined,
},
value.policies[name]));
return {name: value.name, id: value.id, policies};
});
/** @type {Array<!PolicyTableModel>} */
const policyGroups = policyValues.map(value => {
const knownPolicyNames =
(policyNames[value.id] || policyNames.chrome).policyNames;
const knownPolicyNamesSet = new Set(knownPolicyNames);
const receivedPolicyNames = Object.keys(value.policies);
const allPolicyNames =
Array.from(new Set([...knownPolicyNames, ...receivedPolicyNames]));
const policies = allPolicyNames.map(
name => Object.assign(
{
name,
link: knownPolicyNames === policyNames.chrome.policyNames &&
knownPolicyNamesSet.has(name) ?
`https://cloud.google.com/docs/chrome-enterprise/policies/?policy=${
name}` :
undefined,
},
value.policies[name]));
return {name: value.name, id: value.id, policies};
});
policyGroups.forEach(group => this.createOrUpdatePolicyTable(group));
......
......@@ -20,6 +20,7 @@ per-file neterror*=file://net/OWNERS
per-file ntp_tiles_resources.grdp=file://components/ntp_tiles/OWNERS
per-file welcome_scaled_resources.grdp=file://ui/webui/PLATFORM_OWNERS
per-file offline_pages_resources.grdp=file://components/offline_pages/OWNERS
per-file policy_resources.grdp=file://components/policy/OWNERS
per-file proximity_auth*=tengs@chromium.org
per-file printing_resources.grdp=file://printing/OWNERS
per-file security_interstitials_resources.grdp=file://components/security_interstitials/OWNERS
......
......@@ -18,6 +18,7 @@
<part file="neterror_resources.grdp" />
<part file="ntp_tiles_resources.grdp" />
<part file="offline_pages_resources.grdp" />
<part file="policy_resources.grdp" />
<part file="printing_resources.grdp" />
<part file="safe_browsing_resources.grdp" />
<part file="security_interstitials_resources.grdp" />
......
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<include name="IDR_POLICY_CSS" file="../policy/resources/webui/policy.css" preprocess="true" type="BINDATA" compress="gzip" />
<include name="IDR_POLICY_HTML" file="../policy/resources/webui/policy.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_POLICY_BASE_JS" file="../policy/resources/webui/policy_base.js" type="BINDATA" compress="gzip" preprocess="true" />
<include name="IDR_POLICY_JS" file="../policy/resources/webui/policy.js" type="BINDATA" compress="gzip" />
</grit-part>
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