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

Unified Diff: chrome/browser/search/hotword_service.cc

Issue 671113002: Disable old hotword extension when new hotwording is enabled. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/hotword_service.cc
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index 4a6f2c90d88f35ccf94215fc8f9d9529f63df8af..8ad8c2a2da7e004cedf59f6f5bbe872d8625ed5d 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -194,17 +194,22 @@ HotwordService::HotwordService(Profile* profile)
// This will be called during profile initialization which is a good time
// to check the user's hotword state.
HotwordEnabled enabled_state = UNSET;
- if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled)) {
- if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled))
- enabled_state = ENABLED;
- else
- enabled_state = DISABLED;
+ if (IsExperimentalHotwordingEnabled()) {
+ // Disable the old extension so it doesn't interfere with the new stuff.
+ DisableHotwordExtension(GetExtensionService(profile_));
} else {
- // If the preference has not been set the hotword extension should
- // not be running. However, this should only be done if auto-install
- // is enabled which is gated through the IsHotwordAllowed check.
- if (IsHotwordAllowed())
- DisableHotwordExtension(GetExtensionService(profile_));
+ if (profile_->GetPrefs()->HasPrefPath(prefs::kHotwordSearchEnabled)) {
+ if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled))
+ enabled_state = ENABLED;
+ else
+ enabled_state = DISABLED;
+ } else {
+ // If the preference has not been set the hotword extension should
+ // not be running. However, this should only be done if auto-install
+ // is enabled which is gated through the IsHotwordAllowed check.
+ if (IsHotwordAllowed())
+ DisableHotwordExtension(GetExtensionService(profile_));
+ }
}
UMA_HISTOGRAM_ENUMERATION("Hotword.Enabled", enabled_state,
NUM_HOTWORD_ENABLED_METRICS);
@@ -448,7 +453,7 @@ bool HotwordService::IsAlwaysOnEnabled() {
void HotwordService::EnableHotwordExtension(
ExtensionService* extension_service) {
- if (extension_service)
+ if (extension_service && !IsExperimentalHotwordingEnabled())
extension_service->EnableExtension(extension_misc::kHotwordExtensionId);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698