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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 bool HotwordPrivateGetStatusFunction::RunSync() { | 147 bool HotwordPrivateGetStatusFunction::RunSync() { |
148 api::hotword_private::StatusDetails result; | 148 api::hotword_private::StatusDetails result; |
149 | 149 |
150 HotwordService* hotword_service = | 150 HotwordService* hotword_service = |
151 HotwordServiceFactory::GetForProfile(GetProfile()); | 151 HotwordServiceFactory::GetForProfile(GetProfile()); |
152 if (!hotword_service) { | 152 if (!hotword_service) { |
153 result.available = false; | 153 result.available = false; |
| 154 result.always_on_available = false; |
154 result.enabled = false; | 155 result.enabled = false; |
155 result.audio_logging_enabled = false; | 156 result.audio_logging_enabled = false; |
156 result.always_on_enabled = false; | 157 result.always_on_enabled = false; |
157 result.user_is_active = false; | 158 result.user_is_active = false; |
158 } else { | 159 } else { |
159 result.available = hotword_service->IsServiceAvailable(); | 160 result.available = hotword_service->IsServiceAvailable(); |
| 161 result.always_on_available = |
| 162 HotwordServiceFactory::IsAlwaysOnAvailable(); |
160 result.enabled = hotword_service->IsSometimesOnEnabled(); | 163 result.enabled = hotword_service->IsSometimesOnEnabled(); |
161 result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging(); | 164 result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging(); |
162 result.training_enabled = hotword_service->IsTraining(); | 165 result.training_enabled = hotword_service->IsTraining(); |
163 result.always_on_enabled = hotword_service->IsAlwaysOnEnabled(); | 166 result.always_on_enabled = hotword_service->IsAlwaysOnEnabled(); |
164 result.user_is_active = hotword_service->UserIsActive(); | 167 result.user_is_active = hotword_service->UserIsActive(); |
165 } | 168 } |
166 | 169 |
167 PrefService* prefs = GetProfile()->GetPrefs(); | 170 PrefService* prefs = GetProfile()->GetPrefs(); |
168 result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled); | 171 result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled); |
169 result.experimental_hotword_enabled = | 172 result.experimental_hotword_enabled = |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse( | 447 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse( |
445 bool success, bool new_enabled_value) { | 448 bool success, bool new_enabled_value) { |
446 api::hotword_private::AudioHistoryState result; | 449 api::hotword_private::AudioHistoryState result; |
447 result.success = success; | 450 result.success = success; |
448 result.enabled = new_enabled_value; | 451 result.enabled = new_enabled_value; |
449 SetResult(result.ToValue().release()); | 452 SetResult(result.ToValue().release()); |
450 SendResponse(true); | 453 SendResponse(true); |
451 } | 454 } |
452 | 455 |
453 } // namespace extensions | 456 } // namespace extensions |
OLD | NEW |