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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 PrefService* prefs = GetProfile()->GetPrefs(); | 86 PrefService* prefs = GetProfile()->GetPrefs(); |
87 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state); | 87 prefs->SetBoolean(prefs::kHotwordSearchEnabled, params->state); |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 bool HotwordPrivateSetAudioLoggingEnabledFunction::RunSync() { | 91 bool HotwordPrivateSetAudioLoggingEnabledFunction::RunSync() { |
92 scoped_ptr<api::hotword_private::SetEnabled::Params> params( | 92 scoped_ptr<api::hotword_private::SetEnabled::Params> params( |
93 api::hotword_private::SetEnabled::Params::Create(*args_)); | 93 api::hotword_private::SetEnabled::Params::Create(*args_)); |
94 EXTENSION_FUNCTION_VALIDATE(params.get()); | 94 EXTENSION_FUNCTION_VALIDATE(params.get()); |
95 | 95 |
96 // TODO(kcarattini): Sync the chrome pref with the account-level | |
97 // Audio History setting. | |
98 PrefService* prefs = GetProfile()->GetPrefs(); | |
99 prefs->SetBoolean(prefs::kHotwordAudioLoggingEnabled, params->state); | |
100 return true; | |
101 } | |
102 | |
103 bool HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction::RunSync() { | |
104 scoped_ptr<api::hotword_private::SetEnabled::Params> params( | |
rpetterson
2014/09/11 20:14:17
This should be:
scoped_ptr<api::hotword_private::S
kcarattini
2014/09/12 01:02:07
Done.
| |
105 api::hotword_private::SetEnabled::Params::Create(*args_)); | |
106 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
107 | |
96 PrefService* prefs = GetProfile()->GetPrefs(); | 108 PrefService* prefs = GetProfile()->GetPrefs(); |
97 prefs->SetBoolean(prefs::kHotwordAudioLoggingEnabled, params->state); | 109 prefs->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, params->state); |
98 return true; | 110 return true; |
99 } | 111 } |
100 | 112 |
101 bool HotwordPrivateGetStatusFunction::RunSync() { | 113 bool HotwordPrivateGetStatusFunction::RunSync() { |
102 api::hotword_private::StatusDetails result; | 114 api::hotword_private::StatusDetails result; |
103 | 115 |
104 HotwordService* hotword_service = | 116 HotwordService* hotword_service = |
105 HotwordServiceFactory::GetForProfile(GetProfile()); | 117 HotwordServiceFactory::GetForProfile(GetProfile()); |
106 if (!hotword_service) | 118 if (!hotword_service) |
107 result.available = false; | 119 result.available = false; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 } else { | 165 } else { |
154 result.launch_mode = | 166 result.launch_mode = |
155 hotword_service->GetHotwordAudioVerificationLaunchMode(); | 167 hotword_service->GetHotwordAudioVerificationLaunchMode(); |
156 } | 168 } |
157 | 169 |
158 SetResult(result.ToValue().release()); | 170 SetResult(result.ToValue().release()); |
159 return true; | 171 return true; |
160 } | 172 } |
161 | 173 |
162 } // namespace extensions | 174 } // namespace extensions |
OLD | NEW |