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 DictionaryWordsList = | 6 /** @const */ var DictionaryWordsList = |
7 options.dictionary_words.DictionaryWordsList; | 7 options.dictionary_words.DictionaryWordsList; |
8 /** @const */ var Page = cr.ui.pageManager.Page; | 8 /** @const */ var Page = cr.ui.pageManager.Page; |
9 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 9 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 * The paragraph of text that indicates that search returned no results. | 42 * The paragraph of text that indicates that search returned no results. |
43 * @type {HTMLElement} | 43 * @type {HTMLElement} |
44 * @private | 44 * @private |
45 */ | 45 */ |
46 noMatchesLabel_: null, | 46 noMatchesLabel_: null, |
47 | 47 |
48 /** @override */ | 48 /** @override */ |
49 initializePage: function() { | 49 initializePage: function() { |
50 Page.prototype.initializePage.call(this); | 50 Page.prototype.initializePage.call(this); |
51 | 51 |
52 this.wordList_ = $('language-dictionary-overlay-word-list'); | 52 var wordList = $('language-dictionary-overlay-word-list'); |
53 DictionaryWordsList.decorate(this.wordList_); | 53 DictionaryWordsList.decorate(wordList); |
| 54 this.wordList_ = assertInstanceof(wordList, DictionaryWordsList); |
54 this.wordList_.onWordListChanged = function() { | 55 this.wordList_.onWordListChanged = function() { |
55 this.onWordListChanged_(); | 56 this.onWordListChanged_(); |
56 }.bind(this); | 57 }.bind(this); |
57 | 58 |
58 this.searchField_ = $('language-dictionary-overlay-search-field'); | 59 this.searchField_ = $('language-dictionary-overlay-search-field'); |
59 this.searchField_.onsearch = function(e) { | 60 this.searchField_.onsearch = function(e) { |
60 this.wordList_.search(e.currentTarget.value); | 61 this.wordList_.search(e.currentTarget.value); |
61 }.bind(this); | 62 }.bind(this); |
62 this.searchField_.onkeydown = function(e) { | 63 this.searchField_.onkeydown = function(e) { |
63 // Don't propagate enter key events. Otherwise the default button will | 64 // Don't propagate enter key events. Otherwise the default button will |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 }; | 108 }; |
108 | 109 |
109 EditDictionaryOverlay.getWordListForTesting = function() { | 110 EditDictionaryOverlay.getWordListForTesting = function() { |
110 return EditDictionaryOverlay.getInstance().wordList_; | 111 return EditDictionaryOverlay.getInstance().wordList_; |
111 }; | 112 }; |
112 | 113 |
113 return { | 114 return { |
114 EditDictionaryOverlay: EditDictionaryOverlay | 115 EditDictionaryOverlay: EditDictionaryOverlay |
115 }; | 116 }; |
116 }); | 117 }); |
OLD | NEW |