| 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 OptionsPage = options.OptionsPage; | 9 /** @const */ var OptionsPage = options.OptionsPage; |
| 10 /** @const */ var LanguageList = options.LanguageList; | 10 /** @const */ var LanguageList = options.LanguageList; |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 var uiLanguageMessage = $('language-options-ui-language-message'); | 550 var uiLanguageMessage = $('language-options-ui-language-message'); |
| 551 var uiLanguageNotification = $('language-options-ui-notification-bar'); | 551 var uiLanguageNotification = $('language-options-ui-notification-bar'); |
| 552 | 552 |
| 553 // Remove the event listener and add it back if useful. | 553 // Remove the event listener and add it back if useful. |
| 554 uiLanguageButton.onclick = null; | 554 uiLanguageButton.onclick = null; |
| 555 | 555 |
| 556 // Unhide the language button every time, as it could've been previously | 556 // Unhide the language button every time, as it could've been previously |
| 557 // hidden by a language change. | 557 // hidden by a language change. |
| 558 uiLanguageButton.hidden = false; | 558 uiLanguageButton.hidden = false; |
| 559 | 559 |
| 560 // Hide the controlled setting indicator. |
| 561 var uiLanguageIndicator = document.querySelector( |
| 562 '.language-options-contents .controlled-setting-indicator'); |
| 563 uiLanguageIndicator.removeAttribute('controlled-by'); |
| 564 |
| 560 if (languageCode == this.prospectiveUiLanguageCode_) { | 565 if (languageCode == this.prospectiveUiLanguageCode_) { |
| 561 uiLanguageMessage.textContent = | 566 uiLanguageMessage.textContent = |
| 562 loadTimeData.getString('isDisplayedInThisLanguage'); | 567 loadTimeData.getString('isDisplayedInThisLanguage'); |
| 563 showMutuallyExclusiveNodes( | 568 showMutuallyExclusiveNodes( |
| 564 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); | 569 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); |
| 565 } else if (languageCode in loadTimeData.getValue('uiLanguageCodeSet')) { | 570 } else if (languageCode in loadTimeData.getValue('uiLanguageCodeSet')) { |
| 566 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { | 571 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { |
| 567 // In the guest mode for ChromeOS, changing UI language does not make | 572 // In the guest mode for ChromeOS, changing UI language does not make |
| 568 // sense because it does not take effect after browser restart. | 573 // sense because it does not take effect after browser restart. |
| 569 uiLanguageButton.hidden = true; | 574 uiLanguageButton.hidden = true; |
| 570 uiLanguageMessage.hidden = true; | 575 uiLanguageMessage.hidden = true; |
| 571 } else { | 576 } else { |
| 572 uiLanguageButton.textContent = | 577 uiLanguageButton.textContent = |
| 573 loadTimeData.getString('displayInThisLanguage'); | 578 loadTimeData.getString('displayInThisLanguage'); |
| 579 |
| 580 if (loadTimeData.getBoolean('secondaryUser')) { |
| 581 uiLanguageButton.disabled = true; |
| 582 uiLanguageIndicator.setAttribute('controlled-by', 'shared'); |
| 583 } else { |
| 584 uiLanguageButton.onclick = function(e) { |
| 585 chrome.send('uiLanguageChange', [languageCode]); |
| 586 }; |
| 587 } |
| 574 showMutuallyExclusiveNodes( | 588 showMutuallyExclusiveNodes( |
| 575 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 0); | 589 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 0); |
| 576 uiLanguageButton.onclick = function(e) { | |
| 577 chrome.send('uiLanguageChange', [languageCode]); | |
| 578 }; | |
| 579 } | 590 } |
| 580 } else { | 591 } else { |
| 581 uiLanguageMessage.textContent = | 592 uiLanguageMessage.textContent = |
| 582 loadTimeData.getString('cannotBeDisplayedInThisLanguage'); | 593 loadTimeData.getString('cannotBeDisplayedInThisLanguage'); |
| 583 showMutuallyExclusiveNodes( | 594 showMutuallyExclusiveNodes( |
| 584 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); | 595 [uiLanguageButton, uiLanguageMessage, uiLanguageNotification], 1); |
| 585 } | 596 } |
| 586 }, | 597 }, |
| 587 | 598 |
| 588 /** | 599 /** |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1306 |
| 1296 LanguageOptions.onComponentManagerInitialized = function(componentImes) { | 1307 LanguageOptions.onComponentManagerInitialized = function(componentImes) { |
| 1297 LanguageOptions.getInstance().appendComponentExtensionIme_(componentImes); | 1308 LanguageOptions.getInstance().appendComponentExtensionIme_(componentImes); |
| 1298 }; | 1309 }; |
| 1299 | 1310 |
| 1300 // Export | 1311 // Export |
| 1301 return { | 1312 return { |
| 1302 LanguageOptions: LanguageOptions | 1313 LanguageOptions: LanguageOptions |
| 1303 }; | 1314 }; |
| 1304 }); | 1315 }); |
| OLD | NEW |