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 // 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 Page = cr.ui.pageManager.Page; | 9 /** @const */ var Page = cr.ui.pageManager.Page; |
10 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 10 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * @const | 65 * @const |
66 */ | 66 */ |
67 var ENABLE_TRANSLATE = 'translate.enabled'; | 67 var ENABLE_TRANSLATE = 'translate.enabled'; |
68 | 68 |
69 ///////////////////////////////////////////////////////////////////////////// | 69 ///////////////////////////////////////////////////////////////////////////// |
70 // LanguageOptions class: | 70 // LanguageOptions class: |
71 | 71 |
72 /** | 72 /** |
73 * Encapsulated handling of ChromeOS language options page. | 73 * Encapsulated handling of ChromeOS language options page. |
74 * @constructor | 74 * @constructor |
| 75 * @extends {cr.ui.pageManager.Page} |
75 */ | 76 */ |
76 function LanguageOptions(model) { | 77 function LanguageOptions(model) { |
77 Page.call(this, 'languages', | 78 Page.call(this, 'languages', |
78 loadTimeData.getString('languagePageTabTitle'), 'languagePage'); | 79 loadTimeData.getString('languagePageTabTitle'), 'languagePage'); |
79 } | 80 } |
80 | 81 |
81 cr.addSingletonGetter(LanguageOptions); | 82 cr.addSingletonGetter(LanguageOptions); |
82 | 83 |
83 // Inherit LanguageOptions from Page. | 84 // Inherit LanguageOptions from Page. |
84 LanguageOptions.prototype = { | 85 LanguageOptions.prototype = { |
85 __proto__: Page.prototype, | 86 __proto__: Page.prototype, |
86 | 87 |
87 /** | 88 /** |
88 * For recording the prospective language (the next locale after relaunch). | 89 * For recording the prospective language (the next locale after relaunch). |
89 * @type {?string} | 90 * @type {?string} |
90 * @private | 91 * @private |
91 */ | 92 */ |
92 prospectiveUiLanguageCode_: null, | 93 prospectiveUiLanguageCode_: null, |
93 | 94 |
94 /** | 95 /** |
95 * Map from language code to spell check dictionary download status for that | 96 * Map from language code to spell check dictionary download status for that |
96 * language. | 97 * language. |
97 * @type {Array} | 98 * @type {Array} |
98 * @private | 99 * @private |
99 */ | 100 */ |
100 spellcheckDictionaryDownloadStatus_: [], | 101 spellcheckDictionaryDownloadStatus_: [], |
101 | 102 |
102 /** | 103 /** |
103 * Number of times a spell check dictionary download failed. | 104 * Number of times a spell check dictionary download failed. |
104 * @type {int} | 105 * @type {number} |
105 * @private | 106 * @private |
106 */ | 107 */ |
107 spellcheckDictionaryDownloadFailures_: 0, | 108 spellcheckDictionaryDownloadFailures_: 0, |
108 | 109 |
109 /** | 110 /** |
110 * The list of preload engines, like ['mozc', 'pinyin']. | 111 * The list of preload engines, like ['mozc', 'pinyin']. |
111 * @type {Array} | 112 * @type {Array} |
112 * @private | 113 * @private |
113 */ | 114 */ |
114 preloadEngines_: [], | 115 preloadEngines_: [], |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 // necessary as a language code for Translate server. | 1326 // necessary as a language code for Translate server. |
1326 return languageCode; | 1327 return languageCode; |
1327 } | 1328 } |
1328 | 1329 |
1329 return main; | 1330 return main; |
1330 }, | 1331 }, |
1331 }; | 1332 }; |
1332 | 1333 |
1333 /** | 1334 /** |
1334 * Shows the node at |index| in |nodes|, hides all others. | 1335 * Shows the node at |index| in |nodes|, hides all others. |
1335 * @param {Array<HTMLElement>} nodes The nodes to be shown or hidden. | 1336 * @param {Array.<HTMLElement>} nodes The nodes to be shown or hidden. |
1336 * @param {number} index The index of |nodes| to show. | 1337 * @param {number} index The index of |nodes| to show. |
1337 */ | 1338 */ |
1338 function showMutuallyExclusiveNodes(nodes, index) { | 1339 function showMutuallyExclusiveNodes(nodes, index) { |
1339 assert(index >= 0 && index < nodes.length); | 1340 assert(index >= 0 && index < nodes.length); |
1340 for (var i = 0; i < nodes.length; ++i) { | 1341 for (var i = 0; i < nodes.length; ++i) { |
1341 assert(nodes[i] instanceof HTMLElement); // TODO(dbeam): Ignore null? | 1342 assert(nodes[i] instanceof HTMLElement); // TODO(dbeam): Ignore null? |
1342 nodes[i].hidden = i != index; | 1343 nodes[i].hidden = i != index; |
1343 } | 1344 } |
1344 } | 1345 } |
1345 | 1346 |
(...skipping 11 matching lines...) Expand all Loading... |
1357 | 1358 |
1358 LanguageOptions.onDictionaryDownloadFailure = function(languageCode) { | 1359 LanguageOptions.onDictionaryDownloadFailure = function(languageCode) { |
1359 LanguageOptions.getInstance().onDictionaryDownloadFailure_(languageCode); | 1360 LanguageOptions.getInstance().onDictionaryDownloadFailure_(languageCode); |
1360 }; | 1361 }; |
1361 | 1362 |
1362 // Export | 1363 // Export |
1363 return { | 1364 return { |
1364 LanguageOptions: LanguageOptions | 1365 LanguageOptions: LanguageOptions |
1365 }; | 1366 }; |
1366 }); | 1367 }); |
OLD | NEW |