diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 13:04:51 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 13:04:51 +0000 |
commit | 625001ab8b64507b5fe02714efad8ac371fbbcf0 (patch) | |
tree | 8252a21f074216d0460cb070ad602467f4626985 | |
parent | 1be5b4f56c7e1d25c99a495a09a438f9c357f0a1 (diff) | |
download | chromium_src-625001ab8b64507b5fe02714efad8ac371fbbcf0.zip chromium_src-625001ab8b64507b5fe02714efad8ac371fbbcf0.tar.gz chromium_src-625001ab8b64507b5fe02714efad8ac371fbbcf0.tar.bz2 |
Improved the way managed settings are shown in the DOMUI settings windows.
There is now separate banner for every window and the banner is being shown
always when there is some managed controls on the page.
BUG=69259
TEST=Enable/disable a policy and observe if a banner appears/disappears on the respective DOMUI settings page.
Review URL: http://codereview.chromium.org/6170007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73282 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/options/content_settings.js | 2 | ||||
-rw-r--r-- | chrome/browser/resources/options/options_page.js | 42 |
2 files changed, 32 insertions, 12 deletions
diff --git a/chrome/browser/resources/options/content_settings.js b/chrome/browser/resources/options/content_settings.js index 76d38cf..1b53509 100644 --- a/chrome/browser/resources/options/content_settings.js +++ b/chrome/browser/resources/options/content_settings.js @@ -78,8 +78,10 @@ cr.define('options', function() { group + ']'); for (var i = 0, len = radios.length; i < len; i++) { radios[i].disabled = dict[group]['managed']; + radios[i].managed = dict[group]['managed']; } } + OptionsPage.updateManagedBannerVisibility(); }; /** diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index cf3ece7..f879ced 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -195,7 +195,9 @@ cr.define('options', function() { * Updates managed banner visibility state based on the topmost page. */ OptionsPage.updateManagedBannerVisibility = function() { - var topPage = this.getTopmostVisiblePage(); + var topPage = this.getVisibleOverlay_(); + if (topPage == null) + topPage = this.getTopmostVisiblePage(); if (topPage) topPage.updateManagedBannerVisibility(); }; @@ -508,15 +510,31 @@ cr.define('options', function() { }, /** - * Updates managed banner visibility state. + * 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 + * being on through the managed flag of this class but it can not be forced + * being off if managed items exist. */ updateManagedBannerVisibility: function() { - if (this.managed) { - $('managed-prefs-banner').classList.remove('hidden'); + 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; + } + } + } + if (hasManaged) { + bannerDiv.classList.remove('hidden'); var height = window.getComputedStyle($('managed-prefs-banner')).height; $('subpage-backdrop').style.top = height; } else { - $('managed-prefs-banner').classList.add('hidden'); + bannerDiv.classList.add('hidden'); $('subpage-backdrop').style.top = '0'; } }, @@ -550,15 +568,11 @@ cr.define('options', function() { $('subpage-backdrop').classList.remove('hidden'); } - // The managed prefs banner is global, so after any visibility change - // update it based on the topmost page, not necessarily this page. - // (e.g., if an ancestor is made visible after a child). - OptionsPage.updateManagedBannerVisibility(); - // Recent webkit change no longer allows url change from "chrome://". window.history.pushState({pageName: this.name}, this.title, '/' + this.name); } + if (this.tab) { this.tab.classList.add('navbar-item-selected'); } @@ -574,14 +588,18 @@ cr.define('options', function() { if (nestingLevel == 1) $('subpage-backdrop').classList.add('hidden'); } - - OptionsPage.updateManagedBannerVisibility(); } + if (this.tab) { this.tab.classList.remove('navbar-item-selected'); } } + // The managed prefs banner is global, so after any visibility change + // update it based on the topmost page, not necessarily this page + // (e.g., if an ancestor is made visible after a child). + OptionsPage.updateManagedBannerVisibility(); + cr.dispatchPropertyChange(this, 'visible', visible, !visible); }, |