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'); |
| 134 |
131 if ($('set-wallpaper')) { | 135 if ($('set-wallpaper')) { |
132 $('set-wallpaper').onclick = function(event) { | 136 $('set-wallpaper').onclick = function(event) { |
133 chrome.send('openWallpaperManager'); | 137 chrome.send('openWallpaperManager'); |
134 }; | 138 }; |
135 } | 139 } |
136 | 140 |
137 $('themes-gallery').onclick = function(event) { | 141 $('themes-gallery').onclick = function(event) { |
138 window.open(loadTimeData.getString('themesGalleryURL')); | 142 window.open(loadTimeData.getString('themesGalleryURL')); |
139 }; | 143 }; |
140 $('themes-reset').onclick = function(event) { | 144 $('themes-reset').onclick = function(event) { |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 this.showSectionWithAnimation_(section, container); | 875 this.showSectionWithAnimation_(section, container); |
872 else | 876 else |
873 this.hideSectionWithAnimation_(section, container); | 877 this.hideSectionWithAnimation_(section, container); |
874 } else { | 878 } else { |
875 section.hidden = !event.value.value; | 879 section.hidden = !event.value.value; |
876 this.onShowHomeButtonChangedCalled_ = true; | 880 this.onShowHomeButtonChangedCalled_ = true; |
877 } | 881 } |
878 }, | 882 }, |
879 | 883 |
880 /** | 884 /** |
| 885 * Activates the Hotword section from the System settings page. |
| 886 * @private |
| 887 */ |
| 888 showHotwordSection_: function() { |
| 889 $('hotword-search').hidden = false; |
| 890 }, |
| 891 |
| 892 /** |
| 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 /** |
881 * Event listener for the 'homepage is NTP' preference. Updates the label | 911 * Event listener for the 'homepage is NTP' preference. Updates the label |
882 * next to the 'Change' button. | 912 * next to the 'Change' button. |
883 * @param {Event} event The preference change event. | 913 * @param {Event} event The preference change event. |
884 */ | 914 */ |
885 onHomePageIsNtpChanged_: function(event) { | 915 onHomePageIsNtpChanged_: function(event) { |
886 if (!event.value.uncommitted) { | 916 if (!event.value.uncommitted) { |
887 $('home-page-url').hidden = event.value.value; | 917 $('home-page-url').hidden = event.value.value; |
888 $('home-page-ntp').hidden = !event.value.value; | 918 $('home-page-ntp').hidden = !event.value.value; |
889 } | 919 } |
890 }, | 920 }, |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 'setSpokenFeedbackCheckboxState', | 1608 'setSpokenFeedbackCheckboxState', |
1579 'setThemesResetButtonEnabled', | 1609 'setThemesResetButtonEnabled', |
1580 'setVirtualKeyboardCheckboxState', | 1610 'setVirtualKeyboardCheckboxState', |
1581 'setupCloudPrintConnectorSection', | 1611 'setupCloudPrintConnectorSection', |
1582 'setupPageZoomSelector', | 1612 'setupPageZoomSelector', |
1583 'setupProxySettingsSection', | 1613 'setupProxySettingsSection', |
1584 'showBluetoothSettings', | 1614 'showBluetoothSettings', |
1585 'showCreateProfileError', | 1615 'showCreateProfileError', |
1586 'showCreateProfileSuccess', | 1616 'showCreateProfileSuccess', |
1587 'showCreateProfileWarning', | 1617 'showCreateProfileWarning', |
| 1618 'showHotwordSection', |
1588 'showManagedUserImportError', | 1619 'showManagedUserImportError', |
1589 'showManagedUserImportSuccess', | 1620 'showManagedUserImportSuccess', |
1590 'showMouseControls', | 1621 'showMouseControls', |
1591 'showTouchpadControls', | 1622 'showTouchpadControls', |
1592 'updateAccountPicture', | 1623 'updateAccountPicture', |
1593 'updateAutoLaunchState', | 1624 'updateAutoLaunchState', |
1594 'updateDefaultBrowserState', | 1625 'updateDefaultBrowserState', |
1595 'updateManagesSupervisedUsers', | 1626 'updateManagesSupervisedUsers', |
1596 'updateSearchEngines', | 1627 'updateSearchEngines', |
1597 'updateStartupPages', | 1628 'updateStartupPages', |
(...skipping 14 matching lines...) Expand all Loading... |
1612 BrowserOptions.getLoggedInUsername = function() { | 1643 BrowserOptions.getLoggedInUsername = function() { |
1613 return BrowserOptions.getInstance().username_; | 1644 return BrowserOptions.getInstance().username_; |
1614 }; | 1645 }; |
1615 } | 1646 } |
1616 | 1647 |
1617 // Export | 1648 // Export |
1618 return { | 1649 return { |
1619 BrowserOptions: BrowserOptions | 1650 BrowserOptions: BrowserOptions |
1620 }; | 1651 }; |
1621 }); | 1652 }); |
OLD | NEW |