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

Unified Diff: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc

Issue 631913004: Open the launcher when hotword is triggered in always-on mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hotword-google-com-ntp
Patch Set: Fix android build 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 | chrome/browser/search/hotword_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
index 2de65c89c42932bd1e8bd662cb6944e222dbd711..0413178365eb4c7812b3fabf6e7cd9b6d53b9c4b 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_api.cc
@@ -11,6 +11,8 @@
#include "chrome/browser/search/hotword_client.h"
#include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h"
+#include "chrome/browser/ui/app_list/app_list_service.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "extensions/browser/event_router.h"
@@ -157,8 +159,20 @@ bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() {
bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile());
- if (hotword_service && hotword_service->client())
- hotword_service->client()->OnHotwordRecognized();
+ if (hotword_service) {
+ if (hotword_service->client()) {
+ hotword_service->client()->OnHotwordRecognized();
+ } else if (HotwordService::IsExperimentalHotwordingEnabled() &&
+ hotword_service->IsAlwaysOnEnabled()) {
+ Browser* browser = GetCurrentBrowser();
+ // If a Browser does not exist, fall back to the universally available,
+ // but not recommended, way.
+ AppListService* app_list_service = AppListService::Get(
+ browser ? browser->host_desktop_type() : chrome::GetActiveDesktop());
+ CHECK(app_list_service);
+ app_list_service->ShowForVoiceSearch(GetProfile());
+ }
+ }
return true;
}
« no previous file with comments | « no previous file | chrome/browser/search/hotword_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698