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

Side by Side Diff: chrome/browser/resources/options2/options_page.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: .hidden -> [hidden] Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 ///////////////////////////////////////////////////////////////////////////// 6 /////////////////////////////////////////////////////////////////////////////
7 // OptionsPage class: 7 // OptionsPage class:
8 8
9 /** 9 /**
10 * Base class for options page. 10 * Base class for options page.
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 * @type {OptionsPage} 891 * @type {OptionsPage}
892 */ 892 */
893 associatedControls: null, 893 associatedControls: null,
894 894
895 /** 895 /**
896 * Initializes page content. 896 * Initializes page content.
897 */ 897 */
898 initializePage: function() {}, 898 initializePage: function() {},
899 899
900 /** 900 /**
901 * Updates managed banner visibility state. This function iterates over
902 * all input fields of a window and if any of these is marked as managed
903 * it triggers the managed banner to be visible. The banner can be enforced
904 * being on through the managed flag of this class but it can not be forced
905 * being off if managed items exist.
906 */
907 updateManagedBannerVisibility: function() {
908 var bannerDiv = $('managed-prefs-banner');
909
910 var controlledByPolicy = false;
911 var controlledByExtension = false;
912 var inputElements = this.pageDiv.querySelectorAll('input[controlled-by]');
913 for (var i = 0, len = inputElements.length; i < len; i++) {
914 if (inputElements[i].controlledBy == 'policy')
915 controlledByPolicy = true;
916 else if (inputElements[i].controlledBy == 'extension')
917 controlledByExtension = true;
918 }
919 if (!controlledByPolicy && !controlledByExtension) {
920 bannerDiv.hidden = true;
921 } else {
922 bannerDiv.hidden = false;
923 var height = window.getComputedStyle(bannerDiv).height;
924 if (controlledByPolicy && !controlledByExtension) {
925 $('managed-prefs-text').textContent =
926 templateData.policyManagedPrefsBannerText;
927 } else if (!controlledByPolicy && controlledByExtension) {
928 $('managed-prefs-text').textContent =
929 templateData.extensionManagedPrefsBannerText;
930 } else if (controlledByPolicy && controlledByExtension) {
931 $('managed-prefs-text').textContent =
932 templateData.policyAndExtensionManagedPrefsBannerText;
933 }
934 }
935 },
936
937 /**
938 * Gets page visibility state. 901 * Gets page visibility state.
939 */ 902 */
940 get visible() { 903 get visible() {
941 return !this.pageDiv.hidden; 904 return !this.pageDiv.hidden;
942 }, 905 },
943 906
944 /** 907 /**
945 * Sets page visibility. 908 * Sets page visibility.
946 */ 909 */
947 set visible(visible) { 910 set visible(visible) {
948 if ((this.visible && visible) || (!this.visible && !visible)) 911 if ((this.visible && visible) || (!this.visible && !visible))
949 return; 912 return;
950 913
951 this.setContainerVisibility_(visible); 914 this.setContainerVisibility_(visible);
952 this.pageDiv.hidden = !visible; 915 this.pageDiv.hidden = !visible;
953 this.pageDiv.classList.remove('shake'); 916 this.pageDiv.classList.remove('shake');
954 917
955 OptionsPage.updatePageFreezeStates(); 918 OptionsPage.updatePageFreezeStates();
956 919
957 // The managed prefs banner is global, so after any visibility change
958 // update it based on the topmost page, not necessarily this page
959 // (e.g., if an ancestor is made visible after a child).
960 OptionsPage.updateManagedBannerVisibility();
961
962 // A subpage was shown or hidden. 920 // A subpage was shown or hidden.
963 if (!this.isOverlay && this.nestingLevel > 0) 921 if (!this.isOverlay && this.nestingLevel > 0)
964 OptionsPage.updateDisplayForShowOrHideSubpage_(); 922 OptionsPage.updateDisplayForShowOrHideSubpage_();
965 else if (this.isOverlay && !visible) 923 else if (this.isOverlay && !visible)
966 OptionsPage.updateScrollPosition_(); 924 OptionsPage.updateScrollPosition_();
967 925
968 cr.dispatchPropertyChange(this, 'visible', visible, !visible); 926 cr.dispatchPropertyChange(this, 'visible', visible, !visible);
969 }, 927 },
970 928
971 /** 929 /**
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 canShowPage: function() { 1057 canShowPage: function() {
1100 return true; 1058 return true;
1101 }, 1059 },
1102 }; 1060 };
1103 1061
1104 // Export 1062 // Export
1105 return { 1063 return {
1106 OptionsPage: OptionsPage 1064 OptionsPage: OptionsPage
1107 }; 1065 };
1108 }); 1066 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/options_page.css ('k') | chrome/browser/resources/options2/pref_ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698