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

Unified Diff: chrome/browser/resources/hotword/state_manager.js

Issue 685053002: Treat regular and always-on hotwording settings as mutually exclusive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/hotword/state_manager.js
diff --git a/chrome/browser/resources/hotword/state_manager.js b/chrome/browser/resources/hotword/state_manager.js
index 67d4f41923f35fc1513a8493551b64db3e371e81..b55dc3dbef6f1296cbc033562ae000ff3e4a5c5c 100644
--- a/chrome/browser/resources/hotword/state_manager.js
+++ b/chrome/browser/resources/hotword/state_manager.js
@@ -140,11 +140,15 @@ cr.define('hotword', function() {
},
/**
- * @return {boolean} True if hotwording is enabled.
+ * @return {boolean} True if google.com/NTP/launcher hotwording is enabled.
*/
- isEnabled: function() {
- assert(this.hotwordStatus_, 'No hotwording status (isEnabled)');
- return this.hotwordStatus_.enabled;
+ isSometimesOnEnabled: function() {
+ assert(this.hotwordStatus_,
+ 'No hotwording status (isSometimesOnEnabled)');
+ // Although the two settings are supposed to be mutually exclusive, it's
+ // possible for both to be set. In that case, always-on takes precedence.
+ return this.hotwordStatus_.enabled &&
+ !this.hotwordStatus_.alwaysOnEnabled;
},
/**
@@ -152,8 +156,7 @@ cr.define('hotword', function() {
*/
isAlwaysOnEnabled: function() {
assert(this.hotwordStatus_, 'No hotword status (isAlwaysOnEnabled)');
- return this.hotwordStatus_.enabled &&
- this.hotwordStatus_.alwaysOnEnabled;
+ return this.hotwordStatus_.alwaysOnEnabled;
},
/**
@@ -178,7 +181,7 @@ cr.define('hotword', function() {
if (!this.hotwordStatus_)
return;
- if (this.hotwordStatus_.enabled) {
+ if (this.hotwordStatus_.enabled || this.hotwordStatus_.alwaysOnEnabled) {
// Start the detector if there's a session, and shut it down if there
// isn't.
// NOTE(amistry): With always-on, we want a different behaviour with
« no previous file with comments | « chrome/browser/resources/hotword/page_audio_manager.js ('k') | chrome/browser/ui/app_list/start_page_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698