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

Side by Side Diff: chrome/browser/resources/options/options_page.js

Issue 8353022: [web-ui settings] Fixes and improvements for settings page searching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase for commit queue Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (!targetPage && this.showOverlay_(pageName, rootPage)) { 93 if (!targetPage && this.showOverlay_(pageName, rootPage)) {
94 if (updateHistory) 94 if (updateHistory)
95 this.updateHistoryState_(); 95 this.updateHistoryState_();
96 return; 96 return;
97 } else { 97 } else {
98 targetPage = this.getDefaultPage(); 98 targetPage = this.getDefaultPage();
99 } 99 }
100 } 100 }
101 101
102 pageName = targetPage.name.toLowerCase(); 102 pageName = targetPage.name.toLowerCase();
103 var targetPageWasVisible = targetPage.visible;
103 104
104 // Determine if the root page is 'sticky', meaning that it 105 // Determine if the root page is 'sticky', meaning that it
105 // shouldn't change when showing a sub-page. This can happen for special 106 // shouldn't change when showing a sub-page. This can happen for special
106 // pages like Search. 107 // pages like Search.
107 var isRootPageLocked = 108 var isRootPageLocked =
108 rootPage && rootPage.sticky && targetPage.parentPage; 109 rootPage && rootPage.sticky && targetPage.parentPage;
109 110
110 // Notify pages if they will be hidden. 111 // Notify pages if they will be hidden.
111 for (var name in this.registeredPages) { 112 for (var name in this.registeredPages) {
112 var page = this.registeredPages[name]; 113 var page = this.registeredPages[name];
113 if (!page.parentPage && isRootPageLocked) 114 if (!page.parentPage && isRootPageLocked)
114 continue; 115 continue;
115 if (page.willHidePage && name != pageName && 116 if (page.willHidePage && name != pageName &&
116 !page.isAncestorOfPage(targetPage)) 117 !page.isAncestorOfPage(targetPage))
117 page.willHidePage(); 118 page.willHidePage();
118 } 119 }
119 120
120 var prevVisible = false;
121
122 // Update visibilities to show only the hierarchy of the target page. 121 // Update visibilities to show only the hierarchy of the target page.
123 for (var name in this.registeredPages) { 122 for (var name in this.registeredPages) {
124 var page = this.registeredPages[name]; 123 var page = this.registeredPages[name];
125 if (!page.parentPage && isRootPageLocked) 124 if (!page.parentPage && isRootPageLocked)
126 continue; 125 continue;
127 prevVisible = page.visible;
128 page.visible = name == pageName || 126 page.visible = name == pageName ||
129 (!document.documentElement.classList.contains('hide-menu') && 127 (!document.documentElement.classList.contains('hide-menu') &&
130 page.isAncestorOfPage(targetPage)); 128 page.isAncestorOfPage(targetPage));
131 } 129 }
132 130
133 // Update the history and current location. 131 // Update the history and current location.
134 if (updateHistory) 132 if (updateHistory)
135 this.updateHistoryState_(); 133 this.updateHistoryState_();
136 134
137 // Always update the page title. 135 // Always update the page title.
138 document.title = targetPage.title; 136 document.title = targetPage.title;
139 137
140 // Notify pages if they were shown. 138 // Notify pages if they were shown.
141 for (var name in this.registeredPages) { 139 for (var name in this.registeredPages) {
142 var page = this.registeredPages[name]; 140 var page = this.registeredPages[name];
143 if (!page.parentPage && isRootPageLocked) 141 if (!page.parentPage && isRootPageLocked)
144 continue; 142 continue;
145 if (!prevVisible && page.didShowPage && (name == pageName || 143 if (!targetPageWasVisible && page.didShowPage && (name == pageName ||
146 page.isAncestorOfPage(targetPage))) 144 page.isAncestorOfPage(targetPage)))
147 page.didShowPage(); 145 page.didShowPage();
148 } 146 }
149 }; 147 };
150 148
151 /** 149 /**
152 * Updates the visibility and stacking order of the subpage backdrop 150 * Updates the visibility and stacking order of the subpage backdrop
153 * according to which subpage is topmost and visible. 151 * according to which subpage is topmost and visible.
154 * @private 152 * @private
155 */ 153 */
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 canShowPage: function() { 1056 canShowPage: function() {
1059 return true; 1057 return true;
1060 }, 1058 },
1061 }; 1059 };
1062 1060
1063 // Export 1061 // Export
1064 return { 1062 return {
1065 OptionsPage: OptionsPage 1063 OptionsPage: OptionsPage
1066 }; 1064 };
1067 }); 1065 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/extension_settings.js ('k') | chrome/browser/resources/options/search_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698