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> |
45 | 47 |
46 namespace blink { | 48 namespace blink { |
47 | 49 |
48 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() | 50 SpeechRecognitionClientProxy::~SpeechRecognitionClientProxy() |
49 { | 51 { |
50 } | 52 } |
51 | 53 |
52 PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(We
bSpeechRecognizer* recognizer) | 54 std::unique_ptr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::crea
te(WebSpeechRecognizer* recognizer) |
53 { | 55 { |
54 return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); | 56 return wrapUnique(new SpeechRecognitionClientProxy(recognizer)); |
55 } | 57 } |
56 | 58 |
57 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S
peechGrammarList* grammarList, const String& lang, bool continuous, bool interim
Results, unsigned long maxAlternatives, MediaStreamTrack* audioTrack) | 59 void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const S
peechGrammarList* grammarList, const String& lang, bool continuous, bool interim
Results, unsigned long maxAlternatives, MediaStreamTrack* audioTrack) |
58 { | 60 { |
59 size_t length = grammarList ? static_cast<size_t>(grammarList->length()) : 0
U; | 61 size_t length = grammarList ? static_cast<size_t>(grammarList->length()) : 0
U; |
60 WebVector<WebSpeechGrammar> webSpeechGrammars(length); | 62 WebVector<WebSpeechGrammar> webSpeechGrammars(length); |
61 for (unsigned long i = 0; i < length; ++i) | 63 for (unsigned long i = 0; i < length; ++i) |
62 webSpeechGrammars[i] = grammarList->item(i); | 64 webSpeechGrammars[i] = grammarList->item(i); |
63 | 65 |
64 WebMediaStreamTrack track; | 66 WebMediaStreamTrack track; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 SpeechRecognition* recognition(handle); | 145 SpeechRecognition* recognition(handle); |
144 recognition->didEnd(); | 146 recognition->didEnd(); |
145 } | 147 } |
146 | 148 |
147 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) | 149 SpeechRecognitionClientProxy::SpeechRecognitionClientProxy(WebSpeechRecognizer*
recognizer) |
148 : m_recognizer(recognizer) | 150 : m_recognizer(recognizer) |
149 { | 151 { |
150 } | 152 } |
151 | 153 |
152 } // namespace blink | 154 } // namespace blink |
OLD | NEW |