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

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

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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
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 /** @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
11 /** 11 /**
12 * Adding and removing words in custom spelling dictionary. 12 * Adding and removing words in custom spelling dictionary.
13 * @constructor 13 * @constructor
14 * @extends {cr.ui.pageManager.Page} 14 * @extends {cr.ui.pageManager.Page}
15 */ 15 */
16 function EditDictionaryOverlay() { 16 function EditDictionaryOverlay() {
17 Page.call(this, 'editDictionary', 17 Page.call(
18 loadTimeData.getString('languageDictionaryOverlayPage'), 18 this, 'editDictionary',
19 'language-dictionary-overlay-page'); 19 loadTimeData.getString('languageDictionaryOverlayPage'),
20 'language-dictionary-overlay-page');
20 } 21 }
21 22
22 cr.addSingletonGetter(EditDictionaryOverlay); 23 cr.addSingletonGetter(EditDictionaryOverlay);
23 24
24 EditDictionaryOverlay.prototype = { 25 EditDictionaryOverlay.prototype = {
25 __proto__: Page.prototype, 26 __proto__: Page.prototype,
26 27
27 /** 28 /**
28 * A list of words in the dictionary. 29 * A list of words in the dictionary.
29 * @type {options.dictionary_words.DictionaryWordsList} 30 * @type {options.dictionary_words.DictionaryWordsList}
(...skipping 30 matching lines...) Expand all
60 this.searchField_.onsearch = function(e) { 61 this.searchField_.onsearch = function(e) {
61 this.wordList_.search(e.currentTarget.value); 62 this.wordList_.search(e.currentTarget.value);
62 }.bind(this); 63 }.bind(this);
63 this.searchField_.onkeydown = function(e) { 64 this.searchField_.onkeydown = function(e) {
64 // Don't propagate enter key events. Otherwise the default button will 65 // Don't propagate enter key events. Otherwise the default button will
65 // activate. 66 // activate.
66 if (e.key == 'Enter') 67 if (e.key == 'Enter')
67 e.stopPropagation(); 68 e.stopPropagation();
68 }; 69 };
69 70
70 this.noMatchesLabel_ = getRequiredElement( 71 this.noMatchesLabel_ =
71 'language-dictionary-overlay-no-matches'); 72 getRequiredElement('language-dictionary-overlay-no-matches');
72 73
73 $('language-dictionary-overlay-done-button').onclick = function(e) { 74 $('language-dictionary-overlay-done-button').onclick = function(e) {
74 PageManager.closeOverlay(); 75 PageManager.closeOverlay();
75 }; 76 };
76 }, 77 },
77 78
78 /** 79 /**
79 * Refresh the dictionary words when the page is displayed. 80 * Refresh the dictionary words when the page is displayed.
80 * @override 81 * @override
81 */ 82 */
(...skipping 22 matching lines...) Expand all
104 105
105 EditDictionaryOverlay.updateWords = function(add_words, remove_words) { 106 EditDictionaryOverlay.updateWords = function(add_words, remove_words) {
106 EditDictionaryOverlay.getInstance().wordList_.addWords(add_words); 107 EditDictionaryOverlay.getInstance().wordList_.addWords(add_words);
107 EditDictionaryOverlay.getInstance().wordList_.removeWords(remove_words); 108 EditDictionaryOverlay.getInstance().wordList_.removeWords(remove_words);
108 }; 109 };
109 110
110 EditDictionaryOverlay.getWordListForTesting = function() { 111 EditDictionaryOverlay.getWordListForTesting = function() {
111 return EditDictionaryOverlay.getInstance().wordList_; 112 return EditDictionaryOverlay.getInstance().wordList_;
112 }; 113 };
113 114
114 return { 115 return {EditDictionaryOverlay: EditDictionaryOverlay};
115 EditDictionaryOverlay: EditDictionaryOverlay
116 };
117 }); 116 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698