Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/browser/resources/md_policy/policy_ui.js

Issue 1371073003: Display material design policies grouped by tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test corrections. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Define a global entry point that will be set when the page is initialized.
7 * @return {?PolicyUi}
8 */
9 cr.define('policy', function() {
10 return {Page: null};
11 });
12
13 /**
14 * @fileoverview
15 * 'policy-ui' is the main MD element, combining the UI and models.
16 *
17 * Example:
18 * <policy-ui></policy-ui>
19 *
20 * @group Chrome Policy Elements
21 * @element policy-ui
22 */
23 PolicyUi = Polymer({
24 is: 'policy-ui',
25
26 properties: {
27 /**
28 * Object containing title and text of the introduction card.
29 * @type {!{title: string, text: string}}
30 */
31 introduction: {
32 type: Object,
33 // TODO(fhorschig): i18n! Replace sample text with reviewed message.
34 value: {
35 title: 'Managed account policies',
36 text: 'Your device and your user account are managed which means ' +
37 'that some of your settings are fixed by your administrator.\n' +
38 'The cards below explain how the administrator\'s choices may ' +
39 'impact your privacy or security.'
40 },
41 readOnly: true,
42 },
43
44 /**
45 * Array containing all known tags.
46 * @type {!Array<Object<string>>}
47 * @private
48 */
49 tags_: Array,
50 },
51
52 /** @override */
53 ready: function() {
54 // Set this element as receiver of calls to the Page.
55 policy.Page = this;
56
57 // Notify the browser that the page has loaded, causing it to send the
58 // list of all known policies, the current policy values and the cloud
59 // policy status.
60 chrome.send('initialized');
61 },
62
63 /**
64 * Receives a list of known tags and creates an empty policy list for each.
65 * @param {!Array<string>} tags List of tags.
66 */
67 setPolicyGroups: function(tags) {
68 this.set('tags_', tags);
69 },
70
71 /**
72 * Creates UI elements for tagged policies within the passed |names| object.
73 * @param {!{chromePolicyNames: !Object<!Array<string>>}} namesWithTags
74 */
75 setPolicyNames: function(namesWithTags) {
76 for (var name in namesWithTags.chromePolicyNames) {
77 namesWithTags.chromePolicyNames[name].forEach((function(tag) {
78 this.$.groups.querySelector('[risk-tag="' + tag + '"]').addPolicy(name);
79 }).bind(this));
80 }
81 },
82
83 /**
84 * Receives a list of current values that it hands down to children.
85 * @param {!{chromePolicies: !Object<string>}} values Current policies.
86 */
87 setPolicyValues: function(values) {
88 // TODO(fhorschig): Update or notify tag groups.
89 },
90
91 /**
92 * Receives an object with meta data about the currently set policies.
93 * @param {!Object} status Dictionary containing meta data about set policies.
94 */
95 setStatus: function(status) {
96 // TODO(fhorschig): Update |this.$.introduction| with status information.
97 // text according to policy status.
98 }
99 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698