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 SearchBubble.decorate = function(el) { | 21 SearchBubble.decorate = function(el) { |
21 el.__proto__ = SearchBubble.prototype; | 22 el.__proto__ = SearchBubble.prototype; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (top != this.lastTop) { | 107 if (top != this.lastTop) { |
107 this.style.top = top + 'px'; | 108 this.style.top = top + 'px'; |
108 this.lastTop = top; | 109 this.lastTop = top; |
109 } | 110 } |
110 }, | 111 }, |
111 }; | 112 }; |
112 | 113 |
113 /** | 114 /** |
114 * Encapsulated handling of the search page. | 115 * Encapsulated handling of the search page. |
115 * @constructor | 116 * @constructor |
| 117 * @extends {cr.ui.pageManager.Page} |
116 */ | 118 */ |
117 function SearchPage() { | 119 function SearchPage() { |
118 Page.call(this, 'search', | 120 Page.call(this, 'search', |
119 loadTimeData.getString('searchPageTabTitle'), | 121 loadTimeData.getString('searchPageTabTitle'), |
120 'searchPage'); | 122 'searchPage'); |
121 } | 123 } |
122 | 124 |
123 cr.addSingletonGetter(SearchPage); | 125 cr.addSingletonGetter(SearchPage); |
124 | 126 |
125 SearchPage.prototype = { | 127 SearchPage.prototype = { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 349 |
348 foundMatches = true; | 350 foundMatches = true; |
349 } | 351 } |
350 } | 352 } |
351 } | 353 } |
352 | 354 |
353 // Configure elements on the search results page based on search results. | 355 // Configure elements on the search results page based on search results. |
354 $('searchPageNoMatches').hidden = foundMatches; | 356 $('searchPageNoMatches').hidden = foundMatches; |
355 | 357 |
356 // Create search balloons for sub-page results. | 358 // Create search balloons for sub-page results. |
357 length = bubbleControls.length; | 359 var length = bubbleControls.length; |
358 for (var i = 0; i < length; i++) | 360 for (var i = 0; i < length; i++) |
359 this.createSearchBubble_(bubbleControls[i], text); | 361 this.createSearchBubble_(bubbleControls[i], text); |
360 | 362 |
361 // Cleanup the recursion-prevention variable. | 363 // Cleanup the recursion-prevention variable. |
362 this.insideSetSearchText_ = false; | 364 this.insideSetSearchText_ = false; |
363 }, | 365 }, |
364 | 366 |
365 /** | 367 /** |
366 * Reveal the associated section for |subpage|, as well as the one for its | 368 * Reveal the associated section for |subpage|, as well as the one for its |
367 * |parentPage|, and its |parentPage|'s |parentPage|, etc. | 369 * |parentPage|, and its |parentPage|'s |parentPage|, etc. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 // Trim beginning and ending whitespace. | 578 // Trim beginning and ending whitespace. |
577 return text.replace(/^\s+|\s+$/g, ''); | 579 return text.replace(/^\s+|\s+$/g, ''); |
578 }; | 580 }; |
579 | 581 |
580 // Export | 582 // Export |
581 return { | 583 return { |
582 SearchPage: SearchPage | 584 SearchPage: SearchPage |
583 }; | 585 }; |
584 | 586 |
585 }); | 587 }); |
OLD | NEW |