| 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 "content/browser/speech/speech_recognizer.h" | 5 #include "content/browser/speech/speech_recognizer.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 SpeechRecognizer::FSMState | 248 SpeechRecognizer::FSMState |
| 249 SpeechRecognizer::ExecuteTransitionAndGetNextState( | 249 SpeechRecognizer::ExecuteTransitionAndGetNextState( |
| 250 const FSMEventArgs& event_args) { | 250 const FSMEventArgs& event_args) { |
| 251 const FSMEvent event = event_args.event; | 251 const FSMEvent event = event_args.event; |
| 252 switch (state_) { | 252 switch (state_) { |
| 253 case STATE_IDLE: | 253 case STATE_IDLE: |
| 254 switch (event) { | 254 switch (event) { |
| 255 // TODO(primiano): restore UNREACHABLE_CONDITION on EVENT_ABORT and | 255 // TODO(primiano): restore UNREACHABLE_CONDITION on EVENT_ABORT and |
| 256 // EVENT_STOP_CAPTURE below once speech input extensions are fixed. | 256 // EVENT_STOP_CAPTURE below once speech input extensions are fixed. |
| 257 case EVENT_ABORT: | 257 case EVENT_ABORT: |
| 258 return DoNothing(event_args); | 258 return AbortSilently(event_args); |
| 259 case EVENT_START: | 259 case EVENT_START: |
| 260 return StartRecording(event_args); | 260 return StartRecording(event_args); |
| 261 case EVENT_STOP_CAPTURE: // Corner cases related to queued messages | 261 case EVENT_STOP_CAPTURE: |
| 262 case EVENT_AUDIO_DATA: // being lately dispatched. | 262 return AbortSilently(event_args); |
| 263 case EVENT_ENGINE_RESULT: | 263 case EVENT_AUDIO_DATA: // Corner cases related to queued messages |
| 264 case EVENT_ENGINE_RESULT: // being lately dispatched. |
| 264 case EVENT_ENGINE_ERROR: | 265 case EVENT_ENGINE_ERROR: |
| 265 case EVENT_AUDIO_ERROR: | 266 case EVENT_AUDIO_ERROR: |
| 266 return DoNothing(event_args); | 267 return DoNothing(event_args); |
| 267 } | 268 } |
| 268 break; | 269 break; |
| 269 case STATE_STARTING: | 270 case STATE_STARTING: |
| 270 switch (event) { | 271 switch (event) { |
| 271 case EVENT_ABORT: | 272 case EVENT_ABORT: |
| 272 return AbortWithError(event_args); | 273 return AbortWithError(event_args); |
| 273 case EVENT_START: | 274 case EVENT_START: |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 : event(event_value), | 658 : event(event_value), |
| 658 audio_error_code(0), | 659 audio_error_code(0), |
| 659 audio_data(NULL), | 660 audio_data(NULL), |
| 660 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { | 661 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { |
| 661 } | 662 } |
| 662 | 663 |
| 663 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { | 664 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { |
| 664 } | 665 } |
| 665 | 666 |
| 666 } // namespace speech | 667 } // namespace speech |
| OLD | NEW |