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

Unified Diff: chrome/browser/resources/options/browser_options.js

Issue 134103005: [Hotword] Putting preferences under search for hotword service. Putting behind a flag. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: adding a line. maybe it will help? Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/browser_options.js
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index f6a95454329c99a604553dcf37d43e622e571063..14926d3e1cd1c7b48b0bd78f8adbbe25baf3afb1 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -128,6 +128,10 @@ cr.define('options', function() {
OptionsPage.navigateToPage('homePageOverlay');
};
+ Preferences.getInstance().addEventListener('hotword.search_enabled',
+ this.onHotwordSearchPrefChanged_.bind(this));
+ chrome.send('requestHotwordAvailabile');
+
if ($('set-wallpaper')) {
$('set-wallpaper').onclick = function(event) {
chrome.send('openWallpaperManager');
@@ -878,6 +882,32 @@ cr.define('options', function() {
},
/**
+ * Activates the Hotword section from the System settings page.
+ * @private
+ */
+ showHotwordSection_: function() {
+ $('hotword-search').hidden = false;
+ },
+
+ /**
+ * Event listener for the 'hotword search enabled' preference. Shows/hides
+ * the UI for updating hotword settings..
+ * @param {Event} event The preference change event.
+ */
+ onHotwordSearchPrefChanged_: function(event) {
+ var section = $('hotword-settings-section');
+ var container = $('hotword-settings-section-container');
+ // event.value is a dictionary with details about the preference that was
+ // changed. Within that dictionary, |value| is the new value of the
+ // preference. In this case, the preference represents a Boolean so it
+ // can be checked for true/false.
+ if (event.value.value)
+ this.showSectionWithAnimation_(section, container);
+ else
+ this.hideSectionWithAnimation_(section, container);
+ },
+
+ /**
* Event listener for the 'homepage is NTP' preference. Updates the label
* next to the 'Change' button.
* @param {Event} event The preference change event.
@@ -1585,6 +1615,7 @@ cr.define('options', function() {
'showCreateProfileError',
'showCreateProfileSuccess',
'showCreateProfileWarning',
+ 'showHotwordSection',
'showManagedUserImportError',
'showManagedUserImportSuccess',
'showMouseControls',
« no previous file with comments | « chrome/browser/resources/options/browser_options.html ('k') | chrome/browser/search/hotword_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698