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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" 5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search/hotword_client.h" 11 #include "chrome/browser/search/hotword_client.h"
12 #include "chrome/browser/search/hotword_service.h" 12 #include "chrome/browser/search/hotword_service.h"
13 #include "chrome/browser/search/hotword_service_factory.h" 13 #include "chrome/browser/search/hotword_service_factory.h"
14 #include "chrome/browser/ui/app_list/app_list_service.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "extensions/browser/event_router.h" 17 #include "extensions/browser/event_router.h"
17 18
18 namespace extensions { 19 namespace extensions {
19 20
20 namespace hotword_private_constants { 21 namespace hotword_private_constants {
21 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; 22 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable.";
22 } // hotword_private_constants 23 } // hotword_private_constants
23 24
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 HotwordService* hotword_service = 151 HotwordService* hotword_service =
151 HotwordServiceFactory::GetForProfile(GetProfile()); 152 HotwordServiceFactory::GetForProfile(GetProfile());
152 if (hotword_service && hotword_service->client()) 153 if (hotword_service && hotword_service->client())
153 hotword_service->client()->OnHotwordStateChanged(params->started); 154 hotword_service->client()->OnHotwordStateChanged(params->started);
154 return true; 155 return true;
155 } 156 }
156 157
157 bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() { 158 bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() {
158 HotwordService* hotword_service = 159 HotwordService* hotword_service =
159 HotwordServiceFactory::GetForProfile(GetProfile()); 160 HotwordServiceFactory::GetForProfile(GetProfile());
160 if (hotword_service && hotword_service->client()) 161 if (hotword_service) {
161 hotword_service->client()->OnHotwordRecognized(); 162 if (hotword_service->client()) {
163 hotword_service->client()->OnHotwordRecognized();
164 } else if (HotwordService::IsExperimentalHotwordingEnabled() &&
165 hotword_service->IsAlwaysOnEnabled()) {
166 AppListService* app_list_service = AppListService::Get(
167 chrome::HOST_DESKTOP_TYPE_NATIVE);
tapted 2014/10/09 03:37:00 you might want AppListService::Get(GetCurrentBrows
Anand Mistry (off Chromium) 2014/10/13 21:51:59 Done. But note, priority is ChromeOS. We're not ta
168 CHECK(app_list_service);
169 app_list_service->ShowForVoiceSearch(GetProfile());
170 }
171 }
162 return true; 172 return true;
163 } 173 }
164 174
165 bool HotwordPrivateGetLaunchStateFunction::RunSync() { 175 bool HotwordPrivateGetLaunchStateFunction::RunSync() {
166 api::hotword_private::LaunchState result; 176 api::hotword_private::LaunchState result;
167 177
168 HotwordService* hotword_service = 178 HotwordService* hotword_service =
169 HotwordServiceFactory::GetForProfile(GetProfile()); 179 HotwordServiceFactory::GetForProfile(GetProfile());
170 if (!hotword_service) { 180 if (!hotword_service) {
171 error_ = hotword_private_constants::kHotwordServiceUnavailable; 181 error_ = hotword_private_constants::kHotwordServiceUnavailable;
172 return false; 182 return false;
173 } else { 183 } else {
174 result.launch_mode = 184 result.launch_mode =
175 hotword_service->GetHotwordAudioVerificationLaunchMode(); 185 hotword_service->GetHotwordAudioVerificationLaunchMode();
176 } 186 }
177 187
178 SetResult(result.ToValue().release()); 188 SetResult(result.ToValue().release());
179 return true; 189 return true;
180 } 190 }
181 191
182 } // namespace extensions 192 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/hotword_service.h » ('j') | chrome/browser/ui/app_list/app_list_service_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698