| Index: chrome/browser/search/hotword_service.cc
|
| diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
|
| index e29a08ff4fa424dd9e944fc2a24f96fd567e1172..4ed522bd2ccdef15f4b3cfb65fe16ae393c48afb 100644
|
| --- a/chrome/browser/search/hotword_service.cc
|
| +++ b/chrome/browser/search/hotword_service.cc
|
| @@ -19,6 +19,7 @@
|
| #include "chrome/browser/plugins/plugin_prefs.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/search/hotword_service_factory.h"
|
| +#include "chrome/browser/ui/extensions/application_launch.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -205,6 +206,11 @@ HotwordService::HotwordService(Profile* profile)
|
| base::Bind(&HotwordService::OnHotwordSearchEnabledChanged,
|
| base::Unretained(this)));
|
|
|
| + pref_registrar_.Add(
|
| + prefs::kHotwordAlwaysOnSearchEnabled,
|
| + base::Bind(&HotwordService::OnHotwordAlwaysOnSearchEnabledChanged,
|
| + base::Unretained(this)));
|
| +
|
| registrar_.Add(this,
|
| chrome::NOTIFICATION_BROWSER_WINDOW_READY,
|
| content::NotificationService::AllSources());
|
| @@ -435,6 +441,25 @@ void HotwordService::DisableHotwordExtension(
|
| }
|
| }
|
|
|
| +void HotwordService::OnHotwordAlwaysOnSearchEnabledChanged(
|
| + const std::string& pref_name) {
|
| + DCHECK_EQ(pref_name, std::string(prefs::kHotwordAlwaysOnSearchEnabled));
|
| +
|
| + 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));
|
| + }
|
| +}
|
| +
|
| void HotwordService::OnHotwordSearchEnabledChanged(
|
| const std::string& pref_name) {
|
| DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled));
|
|
|