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

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

Issue 528113003: Hotword Audio Verification App: Adds to hotwordPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-one
Patch Set: Rebase Created 6 years, 3 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 | « chrome/browser/search/hotword_service.h ('k') | chrome/common/extensions/api/_permission_features.json » ('j') | 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 f12ef059c4b7384b4f1a159e0a961b94ac319364..bdbbf5451ab826bd2f76783fd64d8bfb3c021423 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -215,6 +215,9 @@ HotwordService::HotwordService(Profile* profile)
base::Bind(&HotwordService::OnHotwordSearchEnabledChanged,
base::Unretained(this)));
+ // TODO(kcarattini): Control the enabling of the pref with the Hotword
+ // Audio Verification app, rather than listening for a change in the
+ // enabled state.
pref_registrar_.Add(
prefs::kHotwordAlwaysOnSearchEnabled,
base::Bind(&HotwordService::OnHotwordAlwaysOnSearchEnabledChanged,
@@ -453,20 +456,30 @@ void HotwordService::DisableHotwordExtension(
void HotwordService::OnHotwordAlwaysOnSearchEnabledChanged(
const std::string& pref_name) {
DCHECK_EQ(pref_name, std::string(prefs::kHotwordAlwaysOnSearchEnabled));
+ // TODO(kcarattini): Launch in the appropriate mode given the state of
+ // the account-level Audio History setting.
+ LaunchHotwordAudioVerificationApp(HOTWORD_AND_AUDIO_HISTORY);
+}
+
+void HotwordService::LaunchHotwordAudioVerificationApp(
+ const LaunchMode& launch_mode) {
+ hotword_audio_verification_launch_mode_ = launch_mode;
ExtensionService* extension_service = GetExtensionService(profile_);
if (!extension_service)
return;
-
const extensions::Extension* extension = extension_service->GetExtensionById(
extension_misc::kHotwordAudioVerificationAppId, true);
if (!extension)
return;
- if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled)) {
- OpenApplication(AppLaunchParams(
- profile_, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
- }
+ OpenApplication(AppLaunchParams(
+ profile_, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
+}
+
+HotwordService::LaunchMode
+HotwordService::GetHotwordAudioVerificationLaunchMode() {
+ return hotword_audio_verification_launch_mode_;
}
void HotwordService::OnHotwordSearchEnabledChanged(
« no previous file with comments | « chrome/browser/search/hotword_service.h ('k') | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698