| 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 Preferences.getInstance().addEventListener('homepage', | 122 Preferences.getInstance().addEventListener('homepage', |
| 123 this.onHomePageChanged_.bind(this)); | 123 this.onHomePageChanged_.bind(this)); |
| 124 Preferences.getInstance().addEventListener('homepage_is_newtabpage', | 124 Preferences.getInstance().addEventListener('homepage_is_newtabpage', |
| 125 this.onHomePageIsNtpChanged_.bind(this)); | 125 this.onHomePageIsNtpChanged_.bind(this)); |
| 126 | 126 |
| 127 $('change-home-page').onclick = function(event) { | 127 $('change-home-page').onclick = function(event) { |
| 128 OptionsPage.navigateToPage('homePageOverlay'); | 128 OptionsPage.navigateToPage('homePageOverlay'); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 Preferences.getInstance().addEventListener('hotword.search_enabled', | |
| 132 this.onHotwordSearchPrefChanged_.bind(this)); | |
| 133 chrome.send('requestHotwordAvailabile'); | 131 chrome.send('requestHotwordAvailabile'); |
| 134 | 132 |
| 135 if ($('set-wallpaper')) { | 133 if ($('set-wallpaper')) { |
| 136 $('set-wallpaper').onclick = function(event) { | 134 $('set-wallpaper').onclick = function(event) { |
| 137 chrome.send('openWallpaperManager'); | 135 chrome.send('openWallpaperManager'); |
| 138 }; | 136 }; |
| 139 } | 137 } |
| 140 | 138 |
| 141 $('themes-gallery').onclick = function(event) { | 139 $('themes-gallery').onclick = function(event) { |
| 142 window.open(loadTimeData.getString('themesGalleryURL')); | 140 window.open(loadTimeData.getString('themesGalleryURL')); |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 881 |
| 884 /** | 882 /** |
| 885 * Activates the Hotword section from the System settings page. | 883 * Activates the Hotword section from the System settings page. |
| 886 * @private | 884 * @private |
| 887 */ | 885 */ |
| 888 showHotwordSection_: function() { | 886 showHotwordSection_: function() { |
| 889 $('hotword-search').hidden = false; | 887 $('hotword-search').hidden = false; |
| 890 }, | 888 }, |
| 891 | 889 |
| 892 /** | 890 /** |
| 893 * Event listener for the 'hotword search enabled' preference. Shows/hides | |
| 894 * the UI for updating hotword settings.. | |
| 895 * @param {Event} event The preference change event. | |
| 896 */ | |
| 897 onHotwordSearchPrefChanged_: function(event) { | |
| 898 var section = $('hotword-settings-section'); | |
| 899 var container = $('hotword-settings-section-container'); | |
| 900 // event.value is a dictionary with details about the preference that was | |
| 901 // changed. Within that dictionary, |value| is the new value of the | |
| 902 // preference. In this case, the preference represents a Boolean so it | |
| 903 // can be checked for true/false. | |
| 904 if (event.value.value) | |
| 905 this.showSectionWithAnimation_(section, container); | |
| 906 else | |
| 907 this.hideSectionWithAnimation_(section, container); | |
| 908 }, | |
| 909 | |
| 910 /** | |
| 911 * Event listener for the 'homepage is NTP' preference. Updates the label | 891 * Event listener for the 'homepage is NTP' preference. Updates the label |
| 912 * next to the 'Change' button. | 892 * next to the 'Change' button. |
| 913 * @param {Event} event The preference change event. | 893 * @param {Event} event The preference change event. |
| 914 */ | 894 */ |
| 915 onHomePageIsNtpChanged_: function(event) { | 895 onHomePageIsNtpChanged_: function(event) { |
| 916 if (!event.value.uncommitted) { | 896 if (!event.value.uncommitted) { |
| 917 $('home-page-url').hidden = event.value.value; | 897 $('home-page-url').hidden = event.value.value; |
| 918 $('home-page-ntp').hidden = !event.value.value; | 898 $('home-page-ntp').hidden = !event.value.value; |
| 919 } | 899 } |
| 920 }, | 900 }, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 BrowserOptions.getLoggedInUsername = function() { | 1623 BrowserOptions.getLoggedInUsername = function() { |
| 1644 return BrowserOptions.getInstance().username_; | 1624 return BrowserOptions.getInstance().username_; |
| 1645 }; | 1625 }; |
| 1646 } | 1626 } |
| 1647 | 1627 |
| 1648 // Export | 1628 // Export |
| 1649 return { | 1629 return { |
| 1650 BrowserOptions: BrowserOptions | 1630 BrowserOptions: BrowserOptions |
| 1651 }; | 1631 }; |
| 1652 }); | 1632 }); |
| OLD | NEW |