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

Side by Side Diff: chrome/browser/resources/settings/languages_page/languages_page.js

Issue 2827553002: MD Settings: Use a browser proxy from the languages page. Re-enable test. (Closed)
Patch Set: Make inputMethodPrivate CrOS only Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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-languages-page' is the settings page 6 * @fileoverview 'settings-languages-page' is the settings page
7 * for language and input method settings. 7 * for language and input method settings.
8 */ 8 */
9 cr.exportPath('settings'); 9 cr.exportPath('settings');
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // <if expr="chromeos"> 74 // <if expr="chromeos">
75 map.set( 75 map.set(
76 settings.Route.INPUT_METHODS.path, 76 settings.Route.INPUT_METHODS.path,
77 '#inputMethodsCollapse .subpage-arrow'); 77 '#inputMethodsCollapse .subpage-arrow');
78 // </if> 78 // </if>
79 return map; 79 return map;
80 }, 80 },
81 }, 81 },
82 }, 82 },
83 83
84 /** @private {?settings.LanguagesBrowserProxy} */
85 browserProxy_: null,
86
87 /** @override */
88 attached: function() {
89 this.browserProxy_ = settings.LanguagesBrowserProxyImpl.getInstance();
90 },
91
84 /** 92 /**
85 * Stamps and opens the Add Languages dialog, registering a listener to 93 * Stamps and opens the Add Languages dialog, registering a listener to
86 * disable the dialog's dom-if again on close. 94 * disable the dialog's dom-if again on close.
87 * @param {!Event} e 95 * @param {!Event} e
88 * @private 96 * @private
89 */ 97 */
90 onAddLanguagesTap_: function(e) { 98 onAddLanguagesTap_: function(e) {
91 e.preventDefault(); 99 e.preventDefault();
92 this.showAddLanguagesDialog_ = true; 100 this.showAddLanguagesDialog_ = true;
93 this.async(function() { 101 this.async(function() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 onInputMethodTap_: function(e) { 191 onInputMethodTap_: function(e) {
184 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_. 192 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_.
185 if (e.target.tagName == 'PAPER-ICON-BUTTON') 193 if (e.target.tagName == 'PAPER-ICON-BUTTON')
186 return; 194 return;
187 195
188 // Ignore key presses other than <Enter>. 196 // Ignore key presses other than <Enter>.
189 if (e.type == 'keypress' && e.key != 'Enter') 197 if (e.type == 'keypress' && e.key != 'Enter')
190 return; 198 return;
191 199
192 // Set the input method. 200 // Set the input method.
193 this.languageHelper.setCurrentInputMethod(e.model.item.id); 201 this.browserProxy_.getInputMethodPrivate().setCurrentInputMethod(
202 e.model.item.id);
194 }, 203 },
195 204
196 /** 205 /**
197 * Opens the input method extension's options page in a new tab (or focuses 206 * Opens the input method extension's options page in a new tab (or focuses
198 * an existing instance of the IME's options). 207 * an existing instance of the IME's options).
199 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e 208 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e
200 * @private 209 * @private
201 */ 210 */
202 onInputMethodOptionsTap_: function(e) { 211 onInputMethodOptionsTap_: function(e) {
203 this.languageHelper.openInputMethodOptions(e.model.item.id); 212 this.browserProxy_.getInputMethodPrivate().openOptionsPage(
213 e.model.item.id);
204 }, 214 },
205 // </if> 215 // </if>
206 216
207 // <if expr="chromeos or is_win"> 217 // <if expr="chromeos or is_win">
208 /** 218 /**
209 * @return {boolean} True for a secondary user in a multi-profile session. 219 * @return {boolean} True for a secondary user in a multi-profile session.
210 * @private 220 * @private
211 */ 221 */
212 isSecondaryUser_: function() { 222 isSecondaryUser_: function() {
213 return cr.isChromeOS && loadTimeData.getBoolean('isSecondaryUser'); 223 return cr.isChromeOS && loadTimeData.getBoolean('isSecondaryUser');
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 262
253 /** 263 /**
254 * Handler for changes to the UI language checkbox. 264 * Handler for changes to the UI language checkbox.
255 * @param {!{target: !PaperCheckboxElement}} e 265 * @param {!{target: !PaperCheckboxElement}} e
256 * @private 266 * @private
257 */ 267 */
258 onUILanguageChange_: function(e) { 268 onUILanguageChange_: function(e) {
259 // We don't support unchecking this checkbox. TODO(michaelpg): Ask for a 269 // We don't support unchecking this checkbox. TODO(michaelpg): Ask for a
260 // simpler widget. 270 // simpler widget.
261 assert(e.target.checked); 271 assert(e.target.checked);
262 this.languageHelper.setProspectiveUILanguage( 272 this.browserProxy_.setProspectiveUILanguage(
263 this.detailLanguage_.language.code); 273 this.detailLanguage_.language.code);
264 274
265 this.closeMenuSoon_(); 275 this.closeMenuSoon_();
266 }, 276 },
267 // </if> 277 // </if>
268 278
269 /** 279 /**
270 * @param {!chrome.languageSettingsPrivate.Language} language 280 * @param {!chrome.languageSettingsPrivate.Language} language
271 * @param {string} targetLanguageCode The default translate target language. 281 * @param {string} targetLanguageCode The default translate target language.
272 * @return {boolean} True if the translate checkbox should be disabled. 282 * @return {boolean} True if the translate checkbox should be disabled.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (e.target.tagName == expandButtonTag) 569 if (e.target.tagName == expandButtonTag)
560 return; 570 return;
561 571
562 /** @type {!CrExpandButtonElement} */ 572 /** @type {!CrExpandButtonElement} */
563 var expandButton = e.currentTarget.querySelector(expandButtonTag); 573 var expandButton = e.currentTarget.querySelector(expandButtonTag);
564 assert(expandButton); 574 assert(expandButton);
565 expandButton.expanded = !expandButton.expanded; 575 expandButton.expanded = !expandButton.expanded;
566 }, 576 },
567 }); 577 });
568 })(); 578 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698