OLD | NEW |
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 preamble->sample_data.swap(params->log->buffer); | 219 preamble->sample_data.swap(params->log->buffer); |
220 } | 220 } |
221 | 221 |
222 HotwordService* hotword_service = | 222 HotwordService* hotword_service = |
223 HotwordServiceFactory::GetForProfile(GetProfile()); | 223 HotwordServiceFactory::GetForProfile(GetProfile()); |
224 if (hotword_service) { | 224 if (hotword_service) { |
225 if (hotword_service->IsTraining()) { | 225 if (hotword_service->IsTraining()) { |
226 hotword_service->NotifyHotwordTriggered(); | 226 hotword_service->NotifyHotwordTriggered(); |
227 } else if (hotword_service->client()) { | 227 } else if (hotword_service->client()) { |
228 hotword_service->client()->OnHotwordRecognized(preamble); | 228 hotword_service->client()->OnHotwordRecognized(preamble); |
229 } else if (HotwordService::IsExperimentalHotwordingEnabled() && | 229 } else if (hotword_service->IsAlwaysOnEnabled()) { |
230 hotword_service->IsAlwaysOnEnabled()) { | |
231 Browser* browser = GetCurrentBrowser(); | 230 Browser* browser = GetCurrentBrowser(); |
232 // If a Browser does not exist, fall back to the universally available, | 231 // If a Browser does not exist, fall back to the universally available, |
233 // but not recommended, way. | 232 // but not recommended, way. |
234 AppListService* app_list_service = AppListService::Get( | 233 AppListService* app_list_service = AppListService::Get( |
235 browser ? browser->host_desktop_type() : chrome::GetActiveDesktop()); | 234 browser ? browser->host_desktop_type() : chrome::GetActiveDesktop()); |
236 CHECK(app_list_service); | 235 CHECK(app_list_service); |
237 app_list_service->ShowForVoiceSearch(GetProfile(), preamble); | 236 app_list_service->ShowForVoiceSearch(GetProfile(), preamble); |
238 } | 237 } |
239 } | 238 } |
240 return true; | 239 return true; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 HotwordService* hotword_service = | 473 HotwordService* hotword_service = |
475 HotwordServiceFactory::GetForProfile(GetProfile()); | 474 HotwordServiceFactory::GetForProfile(GetProfile()); |
476 if (!hotword_service) | 475 if (!hotword_service) |
477 return false; | 476 return false; |
478 | 477 |
479 hotword_service->SpeakerModelExistsComplete(params->exists); | 478 hotword_service->SpeakerModelExistsComplete(params->exists); |
480 return true; | 479 return true; |
481 } | 480 } |
482 | 481 |
483 } // namespace extensions | 482 } // namespace extensions |
OLD | NEW |