OLD | NEW |
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 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 /** | 9 /** |
10 * Encapsulated handling of a search bubble. | 10 * Encapsulated handling of a search bubble. |
11 * @constructor | 11 * @constructor |
| 12 * @extends {HTMLDivElement} |
12 */ | 13 */ |
13 function SearchBubble(text) { | 14 function SearchBubble(text) { |
14 var el = cr.doc.createElement('div'); | 15 var el = cr.doc.createElement('div'); |
15 SearchBubble.decorate(el); | 16 SearchBubble.decorate(el); |
16 el.content = text; | 17 el.content = text; |
17 return el; | 18 return el; |
18 } | 19 } |
19 | 20 |
20 /** | 21 /** |
21 * Prohibit search for guests on desktop. | 22 * Prohibit search for guests on desktop. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (top != this.lastTop) { | 114 if (top != this.lastTop) { |
114 this.style.top = top + 'px'; | 115 this.style.top = top + 'px'; |
115 this.lastTop = top; | 116 this.lastTop = top; |
116 } | 117 } |
117 }, | 118 }, |
118 }; | 119 }; |
119 | 120 |
120 /** | 121 /** |
121 * Encapsulated handling of the search page. | 122 * Encapsulated handling of the search page. |
122 * @constructor | 123 * @constructor |
| 124 * @extends {cr.ui.pageManager.Page} |
123 */ | 125 */ |
124 function SearchPage() { | 126 function SearchPage() { |
125 Page.call(this, 'search', | 127 Page.call(this, 'search', |
126 loadTimeData.getString('searchPageTabTitle'), | 128 loadTimeData.getString('searchPageTabTitle'), |
127 'searchPage'); | 129 'searchPage'); |
128 } | 130 } |
129 | 131 |
130 cr.addSingletonGetter(SearchPage); | 132 cr.addSingletonGetter(SearchPage); |
131 | 133 |
132 SearchPage.prototype = { | 134 SearchPage.prototype = { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 354 |
353 foundMatches = true; | 355 foundMatches = true; |
354 } | 356 } |
355 } | 357 } |
356 } | 358 } |
357 | 359 |
358 // Configure elements on the search results page based on search results. | 360 // Configure elements on the search results page based on search results. |
359 $('searchPageNoMatches').hidden = foundMatches; | 361 $('searchPageNoMatches').hidden = foundMatches; |
360 | 362 |
361 // Create search balloons for sub-page results. | 363 // Create search balloons for sub-page results. |
362 length = bubbleControls.length; | 364 var length = bubbleControls.length; |
363 for (var i = 0; i < length; i++) | 365 for (var i = 0; i < length; i++) |
364 this.createSearchBubble_(bubbleControls[i], text); | 366 this.createSearchBubble_(bubbleControls[i], text); |
365 | 367 |
366 // Cleanup the recursion-prevention variable. | 368 // Cleanup the recursion-prevention variable. |
367 this.insideSetSearchText_ = false; | 369 this.insideSetSearchText_ = false; |
368 }, | 370 }, |
369 | 371 |
370 /** | 372 /** |
371 * Reveal the associated section for |subpage|, as well as the one for its | 373 * Reveal the associated section for |subpage|, as well as the one for its |
372 * |parentPage|, and its |parentPage|'s |parentPage|, etc. | 374 * |parentPage|, and its |parentPage|'s |parentPage|, etc. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // Trim beginning and ending whitespace. | 583 // Trim beginning and ending whitespace. |
582 return text.replace(/^\s+|\s+$/g, ''); | 584 return text.replace(/^\s+|\s+$/g, ''); |
583 }; | 585 }; |
584 | 586 |
585 // Export | 587 // Export |
586 return { | 588 return { |
587 SearchPage: SearchPage | 589 SearchPage: SearchPage |
588 }; | 590 }; |
589 | 591 |
590 }); | 592 }); |
OLD | NEW |