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

Unified Diff: chrome/browser/resources/options2/browser_options.js

Issue 9307026: make search box in settings page not get hidden behind enterprise warning (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make the banner show on the search page as well Created 8 years, 11 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
Index: chrome/browser/resources/options2/browser_options.js
diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js
index 1fbe3cce331ade70497a647e0c82d70d7880e1ae..3325461c8b9dd51a330432f6778fe338c7281702 100644
--- a/chrome/browser/resources/options2/browser_options.js
+++ b/chrome/browser/resources/options2/browser_options.js
@@ -224,6 +224,48 @@ cr.define('options', function() {
},
/**
+ * Updates managed banner visibility state. This function iterates over
+ * all input fields of all subpages and if any of these is marked as managed
+ * it triggers the managed banner to be visible. The banner can be enforced
James Hawkins 2012/02/05 05:13:10 enforced? Do you mean 'forced' here?
Tyler Breisacher (Chromium) 2012/02/06 18:46:50 This part of the comment is copied from the origin
Tyler Breisacher (Chromium) 2012/02/06 19:08:58 I'm not sure what the 'managed flag of this class'
+ * being on through the managed flag of this class but it can not be forced
+ * being off if managed items exist.
+ */
+ updateManagedBannerVisibility_: function() {
James Hawkins 2012/02/05 05:13:10 If this applies to all sub-pages, why is the imple
Tyler Breisacher (Chromium) 2012/02/06 18:46:50 The banner only *shows* on the BrowserOptions page
+ var bannerDiv = $('managed-prefs-banner');
+
+ var controlledByPolicy = false;
+ var controlledByExtension = false;
+ var inputElements = document.querySelectorAll('input[controlled-by]');
+ var mainPages = document.querySelectorAll('#page-container .page');
+ 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 (!controlledByPolicy && !controlledByExtension) {
+ bannerDiv.classList.add('hidden');
+ for (var i = 0; i < mainPages.length; i++)
+ mainPages[i].classList.remove('under-managed-prefs-banner');
+ } else {
+ bannerDiv.classList.remove('hidden');
+ for (var i = 0; i < mainPages.length; i++)
+ mainPages[i].classList.add('under-managed-prefs-banner');
+
+ 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;
+ }
+ }
+ },
+
+ /**
* Initializes a button for controlling screen brightness.
* @param {string} id Button ID.
* @param {string} callback Name of the callback function.
@@ -588,6 +630,7 @@ cr.define('options', function() {
'updateAccountPicture',
'updateAutocompleteSuggestions',
'updateHomePageLabel',
+ 'updateManagedBannerVisibility',
'updateSearchEngines',
'updateStartupPages',
].forEach(function(name) {
« no previous file with comments | « no previous file | chrome/browser/resources/options2/content_settings.js » ('j') | chrome/browser/resources/options2/options.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698