OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @fileoverview 'settings-add-languages-dialog' is a dialog for enabling | 6 * @fileoverview 'settings-add-languages-dialog' is a dialog for enabling |
7 * languages. | 7 * languages. |
8 */ | 8 */ |
9 Polymer({ | 9 Polymer({ |
10 is: 'settings-add-languages-dialog', | 10 is: 'settings-add-languages-dialog', |
11 | 11 |
| 12 behaviors: [ |
| 13 CrScrollableBehavior, |
| 14 ], |
| 15 |
12 properties: { | 16 properties: { |
13 /** @type {!LanguagesModel|undefined} */ | 17 /** @type {!LanguagesModel|undefined} */ |
14 languages: { | 18 languages: { |
15 type: Object, | 19 type: Object, |
16 notify: true, | 20 notify: true, |
17 }, | 21 }, |
18 | 22 |
19 /** @type {!LanguageHelper} */ | 23 /** @type {!LanguageHelper} */ |
20 languageHelper: Object, | 24 languageHelper: Object, |
21 | 25 |
22 /** @private {!Set<string>} */ | 26 /** @private {!Set<string>} */ |
23 languagesToAdd_: { | 27 languagesToAdd_: { |
24 type: Object, | 28 type: Object, |
25 value: function() { return new Set(); }, | 29 value: function() { |
| 30 return new Set(); |
| 31 }, |
26 }, | 32 }, |
27 | 33 |
28 /** @private */ | 34 /** @private */ |
29 disableActionButton_: { | 35 disableActionButton_: { |
30 type: Boolean, | 36 type: Boolean, |
31 value: true, | 37 value: true, |
32 }, | 38 }, |
33 | 39 |
34 /** @private */ | 40 /** @private */ |
35 filterValue_: { | 41 filterValue_: { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 this.filterValue_.toLowerCase()); | 77 this.filterValue_.toLowerCase()); |
72 }.bind(this)); | 78 }.bind(this)); |
73 }, | 79 }, |
74 | 80 |
75 /** | 81 /** |
76 * @param {!chrome.languageSettingsPrivate.Language} language | 82 * @param {!chrome.languageSettingsPrivate.Language} language |
77 * @return {string} The text to be displayed. | 83 * @return {string} The text to be displayed. |
78 * @private | 84 * @private |
79 */ | 85 */ |
80 getDisplayText_: function(language) { | 86 getDisplayText_: function(language) { |
81 var displayText = language.displayName; | 87 var displayText = language.displayName; |
82 // If the native name is different, add it. | 88 // If the native name is different, add it. |
83 if (language.displayName != language.nativeDisplayName) | 89 if (language.displayName != language.nativeDisplayName) |
84 displayText += ' - ' + language.nativeDisplayName; | 90 displayText += ' - ' + language.nativeDisplayName; |
85 return displayText; | 91 return displayText; |
86 }, | 92 }, |
87 | 93 |
88 /** | 94 /** |
89 * True if the user has chosen to add this language (checked its checkbox). | 95 * True if the user has chosen to add this language (checked its checkbox). |
90 * @param {string} languageCode | 96 * @param {string} languageCode |
91 * @return {boolean} | 97 * @return {boolean} |
92 * @private | 98 * @private |
93 */ | 99 */ |
94 willAdd_: function(languageCode) { | 100 willAdd_: function(languageCode) { |
95 return this.languagesToAdd_.has(languageCode); | 101 return this.languagesToAdd_.has(languageCode); |
(...skipping 28 matching lines...) Expand all Loading... |
124 * Enables the checked languages. | 130 * Enables the checked languages. |
125 * @private | 131 * @private |
126 */ | 132 */ |
127 onActionButtonTap_: function() { | 133 onActionButtonTap_: function() { |
128 this.$.dialog.close(); | 134 this.$.dialog.close(); |
129 this.languagesToAdd_.forEach(function(languageCode) { | 135 this.languagesToAdd_.forEach(function(languageCode) { |
130 this.languageHelper.enableLanguage(languageCode); | 136 this.languageHelper.enableLanguage(languageCode); |
131 }.bind(this)); | 137 }.bind(this)); |
132 }, | 138 }, |
133 }); | 139 }); |
OLD | NEW |