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 15 matching lines...) Expand all Loading... | |
26 #include "config.h" | 26 #include "config.h" |
27 #include "web/SpeechRecognitionClientProxy.h" | 27 #include "web/SpeechRecognitionClientProxy.h" |
28 | 28 |
29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
30 #include "modules/speech/SpeechGrammarList.h" | 30 #include "modules/speech/SpeechGrammarList.h" |
31 #include "modules/speech/SpeechRecognition.h" | 31 #include "modules/speech/SpeechRecognition.h" |
32 #include "modules/speech/SpeechRecognitionError.h" | 32 #include "modules/speech/SpeechRecognitionError.h" |
33 #include "modules/speech/SpeechRecognitionResult.h" | 33 #include "modules/speech/SpeechRecognitionResult.h" |
34 #include "modules/speech/SpeechRecognitionResultList.h" | 34 #include "modules/speech/SpeechRecognitionResultList.h" |
35 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
36 #include "public/platform/WebMediaStreamTrack.h" | |
36 #include "public/web/WebSecurityOrigin.h" | 37 #include "public/web/WebSecurityOrigin.h" |
37 #include "public/web/WebSpeechGrammar.h" | 38 #include "public/web/WebSpeechGrammar.h" |
38 #include "public/web/WebSpeechRecognitionHandle.h" | 39 #include "public/web/WebSpeechRecognitionHandle.h" |
39 #include "public/web/WebSpeechRecognitionParams.h" | 40 #include "public/web/WebSpeechRecognitionParams.h" |
40 #include "public/web/WebSpeechRecognitionResult.h" | 41 #include "public/web/WebSpeechRecognitionResult.h" |
41 #include "public/web/WebSpeechRecognizer.h" | 42 #include "public/web/WebSpeechRecognizer.h" |
42 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
46 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() | 47 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() |
47 { | 48 { |
48 } | 49 } |
49 | 50 |
50 PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(We bSpeechRecognizer* recognizer) | 51 PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(We bSpeechRecognizer* recognizer) |
51 { | 52 { |
52 return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); | 53 return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); |
53 } | 54 } |
54 | 55 |
56 void SpeechRecognitionClientProxy::setAudioTrack(SpeechRecognition* recognition, MediaStreamTrack* audioTrack) | |
57 { | |
58 m_recognizer->setAudioTrack(WebSpeechRecognitionHandle(recognition), audioTr ack->component(), this); | |
no longer working on chromium
2014/08/14 15:41:34
how about
if (audioTrack) {
m_recognizer->Attac
burnik
2014/08/14 16:35:15
I wonder if it's a good design to introduce logic
| |
59 } | |
60 | |
61 void SpeechRecognitionClientProxy::clearAudioTrack(SpeechRecognition* recognitio n) | |
62 { | |
63 m_recognizer->clearAudioTrack(WebSpeechRecognitionHandle(recognition), this) ; | |
64 } | |
65 | |
55 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S peechGrammarList* grammarList, const String& lang, bool continuous, bool interim Results, unsigned long maxAlternatives) | 66 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S peechGrammarList* grammarList, const String& lang, bool continuous, bool interim Results, unsigned long maxAlternatives) |
56 { | 67 { |
57 WebVector<WebSpeechGrammar> webSpeechGrammars(static_cast<size_t>(grammarLis t->length())); | 68 WebVector<WebSpeechGrammar> webSpeechGrammars(static_cast<size_t>(grammarLis t->length())); |
58 for (unsigned long i = 0; i < grammarList->length(); ++i) | 69 for (unsigned long i = 0; i < grammarList->length(); ++i) |
59 webSpeechGrammars[i] = grammarList->item(i); | 70 webSpeechGrammars[i] = grammarList->item(i); |
60 | 71 |
61 WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, inter imResults, maxAlternatives, WebSecurityOrigin(recognition->executionContext()->s ecurityOrigin())); | 72 WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, inter imResults, maxAlternatives, WebSecurityOrigin(recognition->executionContext()->s ecurityOrigin())); |
62 m_recognizer->start(WebSpeechRecognitionHandle(recognition), params, this); | 73 m_recognizer->start(WebSpeechRecognitionHandle(recognition), params, this); |
63 } | 74 } |
64 | 75 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 SpeechRecognition* recognition(handle); | 148 SpeechRecognition* recognition(handle); |
138 recognition->didEnd(); | 149 recognition->didEnd(); |
139 } | 150 } |
140 | 151 |
141 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer* recognizer) | 152 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer* recognizer) |
142 : m_recognizer(recognizer) | 153 : m_recognizer(recognizer) |
143 { | 154 { |
144 } | 155 } |
145 | 156 |
146 } // namespace blink | 157 } // namespace blink |
OLD | NEW |