| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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  Loading... | 
| 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 | 
| OLD | NEW | 
|---|