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

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

Issue 10827141: Move handling of dialog preferences to Preferences class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed PrefCheckbox. Created 8 years, 3 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 | Annotate | Revision Log
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 ArrayDataModel = cr.ui.ArrayDataModel; 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
7 /** @const */ var DeletableItem = options.DeletableItem; 7 /** @const */ var DeletableItem = options.DeletableItem;
8 /** @const */ var DeletableItemList = options.DeletableItemList; 8 /** @const */ var DeletableItemList = options.DeletableItemList;
9 /** @const */ var List = cr.ui.List; 9 /** @const */ var List = cr.ui.List;
10 /** @const */ var ListItem = cr.ui.ListItem; 10 /** @const */ var ListItem = cr.ui.ListItem;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 }, 397 },
398 398
399 /** 399 /**
400 * Saves the preference. 400 * Saves the preference.
401 */ 401 */
402 savePreference_: function() { 402 savePreference_: function() {
403 // Encode the language codes into a CSV string. 403 // Encode the language codes into a CSV string.
404 if (cr.isChromeOS) 404 if (cr.isChromeOS)
405 Preferences.setStringPref(this.preferredLanguagesPref, 405 Preferences.setStringPref(this.preferredLanguagesPref,
406 this.dataModel.slice().join(',')); 406 this.dataModel.slice().join(','), true);
407 // Save the same language list as accept languages preference as 407 // Save the same language list as accept languages preference as
408 // well, but we need to expand the language list, to make it more 408 // well, but we need to expand the language list, to make it more
409 // acceptable. For instance, some web sites don't understand 'en-US' 409 // acceptable. For instance, some web sites don't understand 'en-US'
410 // but 'en'. See crosbug.com/9884. 410 // but 'en'. See crosbug.com/9884.
411 var acceptLanguages = this.expandLanguageCodes(this.dataModel.slice()); 411 var acceptLanguages = this.expandLanguageCodes(this.dataModel.slice());
412 Preferences.setStringPref(this.acceptLanguagesPref, 412 Preferences.setStringPref(this.acceptLanguagesPref,
413 acceptLanguages.join(',')); 413 acceptLanguages.join(','), true);
414 cr.dispatchSimpleEvent(this, 'save'); 414 cr.dispatchSimpleEvent(this, 'save');
415 }, 415 },
416 416
417 /** 417 /**
418 * Expands language codes to make these more suitable for Accept-Language. 418 * Expands language codes to make these more suitable for Accept-Language.
419 * Example: ['en-US', 'ja', 'en-CA'] => ['en-US', 'en', 'ja', 'en-CA']. 419 * Example: ['en-US', 'ja', 'en-CA'] => ['en-US', 'en', 'ja', 'en-CA'].
420 * 'en' won't appear twice as this function eliminates duplicates. 420 * 'en' won't appear twice as this function eliminates duplicates.
421 * @param {Array} languageCodes List of language codes. 421 * @param {Array} languageCodes List of language codes.
422 * @private 422 * @private
423 */ 423 */
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 return filteredLanguageCodes; 460 return filteredLanguageCodes;
461 }, 461 },
462 }; 462 };
463 463
464 return { 464 return {
465 LanguageList: LanguageList, 465 LanguageList: LanguageList,
466 LanguageListItem: LanguageListItem 466 LanguageListItem: LanguageListItem
467 }; 467 };
468 }); 468 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/import_data_overlay.js ('k') | chrome/browser/resources/options/language_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698