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

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

Issue 2822863002: MD Settings: Languages; limit platform specific code to the respective platform. (Closed)
Patch Set: Undo 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 * @type {!LanguagesModel|undefined} 35 * @type {!LanguagesModel|undefined}
36 */ 36 */
37 languages: { 37 languages: {
38 type: Object, 38 type: Object,
39 notify: true, 39 notify: true,
40 }, 40 },
41 41
42 /** @type {!LanguageHelper} */ 42 /** @type {!LanguageHelper} */
43 languageHelper: Object, 43 languageHelper: Object,
44 44
45 // <if expr="not is_macosx">
45 /** @private */ 46 /** @private */
46 spellCheckSecondaryText_: { 47 spellCheckSecondaryText_: {
47 type: String, 48 type: String,
48 value: '', 49 value: '',
49 computed: 'getSpellCheckSecondaryText_(languages.enabled.*)', 50 computed: 'getSpellCheckSecondaryText_(languages.enabled.*)',
50 }, 51 },
52 // </if>
51 53
52 /** 54 /**
53 * The language to display the details for. 55 * The language to display the details for.
54 * @type {!LanguageState|undefined} 56 * @type {!LanguageState|undefined}
55 * @private 57 * @private
56 */ 58 */
57 detailLanguage_: Object, 59 detailLanguage_: Object,
58 60
59 /** @private */ 61 /** @private */
60 showAddLanguagesDialog_: Boolean, 62 showAddLanguagesDialog_: Boolean,
(...skipping 12 matching lines...) Expand all
73 map.set( 75 map.set(
74 settings.Route.INPUT_METHODS.path, 76 settings.Route.INPUT_METHODS.path,
75 '#inputMethodsCollapse .subpage-arrow'); 77 '#inputMethodsCollapse .subpage-arrow');
76 // </if> 78 // </if>
77 return map; 79 return map;
78 }, 80 },
79 }, 81 },
80 }, 82 },
81 83
82 /** 84 /**
83 * Handler for enabling or disabling spell check.
84 * @param {!{target: Element, model: !{item: !LanguageState}}} e
85 */
86 onSpellCheckChange_: function(e) {
87 var item = e.model.item;
88 if (!item.language.supportsSpellcheck)
89 return;
90
91 this.languageHelper.toggleSpellCheck(item.language.code,
92 !item.spellCheckEnabled);
93 },
94
95 /** @private */
96 onBackTap_: function() {
dpapad 2017/04/15 00:34:49 Dead code.
97 this.$.pages.back();
98 },
99
100 /**
101 * Stamps and opens the Add Languages dialog, registering a listener to 85 * Stamps and opens the Add Languages dialog, registering a listener to
102 * disable the dialog's dom-if again on close. 86 * disable the dialog's dom-if again on close.
103 * @param {!Event} e 87 * @param {!Event} e
104 * @private 88 * @private
105 */ 89 */
106 onAddLanguagesTap_: function(e) { 90 onAddLanguagesTap_: function(e) {
107 e.preventDefault(); 91 e.preventDefault();
108 this.showAddLanguagesDialog_ = true; 92 this.showAddLanguagesDialog_ = true;
109 this.async(function() { 93 this.async(function() {
110 var dialog = this.$$('settings-add-languages-dialog'); 94 var dialog = this.$$('settings-add-languages-dialog');
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }, 137 },
154 138
155 /** 139 /**
156 * @param {!Object} change Polymer change object for languages.enabled.*. 140 * @param {!Object} change Polymer change object for languages.enabled.*.
157 * @return {boolean} True if there are less than 2 languages. 141 * @return {boolean} True if there are less than 2 languages.
158 */ 142 */
159 isHelpTextHidden_: function(change) { 143 isHelpTextHidden_: function(change) {
160 return this.languages.enabled.length <= 1; 144 return this.languages.enabled.length <= 1;
161 }, 145 },
162 146
147 // <if expr="chromeos">
148 /**
149 * @return {boolean} True for a secondary user in a multi-profile session.
150 * @private
151 */
152 isSecondaryUser_: function() {
153 return loadTimeData.getBoolean('isSecondaryUser');
154 },
155
156 /**
157 * Applies Chrome OS session tweaks to the menu.
158 * @param {!CrActionMenuElement} menu
159 * @private
160 */
161 initializeMenu_: function(menu) {
162 // In a CrOS multi-user session, the primary user controls the UI language.
163 // TODO(michaelpg): The language selection should not be hidden, but should
164 // show a policy indicator. crbug.com/648498
165 if (this.isSecondaryUser_())
166 menu.querySelector('#uiLanguageItem').hidden = true;
167
168 // The UI language choice doesn't persist for guests.
169 if (uiAccountTweaks.UIAccountTweaks.loggedInAsGuest() ||
170 uiAccountTweaks.UIAccountTweaks.loggedInAsPublicAccount()) {
171 menu.querySelector('#uiLanguageItem').hidden = true;
172 }
173 },
174
175 /**
176 * Opens the Manage Input Methods page.
177 * @private
178 */
179 onManageInputMethodsTap_: function() {
180 settings.navigateTo(settings.Route.INPUT_METHODS);
181 },
182
183 /**
184 * Handler for tap and <Enter> events on an input method on the main page,
185 * which sets it as the current input method.
186 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod},
187 * target: !{tagName: string},
188 * type: string,
189 * key: (string|undefined)}} e
190 */
191 onInputMethodTap_: function(e) {
192 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_.
193 if (e.target.tagName == 'PAPER-ICON-BUTTON')
194 return;
195
196 // Ignore key presses other than <Enter>.
197 if (e.type == 'keypress' && e.key != 'Enter')
198 return;
199
200 // Set the input method.
201 this.languageHelper.setCurrentInputMethod(e.model.item.id);
202 },
203
204 /**
205 * Opens the input method extension's options page in a new tab (or focuses
206 * an existing instance of the IME's options).
207 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e
208 * @private
209 */
210 onInputMethodOptionsTap_: function(e) {
211 this.languageHelper.openInputMethodOptions(e.model.item.id);
212 },
213 // </if>
214
215 // <if expr="chromeos or is_win">
216 /**
217 * @param {string} languageCode The language code identifying a language.
218 * @param {string} prospectiveUILanguage The prospective UI language.
219 * @return {boolean} True if the prospective UI language is set to
220 * |languageCode| but requires a restart to take effect.
221 * @private
222 */
223 isRestartRequired_: function(languageCode, prospectiveUILanguage) {
224 return prospectiveUILanguage == languageCode &&
225 this.languageHelper.requiresRestart();
226 },
227
163 /** 228 /**
164 * @param {!LanguageState} languageState 229 * @param {!LanguageState} languageState
165 * @param {string} prospectiveUILanguage The chosen UI language. 230 * @param {string} prospectiveUILanguage The chosen UI language.
166 * @return {boolean} True if the given language cannot be set as the 231 * @return {boolean} True if the given language cannot be set as the
167 * prospective UI language by the user. 232 * prospective UI language by the user.
168 * @private 233 * @private
169 */ 234 */
170 disableUILanguageCheckbox_: function(languageState, prospectiveUILanguage) { 235 disableUILanguageCheckbox_: function(languageState, prospectiveUILanguage) {
171 // UI language setting belongs to the primary user. 236 // UI language setting belongs to the primary user.
172 if (this.isSecondaryUser_()) 237 if (this.isSecondaryUser_())
173 return true; 238 return true;
174 239
175 // If the language cannot be a UI language, we can't set it as the 240 // If the language cannot be a UI language, we can't set it as the
176 // prospective UI language. 241 // prospective UI language.
177 if (!languageState.language.supportsUI) 242 if (!languageState.language.supportsUI)
178 return true; 243 return true;
179 244
180 // Unchecking the currently chosen language doesn't make much sense. 245 // Unchecking the currently chosen language doesn't make much sense.
181 if (languageState.language.code == prospectiveUILanguage) 246 if (languageState.language.code == prospectiveUILanguage)
182 return true; 247 return true;
183 248
184 // Otherwise, the prospective language can be changed to this language. 249 // Otherwise, the prospective language can be changed to this language.
185 return false; 250 return false;
186 }, 251 },
187 252
188 /** 253 /**
189 * @return {boolean} True for a secondary user in a multi-profile session.
190 * @private
191 */
192 isSecondaryUser_: function() {
193 return cr.isChromeOS && loadTimeData.getBoolean('isSecondaryUser');
194 },
195
196 /**
197 * Handler for changes to the UI language checkbox. 254 * Handler for changes to the UI language checkbox.
198 * @param {!{target: !PaperCheckboxElement}} e 255 * @param {!{target: !PaperCheckboxElement}} e
199 * @private 256 * @private
200 */ 257 */
201 onUILanguageChange_: function(e) { 258 onUILanguageChange_: function(e) {
202 // We don't support unchecking this checkbox. TODO(michaelpg): Ask for a 259 // We don't support unchecking this checkbox. TODO(michaelpg): Ask for a
203 // simpler widget. 260 // simpler widget.
204 assert(e.target.checked); 261 assert(e.target.checked);
205 this.languageHelper.setProspectiveUILanguage( 262 this.languageHelper.setProspectiveUILanguage(
206 this.detailLanguage_.language.code); 263 this.detailLanguage_.language.code);
207 264
208 this.closeMenuSoon_(); 265 this.closeMenuSoon_();
209 }, 266 },
267 // </if>
210 268
211 /** 269 /**
212 * @param {!chrome.languageSettingsPrivate.Language} language 270 * @param {!chrome.languageSettingsPrivate.Language} language
213 * @param {string} targetLanguageCode The default translate target language. 271 * @param {string} targetLanguageCode The default translate target language.
214 * @return {boolean} True if the translate checkbox should be disabled. 272 * @return {boolean} True if the translate checkbox should be disabled.
215 * @private 273 * @private
216 */ 274 */
217 disableTranslateCheckbox_: function(language, targetLanguageCode) { 275 disableTranslateCheckbox_: function(language, targetLanguageCode) {
218 if (!language.supportsTranslate) 276 if (!language.supportsTranslate)
219 return true; 277 return true;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 337
280 /** 338 /**
281 * Disables the language. 339 * Disables the language.
282 * @private 340 * @private
283 */ 341 */
284 onRemoveLanguageTap_: function() { 342 onRemoveLanguageTap_: function() {
285 /** @type {!CrActionMenuElement} */(this.$.menu.get()).close(); 343 /** @type {!CrActionMenuElement} */(this.$.menu.get()).close();
286 this.languageHelper.disableLanguage(this.detailLanguage_.language.code); 344 this.languageHelper.disableLanguage(this.detailLanguage_.language.code);
287 }, 345 },
288 346
347 // <if expr="chromeos or is_win">
289 /** 348 /**
290 * Opens the Manage Input Methods page. 349 * Checks whether the prospective UI language (the pref that indicates what
350 * language to use in Chrome) matches the current language. This pref is used
351 * only on Chrome OS and Windows; we don't control the UI language elsewhere.
352 * @param {string} languageCode The language code identifying a language.
353 * @param {string} prospectiveUILanguage The prospective UI language.
354 * @return {boolean} True if the given language matches the prospective UI
355 * pref (which may be different from the actual UI language).
291 * @private 356 * @private
292 */ 357 */
293 onManageInputMethodsTap_: function() { 358 isProspectiveUILanguage_: function(languageCode, prospectiveUILanguage) {
294 assert(cr.isChromeOS); 359 assert(cr.isChromeOS || cr.isWindows);
295 settings.navigateTo(settings.Route.INPUT_METHODS); 360 return languageCode == prospectiveUILanguage;
296 }, 361 },
297 362
363 /**
364 * @param {string} prospectiveUILanguage
365 * @return {string}
366 * @private
367 */
368 getProspectiveUILanguageName_: function(prospectiveUILanguage) {
369 return this.languageHelper.getLanguage(prospectiveUILanguage).displayName;
370 },
371 // </if>
372
298 /** 373 /**
299 * Handler for tap and <Enter> events on an input method on the main page, 374 * @return {string}
300 * which sets it as the current input method. 375 * @private
301 * @param {!{model: !{item: !chrome.languageSettingsPrivate.InputMethod},
302 * target: !{tagName: string},
303 * type: string,
304 * key: (string|undefined)}} e
305 */ 376 */
306 onInputMethodTap_: function(e) { 377 getLanguageListTwoLine_: function() {
307 assert(cr.isChromeOS); 378 return cr.isChromeOS || cr.isWindows ? 'two-line' : '';
308
309 // Taps on the paper-icon-button are handled in onInputMethodOptionsTap_.
310 if (e.target.tagName == 'PAPER-ICON-BUTTON')
311 return;
312
313 // Ignore key presses other than <Enter>.
314 if (e.type == 'keypress' && e.key != 'Enter')
315 return;
316
317 // Set the input method.
318 this.languageHelper.setCurrentInputMethod(e.model.item.id);
319 }, 379 },
320 380
321 /** 381 // <if expr="not is_macosx">
322 * Opens the input method extension's options page in a new tab (or focuses
323 * an existing instance of the IME's options).
324 * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e
325 * @private
326 */
327 onInputMethodOptionsTap_: function(e) {
328 assert(cr.isChromeOS);
329 this.languageHelper.openInputMethodOptions(e.model.item.id);
330 },
331
332 /** 382 /**
333 * Returns the secondary text for the spell check subsection based on the 383 * Returns the secondary text for the spell check subsection based on the
334 * enabled spell check languages, listing at most 2 languages. 384 * enabled spell check languages, listing at most 2 languages.
335 * @return {string} 385 * @return {string}
336 * @private 386 * @private
337 */ 387 */
338 getSpellCheckSecondaryText_: function() { 388 getSpellCheckSecondaryText_: function() {
339 var enabledSpellCheckLanguages = 389 var enabledSpellCheckLanguages =
340 this.languages.enabled.filter(function(languageState) { 390 this.languages.enabled.filter(function(languageState) {
341 return languageState.spellCheckEnabled && 391 return languageState.spellCheckEnabled &&
(...skipping 23 matching lines...) Expand all
365 enabledSpellCheckLanguages[1].language.displayName, 415 enabledSpellCheckLanguages[1].language.displayName,
366 (enabledSpellCheckLanguages.length - 2).toLocaleString()); 416 (enabledSpellCheckLanguages.length - 2).toLocaleString());
367 } 417 }
368 }, 418 },
369 419
370 /** 420 /**
371 * Opens the Custom Dictionary page. 421 * Opens the Custom Dictionary page.
372 * @private 422 * @private
373 */ 423 */
374 onEditDictionaryTap_: function() { 424 onEditDictionaryTap_: function() {
375 assert(!cr.isMac);
376 settings.navigateTo(settings.Route.EDIT_DICTIONARY); 425 settings.navigateTo(settings.Route.EDIT_DICTIONARY);
377 }, 426 },
378 427
379 /** 428 /**
380 * Checks whether the prospective UI language (the pref that indicates what 429 * Handler for enabling or disabling spell check.
381 * language to use in Chrome) matches the current language. This pref is used 430 * @param {!{target: Element, model: !{item: !LanguageState}}} e
382 * only on Chrome OS and Windows; we don't control the UI language elsewhere.
383 * @param {string} languageCode The language code identifying a language.
384 * @param {string} prospectiveUILanguage The prospective UI language.
385 * @return {boolean} True if the given language matches the prospective UI
386 * pref (which may be different from the actual UI language).
387 * @private
388 */ 431 */
389 isProspectiveUILanguage_: function(languageCode, prospectiveUILanguage) { 432 onSpellCheckChange_: function(e) {
390 assert(cr.isChromeOS || cr.isWindows); 433 var item = e.model.item;
391 return languageCode == prospectiveUILanguage; 434 if (!item.language.supportsSpellcheck)
392 }, 435 return;
393 436
394 // <if expr="chromeos or is_win"> 437 this.languageHelper.toggleSpellCheck(item.language.code,
395 /** 438 !item.spellCheckEnabled);
396 * @param {string} prospectiveUILanguage
397 * @return {string}
398 * @private
399 */
400 getProspectiveUILanguageName_: function(prospectiveUILanguage) {
401 return this.languageHelper.getLanguage(prospectiveUILanguage).displayName;
402 },
403 // </if>
404
405 /**
406 * @return {string}
407 * @private
408 */
409 getLanguageListTwoLine_: function() {
410 return cr.isChromeOS || cr.isWindows ? 'two-line' : '';
411 }, 439 },
412 440
413 /** 441 /**
414 * @return {string} 442 * @return {string}
415 * @private 443 * @private
416 */ 444 */
417 getSpellCheckListTwoLine_: function() { 445 getSpellCheckListTwoLine_: function() {
418 return this.spellCheckSecondaryText_.length ? 'two-line' : ''; 446 return this.spellCheckSecondaryText_.length ? 'two-line' : '';
419 }, 447 },
448 // </if>
420 449
421 /** 450 /**
422 * Returns either the "selected" class, if the language matches the 451 * Returns either the "selected" class, if the language matches the
423 * prospective UI language, or an empty string. Languages can only be 452 * prospective UI language, or an empty string. Languages can only be
424 * selected on Chrome OS and Windows. 453 * selected on Chrome OS and Windows.
425 * @param {string} languageCode The language code identifying a language. 454 * @param {string} languageCode The language code identifying a language.
426 * @param {string} prospectiveUILanguage The prospective UI language. 455 * @param {string} prospectiveUILanguage The prospective UI language.
427 * @return {string} The class name for the language item. 456 * @return {string} The class name for the language item.
428 * @private 457 * @private
429 */ 458 */
430 getLanguageItemClass_: function(languageCode, prospectiveUILanguage) { 459 getLanguageItemClass_: function(languageCode, prospectiveUILanguage) {
431 if ((cr.isChromeOS || cr.isWindows) && 460 if ((cr.isChromeOS || cr.isWindows) &&
432 languageCode == prospectiveUILanguage) { 461 languageCode == prospectiveUILanguage) {
433 return 'selected'; 462 return 'selected';
434 } 463 }
435 return ''; 464 return '';
436 }, 465 },
437 466
438 /** 467 // <if expr="chromeos">
439 * @param {string} languageCode The language code identifying a language.
440 * @param {string} prospectiveUILanguage The prospective UI language.
441 * @return {boolean} True if the prospective UI language is set to
442 * |languageCode| but requires a restart to take effect.
443 * @private
444 */
445 isRestartRequired_: function(languageCode, prospectiveUILanguage) {
446 return prospectiveUILanguage == languageCode &&
447 this.languageHelper.requiresRestart();
448 },
449
450 /** 468 /**
451 * @param {string} id The input method ID. 469 * @param {string} id The input method ID.
452 * @param {string} currentId The ID of the currently enabled input method. 470 * @param {string} currentId The ID of the currently enabled input method.
453 * @return {boolean} True if the IDs match. 471 * @return {boolean} True if the IDs match.
454 * @private 472 * @private
455 */ 473 */
456 isCurrentInputMethod_: function(id, currentId) { 474 isCurrentInputMethod_: function(id, currentId) {
457 assert(cr.isChromeOS); 475 assert(cr.isChromeOS);
458 return id == currentId; 476 return id == currentId;
459 }, 477 },
(...skipping 10 matching lines...) Expand all
470 }, 488 },
471 489
472 getInputMethodName_: function(id) { 490 getInputMethodName_: function(id) {
473 assert(cr.isChromeOS); 491 assert(cr.isChromeOS);
474 var inputMethod = this.languages.inputMethods.enabled.find( 492 var inputMethod = this.languages.inputMethods.enabled.find(
475 function(inputMethod) { 493 function(inputMethod) {
476 return inputMethod.id == id; 494 return inputMethod.id == id;
477 }); 495 });
478 return inputMethod ? inputMethod.displayName : ''; 496 return inputMethod ? inputMethod.displayName : '';
479 }, 497 },
498 // </if>
480 499
481 /** 500 /**
482 * @param {!Event} e 501 * @param {!Event} e
483 * @private 502 * @private
484 */ 503 */
485 onDotsTap_: function(e) { 504 onDotsTap_: function(e) {
486 // Set a copy of the LanguageState object since it is not data-bound to the 505 // Set a copy of the LanguageState object since it is not data-bound to the
487 // languages model directly. 506 // languages model directly.
488 this.detailLanguage_ = /** @type {!LanguageState} */(Object.assign( 507 this.detailLanguage_ = /** @type {!LanguageState} */(Object.assign(
489 {}, 508 {},
490 /** @type {!{model: !{item: !LanguageState}}} */(e).model.item)); 509 /** @type {!{model: !{item: !LanguageState}}} */(e).model.item));
491 510
492 // Ensure the template has been stamped. 511 // Ensure the template has been stamped.
493 var menu = /** @type {?CrActionMenuElement} */( 512 var menu = /** @type {?CrActionMenuElement} */(
494 this.$.menu.getIfExists()); 513 this.$.menu.getIfExists());
495 if (!menu) { 514 if (!menu) {
496 menu = /** @type {!CrActionMenuElement} */(this.$.menu.get()); 515 menu = /** @type {!CrActionMenuElement} */(this.$.menu.get());
516 // <if expr="chromeos">
497 this.initializeMenu_(menu); 517 this.initializeMenu_(menu);
518 // </if>
498 } 519 }
499 520
500 menu.showAt(/** @type {!Element} */ (e.target)); 521 menu.showAt(/** @type {!Element} */ (e.target));
501 }, 522 },
502 523
503 /** 524 /**
504 * Applies Chrome OS session tweaks to the menu.
505 * @param {!CrActionMenuElement} menu
506 * @private
507 */
508 initializeMenu_: function(menu) {
509 // In a CrOS multi-user session, the primary user controls the UI language.
510 // TODO(michaelpg): The language selection should not be hidden, but should
511 // show a policy indicator. crbug.com/648498
512 if (this.isSecondaryUser_())
513 menu.querySelector('#uiLanguageItem').hidden = true;
514
515 // The UI language choice doesn't persist for guests.
516 if (cr.isChromeOS &&
517 (uiAccountTweaks.UIAccountTweaks.loggedInAsGuest() ||
518 uiAccountTweaks.UIAccountTweaks.loggedInAsPublicAccount())) {
519 menu.querySelector('#uiLanguageItem').hidden = true;
520 }
521 },
522
523 /**
524 * Closes the shared action menu after a short delay, so when a checkbox is 525 * Closes the shared action menu after a short delay, so when a checkbox is
525 * tapped it can be seen to change state before disappearing. 526 * tapped it can be seen to change state before disappearing.
526 * @private 527 * @private
527 */ 528 */
528 closeMenuSoon_: function() { 529 closeMenuSoon_: function() {
529 var menu = /** @type {!CrActionMenuElement} */(this.$.menu.get()); 530 var menu = /** @type {!CrActionMenuElement} */(this.$.menu.get());
530 setTimeout(function() { 531 setTimeout(function() {
531 if (menu.open) 532 if (menu.open)
532 menu.close(); 533 menu.close();
533 }, settings.kMenuCloseDelay); 534 }, settings.kMenuCloseDelay);
534 }, 535 },
535 536
537 // <if expr="chromeos or is_win">
536 /** 538 /**
537 * Handler for the restart button. 539 * Handler for the restart button.
538 * @private 540 * @private
539 */ 541 */
540 onRestartTap_: function() { 542 onRestartTap_: function() {
541 // <if expr="chromeos"> 543 // <if expr="chromeos">
542 settings.LifetimeBrowserProxyImpl.getInstance().signOutAndRestart(); 544 settings.LifetimeBrowserProxyImpl.getInstance().signOutAndRestart();
543 // </if> 545 // </if>
544 // <if expr="not chromeos"> 546 // <if expr="is_win">
545 settings.LifetimeBrowserProxyImpl.getInstance().restart(); 547 settings.LifetimeBrowserProxyImpl.getInstance().restart();
546 // </if> 548 // </if>
547 }, 549 },
550 // </if>
548 551
549 /** 552 /**
550 * Toggles the expand button within the element being listened to. 553 * Toggles the expand button within the element being listened to.
551 * @param {!Event} e 554 * @param {!Event} e
552 * @private 555 * @private
553 */ 556 */
554 toggleExpandButton_: function(e) { 557 toggleExpandButton_: function(e) {
555 // The expand button handles toggling itself. 558 // The expand button handles toggling itself.
556 var expandButtonTag = 'CR-EXPAND-BUTTON'; 559 var expandButtonTag = 'CR-EXPAND-BUTTON';
557 if (e.target.tagName == expandButtonTag) 560 if (e.target.tagName == expandButtonTag)
558 return; 561 return;
559 562
560 /** @type {!CrExpandButtonElement} */ 563 /** @type {!CrExpandButtonElement} */
561 var expandButton = e.currentTarget.querySelector(expandButtonTag); 564 var expandButton = e.currentTarget.querySelector(expandButtonTag);
562 assert(expandButton); 565 assert(expandButton);
563 expandButton.expanded = !expandButton.expanded; 566 expandButton.expanded = !expandButton.expanded;
564 }, 567 },
565 }); 568 });
566 })(); 569 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698