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

Side by Side Diff: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc

Issue 992173002: Delete the old hotwording integration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hotword-remove-disable-option
Patch Set: Move old extension ID constant. Created 5 years, 9 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 <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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 preamble->sample_data.swap(params->log->buffer); 212 preamble->sample_data.swap(params->log->buffer);
213 } 213 }
214 214
215 HotwordService* hotword_service = 215 HotwordService* hotword_service =
216 HotwordServiceFactory::GetForProfile(GetProfile()); 216 HotwordServiceFactory::GetForProfile(GetProfile());
217 if (hotword_service) { 217 if (hotword_service) {
218 if (hotword_service->IsTraining()) { 218 if (hotword_service->IsTraining()) {
219 hotword_service->NotifyHotwordTriggered(); 219 hotword_service->NotifyHotwordTriggered();
220 } else if (hotword_service->client()) { 220 } else if (hotword_service->client()) {
221 hotword_service->client()->OnHotwordRecognized(preamble); 221 hotword_service->client()->OnHotwordRecognized(preamble);
222 } else if (HotwordService::IsExperimentalHotwordingEnabled() && 222 } else if (hotword_service->IsAlwaysOnEnabled()) {
223 hotword_service->IsAlwaysOnEnabled()) {
224 Browser* browser = GetCurrentBrowser(); 223 Browser* browser = GetCurrentBrowser();
225 // If a Browser does not exist, fall back to the universally available, 224 // If a Browser does not exist, fall back to the universally available,
226 // but not recommended, way. 225 // but not recommended, way.
227 AppListService* app_list_service = AppListService::Get( 226 AppListService* app_list_service = AppListService::Get(
228 browser ? browser->host_desktop_type() : chrome::GetActiveDesktop()); 227 browser ? browser->host_desktop_type() : chrome::GetActiveDesktop());
229 CHECK(app_list_service); 228 CHECK(app_list_service);
230 app_list_service->ShowForVoiceSearch(GetProfile(), preamble); 229 app_list_service->ShowForVoiceSearch(GetProfile(), preamble);
231 } 230 }
232 } 231 }
233 return true; 232 return true;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse( 452 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse(
454 bool success, bool new_enabled_value) { 453 bool success, bool new_enabled_value) {
455 api::hotword_private::AudioHistoryState result; 454 api::hotword_private::AudioHistoryState result;
456 result.success = success; 455 result.success = success;
457 result.enabled = new_enabled_value; 456 result.enabled = new_enabled_value;
458 SetResult(result.ToValue().release()); 457 SetResult(result.ToValue().release());
459 SendResponse(true); 458 SendResponse(true);
460 } 459 }
461 460
462 } // namespace extensions 461 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698