OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S
peechGrammarList* grammarList, const String& lang, bool continuous, bool interim
Results, unsigned long maxAlternatives, MediaStreamTrack* audioTrack) | 57 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S
peechGrammarList* grammarList, const String& lang, bool continuous, bool interim
Results, unsigned long maxAlternatives, MediaStreamTrack* audioTrack) |
58 { | 58 { |
59 size_t length = grammarList ? static_cast<size_t>(grammarList->length()) : 0
U; | 59 size_t length = grammarList ? static_cast<size_t>(grammarList->length()) : 0
U; |
60 WebVector<WebSpeechGrammar> webSpeechGrammars(length); | 60 WebVector<WebSpeechGrammar> webSpeechGrammars(length); |
61 for (unsigned long i = 0; i < length; ++i) | 61 for (unsigned long i = 0; i < length; ++i) |
62 webSpeechGrammars[i] = grammarList->item(i); | 62 webSpeechGrammars[i] = grammarList->item(i); |
63 | 63 |
64 WebMediaStreamTrack track; | 64 WebMediaStreamTrack track; |
65 if (RuntimeEnabledFeatures::mediaStreamSpeechEnabled() && audioTrack) | 65 if (RuntimeEnabledFeatures::mediaStreamSpeechEnabled() && audioTrack) |
66 track.assign(audioTrack->component()); | 66 track.assign(audioTrack->component()); |
67 WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, inter
imResults, maxAlternatives, track, WebSecurityOrigin(recognition->executionConte
xt()->securityOrigin())); | 67 WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, inter
imResults, maxAlternatives, track, WebSecurityOrigin(recognition->getExecutionCo
ntext()->getSecurityOrigin())); |
68 m_recognizer->start(recognition, params, this); | 68 m_recognizer->start(recognition, params, this); |
69 } | 69 } |
70 | 70 |
71 void SpeechRecognitionClientProxy::stop(SpeechRecognition* recognition) | 71 void SpeechRecognitionClientProxy::stop(SpeechRecognition* recognition) |
72 { | 72 { |
73 m_recognizer->stop(recognition, this); | 73 m_recognizer->stop(recognition, this); |
74 } | 74 } |
75 | 75 |
76 void SpeechRecognitionClientProxy::abort(SpeechRecognition* recognition) | 76 void SpeechRecognitionClientProxy::abort(SpeechRecognition* recognition) |
77 { | 77 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 SpeechRecognition* recognition(handle); | 143 SpeechRecognition* recognition(handle); |
144 recognition->didEnd(); | 144 recognition->didEnd(); |
145 } | 145 } |
146 | 146 |
147 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) | 147 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) |
148 : m_recognizer(recognizer) | 148 : m_recognizer(recognizer) |
149 { | 149 { |
150 } | 150 } |
151 | 151 |
152 } // namespace blink | 152 } // namespace blink |
OLD | NEW |