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

Side by Side Diff: chrome/browser/resources/policy.js

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 months 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 cr.define('policy', function() { 4 cr.define('policy', function() {
5 5
6 /** 6 /**
7 * A hack to check if we are displaying the mobile version of this page by 7 * A hack to check if we are displaying the mobile version of this page by
8 * checking if the first column is hidden. 8 * checking if the first column is hidden.
9 * @return {boolean} True if this is the mobile version. 9 * @return {boolean} True if this is the mobile version.
10 */ 10 */
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Populate the remaining columns with policy scope, level and value if a 128 // Populate the remaining columns with policy scope, level and value if a
129 // value has been set. Otherwise, leave them blank. 129 // value has been set. Otherwise, leave them blank.
130 if (value) { 130 if (value) {
131 this.querySelector('.scope').textContent = 131 this.querySelector('.scope').textContent =
132 loadTimeData.getString(value.scope == 'user' ? 132 loadTimeData.getString(value.scope == 'user' ?
133 'scopeUser' : 'scopeDevice'); 133 'scopeUser' : 'scopeDevice');
134 this.querySelector('.level').textContent = 134 this.querySelector('.level').textContent =
135 loadTimeData.getString(value.level == 'recommended' ? 135 loadTimeData.getString(value.level == 'recommended' ?
136 'levelRecommended' : 'levelMandatory'); 136 'levelRecommended' : 'levelMandatory');
137 this.querySelector('.source').textContent =
138 loadTimeData.getString(value.source);
137 this.querySelector('.value').textContent = value.value; 139 this.querySelector('.value').textContent = value.value;
138 this.querySelector('.expanded-value').textContent = value.value; 140 this.querySelector('.expanded-value').textContent = value.value;
139 } 141 }
140 142
141 // Populate the status column. 143 // Populate the status column.
142 var status; 144 var status;
143 if (!value) { 145 if (!value) {
144 // If the policy value has not been set, show an error message. 146 // If the policy value has not been set, show an error message.
145 status = loadTimeData.getString('unset'); 147 status = loadTimeData.getString('unset');
146 } else if (unknown) { 148 } else if (unknown) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 }, 514 },
513 515
514 /** 516 /**
515 * Creates a new table for displaying policies. 517 * Creates a new table for displaying policies.
516 * @return {Element} The newly created table. 518 * @return {Element} The newly created table.
517 */ 519 */
518 createPolicyTable: function() { 520 createPolicyTable: function() {
519 var newTable = window.document.createElement('table'); 521 var newTable = window.document.createElement('table');
520 var tableHead = window.document.createElement('thead'); 522 var tableHead = window.document.createElement('thead');
521 var tableRow = window.document.createElement('tr'); 523 var tableRow = window.document.createElement('tr');
522 var tableHeadings = ['Scope', 'Level', 'Name', 'Value', 'Status']; 524 var tableHeadings = ['Scope', 'Level', 'Source', 'Name', 'Value',
525 'Status'];
523 for (var i = 0; i < tableHeadings.length; i++) { 526 for (var i = 0; i < tableHeadings.length; i++) {
524 var tableHeader = window.document.createElement('th'); 527 var tableHeader = window.document.createElement('th');
525 tableHeader.classList.add(tableHeadings[i].toLowerCase() + '-column'); 528 tableHeader.classList.add(tableHeadings[i].toLowerCase() + '-column');
526 tableHeader.textContent = loadTimeData.getString('header' + 529 tableHeader.textContent = loadTimeData.getString('header' +
527 tableHeadings[i]); 530 tableHeadings[i]);
528 tableRow.appendChild(tableHeader); 531 tableRow.appendChild(tableHeader);
529 } 532 }
530 tableHead.appendChild(tableRow); 533 tableHead.appendChild(tableRow);
531 newTable.appendChild(tableHead); 534 newTable.appendChild(tableHead);
532 cr.ui.decorate(newTable, PolicyTable); 535 cr.ui.decorate(newTable, PolicyTable);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 return { 572 return {
570 Page: Page 573 Page: Page
571 }; 574 };
572 }); 575 });
573 576
574 // Have the main initialization function be called when the page finishes 577 // Have the main initialization function be called when the page finishes
575 // loading. 578 // loading.
576 document.addEventListener( 579 document.addEventListener(
577 'DOMContentLoaded', 580 'DOMContentLoaded',
578 policy.Page.getInstance().initialize.bind(policy.Page.getInstance())); 581 policy.Page.getInstance().initialize.bind(policy.Page.getInstance()));
OLDNEW
« no previous file with comments | « chrome/browser/resources/policy.html ('k') | chrome/browser/search/contextual_search_policy_handler_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698