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

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

Issue 1011813006: Make availability of hotword hardware known to hotword component extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
« no previous file with comments | « no previous file | chrome/browser/resources/hotword/constants.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 HotwordService* hotword_service = 154 HotwordService* hotword_service =
155 HotwordServiceFactory::GetForProfile(GetProfile()); 155 HotwordServiceFactory::GetForProfile(GetProfile());
156 if (!hotword_service) { 156 if (!hotword_service) {
157 result.available = false; 157 result.available = false;
158 result.always_on_available = false; 158 result.always_on_available = false;
159 result.enabled = false; 159 result.enabled = false;
160 result.audio_logging_enabled = false; 160 result.audio_logging_enabled = false;
161 result.always_on_enabled = false; 161 result.always_on_enabled = false;
162 result.user_is_active = false; 162 result.user_is_active = false;
163 result.hotword_hardware_available = false;
163 } else { 164 } else {
164 result.available = false; 165 result.available = false;
165 result.always_on_available = false; 166 result.always_on_available = false;
166 if (params->get_optional_fields && *params->get_optional_fields) { 167 if (params->get_optional_fields && *params->get_optional_fields) {
167 result.available = hotword_service->IsServiceAvailable(); 168 result.available = hotword_service->IsServiceAvailable();
168 result.always_on_available = 169 result.always_on_available =
169 HotwordServiceFactory::IsAlwaysOnAvailable(); 170 HotwordServiceFactory::IsAlwaysOnAvailable();
170 } 171 }
171 result.enabled = hotword_service->IsSometimesOnEnabled(); 172 result.enabled = hotword_service->IsSometimesOnEnabled();
172 result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging(); 173 result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging();
173 result.training_enabled = hotword_service->IsTraining(); 174 result.training_enabled = hotword_service->IsTraining();
174 result.always_on_enabled = hotword_service->IsAlwaysOnEnabled(); 175 result.always_on_enabled = hotword_service->IsAlwaysOnEnabled();
175 result.user_is_active = hotword_service->UserIsActive(); 176 result.user_is_active = hotword_service->UserIsActive();
177 result.hotword_hardware_available =
178 HotwordService::IsHotwordHardwareAvailable();
176 } 179 }
177 180
178 PrefService* prefs = GetProfile()->GetPrefs(); 181 PrefService* prefs = GetProfile()->GetPrefs();
179 result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled); 182 result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled);
180 183
181 SetResult(result.ToValue().release()); 184 SetResult(result.ToValue().release());
182 return true; 185 return true;
183 } 186 }
184 187
185 bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() { 188 bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse( 456 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse(
454 bool success, bool new_enabled_value) { 457 bool success, bool new_enabled_value) {
455 api::hotword_private::AudioHistoryState result; 458 api::hotword_private::AudioHistoryState result;
456 result.success = success; 459 result.success = success;
457 result.enabled = new_enabled_value; 460 result.enabled = new_enabled_value;
458 SetResult(result.ToValue().release()); 461 SetResult(result.ToValue().release());
459 SendResponse(true); 462 SendResponse(true);
460 } 463 }
461 464
462 } // namespace extensions 465 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/hotword/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698