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

Unified Diff: chrome/browser/resources/options/options_page.js

Issue 7342009: Show a different banner in chrome://settings for extension-controlled settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/options.html ('k') | chrome/browser/resources/options/personal_options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/options_page.js
diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js
index beaa9999ea1030873751c4975ea9f54edfe8f2e4..ffed188c7bd5565e6020eda23a5c50d466bb18c8 100644
--- a/chrome/browser/resources/options/options_page.js
+++ b/chrome/browser/resources/options/options_page.js
@@ -21,7 +21,6 @@ cr.define('options', function() {
this.pageDivName = pageDivName;
this.pageDiv = $(this.pageDivName);
this.tab = null;
- this.managed = false;
}
const SUBPAGE_SHEET_COUNT = 2;
@@ -808,16 +807,6 @@ cr.define('options', function() {
initializePage: function() {},
/**
- * Sets managed banner visibility state.
- */
- setManagedBannerVisibility: function(visible) {
- this.managed = visible;
- if (this.visible) {
- this.updateManagedBannerVisibility();
- }
- },
-
- /**
* Updates managed banner visibility state. This function iterates over
* all input fields of a window and if any of these is marked as managed
* it triggers the managed banner to be visible. The banner can be enforced
@@ -827,23 +816,32 @@ cr.define('options', function() {
updateManagedBannerVisibility: function() {
var bannerDiv = $('managed-prefs-banner');
- var hasManaged = this.managed;
- if (!hasManaged) {
- var inputElements = this.pageDiv.querySelectorAll('input');
- for (var i = 0, len = inputElements.length; i < len; i++) {
- if (inputElements[i].managed) {
- hasManaged = true;
- break;
- }
- }
+ var controlledByPolicy = false;
+ var controlledByExtension = false;
+ var inputElements = this.pageDiv.querySelectorAll('input[controlledBy]');
+ for (var i = 0, len = inputElements.length; i < len; i++) {
+ if (inputElements[i].controlledBy == 'policy')
+ controlledByPolicy = true;
+ else if (inputElements[i].controlledBy == 'extension')
+ controlledByExtension = true;
}
- if (hasManaged) {
- bannerDiv.hidden = false;
- var height = window.getComputedStyle($('managed-prefs-banner')).height;
- $('subpage-backdrop').style.top = height;
- } else {
+ if (!controlledByPolicy && !controlledByExtension) {
bannerDiv.hidden = true;
$('subpage-backdrop').style.top = '0';
+ } else {
+ bannerDiv.hidden = false;
+ var height = window.getComputedStyle(bannerDiv).height;
+ $('subpage-backdrop').style.top = height;
+ if (controlledByPolicy && !controlledByExtension) {
+ $('managed-prefs-text').textContent =
+ templateData.policyManagedPrefsBannerText;
+ } else if (!controlledByPolicy && controlledByExtension) {
+ $('managed-prefs-text').textContent =
+ templateData.extensionManagedPrefsBannerText;
+ } else if (controlledByPolicy && controlledByExtension) {
+ $('managed-prefs-text').textContent =
+ templateData.policyAndExtensionManagedPrefsBannerText;
+ }
}
},
« no previous file with comments | « chrome/browser/resources/options/options.html ('k') | chrome/browser/resources/options/personal_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698