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 24 matching lines...) Expand all Loading... |
35 #include "platform/RuntimeEnabledFeatures.h" | 35 #include "platform/RuntimeEnabledFeatures.h" |
36 #include "platform/weborigin/SecurityOrigin.h" | 36 #include "platform/weborigin/SecurityOrigin.h" |
37 #include "public/platform/WebMediaStreamTrack.h" | 37 #include "public/platform/WebMediaStreamTrack.h" |
38 #include "public/platform/WebSecurityOrigin.h" | 38 #include "public/platform/WebSecurityOrigin.h" |
39 #include "public/web/WebSpeechGrammar.h" | 39 #include "public/web/WebSpeechGrammar.h" |
40 #include "public/web/WebSpeechRecognitionHandle.h" | 40 #include "public/web/WebSpeechRecognitionHandle.h" |
41 #include "public/web/WebSpeechRecognitionParams.h" | 41 #include "public/web/WebSpeechRecognitionParams.h" |
42 #include "public/web/WebSpeechRecognitionResult.h" | 42 #include "public/web/WebSpeechRecognitionResult.h" |
43 #include "public/web/WebSpeechRecognizer.h" | 43 #include "public/web/WebSpeechRecognizer.h" |
44 #include "wtf/PassRefPtr.h" | 44 #include "wtf/PassRefPtr.h" |
45 #include "wtf/PtrUtil.h" | |
46 #include <memory> | |
47 | 45 |
48 namespace blink { | 46 namespace blink { |
49 | 47 |
50 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() | 48 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() |
51 { | 49 { |
52 } | 50 } |
53 | 51 |
54 std::unique_ptr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::crea
te(WebSpeechRecognizer* recognizer) | 52 PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(We
bSpeechRecognizer* recognizer) |
55 { | 53 { |
56 return wrapUnique(new SpeechRecognitionClientProxy(recognizer)); | 54 return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); |
57 } | 55 } |
58 | 56 |
59 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) |
60 { | 58 { |
61 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; |
62 WebVector<WebSpeechGrammar> webSpeechGrammars(length); | 60 WebVector<WebSpeechGrammar> webSpeechGrammars(length); |
63 for (unsigned long i = 0; i < length; ++i) | 61 for (unsigned long i = 0; i < length; ++i) |
64 webSpeechGrammars[i] = grammarList->item(i); | 62 webSpeechGrammars[i] = grammarList->item(i); |
65 | 63 |
66 WebMediaStreamTrack track; | 64 WebMediaStreamTrack track; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 SpeechRecognition* recognition(handle); | 143 SpeechRecognition* recognition(handle); |
146 recognition->didEnd(); | 144 recognition->didEnd(); |
147 } | 145 } |
148 | 146 |
149 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) | 147 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) |
150 : m_recognizer(recognizer) | 148 : m_recognizer(recognizer) |
151 { | 149 { |
152 } | 150 } |
153 | 151 |
154 } // namespace blink | 152 } // namespace blink |
OLD | NEW |