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

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

Issue 467113004: Adds a skeleton component app for Always-On Hotwording opt-in flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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/extension_constants.h » ('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 738eced6cc9566699d2c82bcb33de32ce21a8801..f12ef059c4b7384b4f1a159e0a961b94ac319364 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -20,6 +20,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/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -214,6 +215,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());
@@ -444,6 +450,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));
« no previous file with comments | « chrome/browser/search/hotword_service.h ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698