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

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

Issue 389913002: Moving IME manifests to chrome resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed duplicated XKB extension loading. Created 6 years, 4 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 // TODO(kochi): Generalize the notification as a component and put it 5 // TODO(kochi): Generalize the notification as a component and put it
6 // in js/cr/ui/notification.js . 6 // in js/cr/ui/notification.js .
7 7
8 cr.define('options', function() { 8 cr.define('options', function() {
9 /** @const */ var OptionsPage = options.OptionsPage; 9 /** @const */ var OptionsPage = options.OptionsPage;
10 /** @const */ var LanguageList = options.LanguageList; 10 /** @const */ var LanguageList = options.LanguageList;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 TRANSLATE_BLOCKED_LANGUAGES_PREF, 189 TRANSLATE_BLOCKED_LANGUAGES_PREF,
190 this.handleTranslateBlockedLanguagesPrefChange_.bind(this)); 190 this.handleTranslateBlockedLanguagesPrefChange_.bind(this));
191 Preferences.getInstance().addEventListener(SPELL_CHECK_DICTIONARY_PREF, 191 Preferences.getInstance().addEventListener(SPELL_CHECK_DICTIONARY_PREF,
192 this.handleSpellCheckDictionaryPrefChange_.bind(this)); 192 this.handleSpellCheckDictionaryPrefChange_.bind(this));
193 Preferences.getInstance().addEventListener(ENABLE_TRANSLATE, 193 Preferences.getInstance().addEventListener(ENABLE_TRANSLATE,
194 this.handleEnableTranslatePrefChange_.bind(this)); 194 this.handleEnableTranslatePrefChange_.bind(this));
195 this.translateSupportedLanguages_ = 195 this.translateSupportedLanguages_ =
196 loadTimeData.getValue('translateSupportedLanguages'); 196 loadTimeData.getValue('translateSupportedLanguages');
197 197
198 // Set up add button. 198 // Set up add button.
199 $('language-options-add-button').onclick = function(e) { 199 var onclick = function(e) {
200 // Add the language without showing the overlay if it's specified in 200 // Add the language without showing the overlay if it's specified in
201 // the URL hash (ex. lang_add=ja). Used for automated testing. 201 // the URL hash (ex. lang_add=ja). Used for automated testing.
202 var match = document.location.hash.match(/\blang_add=([\w-]+)/); 202 var match = document.location.hash.match(/\blang_add=([\w-]+)/);
203 if (match) { 203 if (match) {
204 var addLanguageCode = match[1]; 204 var addLanguageCode = match[1];
205 $('language-options-list').addLanguage(addLanguageCode); 205 $('language-options-list').addLanguage(addLanguageCode);
206 this.addBlockedLanguage_(addLanguageCode); 206 this.addBlockedLanguage_(addLanguageCode);
207 } else { 207 } else {
208 OptionsPage.navigateToPage('addLanguage'); 208 OptionsPage.navigateToPage('addLanguage');
209 } 209 }
210 }.bind(this); 210 };
211 $('language-options-add-button').onclick = onclick.bind(this);
211 212
212 if (!cr.isMac) { 213 if (!cr.isMac) {
213 // Set up the button for editing custom spelling dictionary. 214 // Set up the button for editing custom spelling dictionary.
214 $('edit-dictionary-button').onclick = function(e) { 215 $('edit-dictionary-button').onclick = function(e) {
215 OptionsPage.navigateToPage('editDictionary'); 216 OptionsPage.navigateToPage('editDictionary');
216 }; 217 };
217 $('dictionary-download-retry-button').onclick = function(e) { 218 $('dictionary-download-retry-button').onclick = function(e) {
218 chrome.send('retryDictionaryDownload'); 219 chrome.send('retryDictionaryDownload');
219 }; 220 };
220 } 221 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 input.imeProvider = inputMethod.extensionName; 328 input.imeProvider = inputMethod.extensionName;
328 var span = element.querySelector('span'); 329 var span = element.querySelector('span');
329 span.textContent = inputMethod.displayName; 330 span.textContent = inputMethod.displayName;
330 331
331 if (inputMethod.optionsPage) { 332 if (inputMethod.optionsPage) {
332 var button = document.createElement('button'); 333 var button = document.createElement('button');
333 button.textContent = loadTimeData.getString('configure'); 334 button.textContent = loadTimeData.getString('configure');
334 button.inputMethodId = inputMethod.id; 335 button.inputMethodId = inputMethod.id;
335 button.onclick = function(inputMethodId, e) { 336 button.onclick = function(inputMethodId, e) {
336 chrome.send('inputMethodOptionsOpen', [inputMethodId]); 337 chrome.send('inputMethodOptionsOpen', [inputMethodId]);
337 }.bind(this, inputMethod.id); 338 };
339 button.onclick = button.onclick.bind(this, inputMethod.id);
338 element.appendChild(button); 340 element.appendChild(button);
339 } 341 }
340 342
341 // Listen to user clicks. 343 // Listen to user clicks.
342 input.addEventListener('click', 344 input.addEventListener('click',
343 this.handleCheckboxClick_.bind(this)); 345 this.handleCheckboxClick_.bind(this));
344 inputMethodList.appendChild(element); 346 inputMethodList.appendChild(element);
345 } 347 }
346 }, 348 },
347 349
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 }; 1353 };
1352 1354
1353 LanguageOptions.onDictionaryDownloadSuccess = function(languageCode) { 1355 LanguageOptions.onDictionaryDownloadSuccess = function(languageCode) {
1354 LanguageOptions.getInstance().onDictionaryDownloadSuccess_(languageCode); 1356 LanguageOptions.getInstance().onDictionaryDownloadSuccess_(languageCode);
1355 }; 1357 };
1356 1358
1357 LanguageOptions.onDictionaryDownloadFailure = function(languageCode) { 1359 LanguageOptions.onDictionaryDownloadFailure = function(languageCode) {
1358 LanguageOptions.getInstance().onDictionaryDownloadFailure_(languageCode); 1360 LanguageOptions.getInstance().onDictionaryDownloadFailure_(languageCode);
1359 }; 1361 };
1360 1362
1361 LanguageOptions.onComponentManagerInitialized = function(componentImes) {
1362 LanguageOptions.getInstance().appendComponentExtensionIme_(componentImes);
1363 };
1364
1365 // Export 1363 // Export
1366 return { 1364 return {
1367 LanguageOptions: LanguageOptions 1365 LanguageOptions: LanguageOptions
1368 }; 1366 };
1369 }); 1367 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698