OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/speech/speech_input_extension_api.h" | 5 #include "chrome/browser/speech/speech_input_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 SpeechInputExtensionManager::kStopping, | 159 SpeechInputExtensionManager::kStopping, |
160 SpeechInputExtensionManager::kIdle, | 160 SpeechInputExtensionManager::kIdle, |
161 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED) { | 161 chrome::NOTIFICATION_EXTENSION_SPEECH_INPUT_RECORDING_STOPPED) { |
162 } | 162 } |
163 | 163 |
164 bool StopSpeechInputFunction::RunImpl() { | 164 bool StopSpeechInputFunction::RunImpl() { |
165 return SpeechInputExtensionManager::GetForProfile( | 165 return SpeechInputExtensionManager::GetForProfile( |
166 profile())->Stop(extension_id(), &error_); | 166 profile())->Stop(extension_id(), &error_); |
167 } | 167 } |
168 | 168 |
169 void IsRecordingSpeechInputFunction::SetResult(bool result) { | 169 void IsRecordingSpeechInputFunction::SetIsRecordingResult(bool result) { |
170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
171 result_.reset(Value::CreateBooleanValue(result)); | 171 SetResult(Value::CreateBooleanValue(result)); |
172 SendResponse(true); | 172 SendResponse(true); |
173 } | 173 } |
174 | 174 |
175 void IsRecordingSpeechInputFunction::Run() { | 175 void IsRecordingSpeechInputFunction::Run() { |
176 SpeechInputExtensionManager::GetForProfile(profile())->IsRecording( | 176 SpeechInputExtensionManager::GetForProfile(profile())->IsRecording( |
177 base::Bind(&IsRecordingSpeechInputFunction::SetResult, this)); | 177 base::Bind(&IsRecordingSpeechInputFunction::SetIsRecordingResult, this)); |
178 } | 178 } |
179 | 179 |
180 bool IsRecordingSpeechInputFunction::RunImpl() { | 180 bool IsRecordingSpeechInputFunction::RunImpl() { |
181 // The operation needs to be asynchronous because of thread requirements. | 181 // The operation needs to be asynchronous because of thread requirements. |
182 // This method does nothing, but it needs to be implemented anyway. | 182 // This method does nothing, but it needs to be implemented anyway. |
183 return true; | 183 return true; |
184 } | 184 } |
OLD | NEW |