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

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

Issue 12087105: Use drop-down UI for "add language". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasing Created 7 years, 10 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 /////////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////////
6 // AddLanguageOverlay class: 6 // AddLanguageOverlay class:
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 10
(...skipping 26 matching lines...) Expand all
37 OptionsPage.closeOverlay(); 37 OptionsPage.closeOverlay();
38 }; 38 };
39 39
40 // Create the language list with which users can add a language. 40 // Create the language list with which users can add a language.
41 var addLanguageList = $('add-language-overlay-language-list'); 41 var addLanguageList = $('add-language-overlay-language-list');
42 var languageListData = loadTimeData.getValue('languageList'); 42 var languageListData = loadTimeData.getValue('languageList');
43 for (var i = 0; i < languageListData.length; i++) { 43 for (var i = 0; i < languageListData.length; i++) {
44 var language = languageListData[i]; 44 var language = languageListData[i];
45 var displayText = language.displayName; 45 var displayText = language.displayName;
46 // If the native name is different, add it. 46 // If the native name is different, add it.
47 if (language.displayName != language.nativeDisplayName) { 47 if (language.displayName != language.nativeDisplayName)
48 displayText += ' - ' + language.nativeDisplayName; 48 displayText += ' - ' + language.nativeDisplayName;
49 }
50 49
51 if (cr.isChromeOS) { 50 var option = cr.doc.createElement('option');
52 var button = document.createElement('button'); 51 option.value = language.code;
53 button.className = 'link-button'; 52 option.textContent = displayText;
54 button.textContent = displayText; 53 addLanguageList.appendChild(option);
55 button.languageCode = language.code;
56 var li = document.createElement('li');
57 li.languageCode = language.code;
58 li.appendChild(button);
59 addLanguageList.appendChild(li);
60 } else {
61 var option = document.createElement('option');
62 option.value = language.code;
63 option.textContent = displayText;
64 addLanguageList.appendChild(option);
65 }
66 } 54 }
67 }, 55 },
68 }; 56 };
69 57
70 return { 58 return {
71 AddLanguageOverlay: AddLanguageOverlay 59 AddLanguageOverlay: AddLanguageOverlay
72 }; 60 };
73 }); 61 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698