Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: content/renderer/speech_recognition_dispatcher.h

Issue 636863003: Make SpeechRecognition per RenderFrame instead of per RenderView. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/speech_recognition_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
6 #define CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ 6 #define CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/sync_socket.h" 13 #include "base/sync_socket.h"
14 #include "content/public/common/speech_recognition_result.h" 14 #include "content/public/common/speech_recognition_result.h"
15 #include "content/public/renderer/render_view_observer.h" 15 #include "content/public/renderer/render_frame_observer.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 17 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebSpeechRecognitionHandle.h" 18 #include "third_party/WebKit/public/web/WebSpeechRecognitionHandle.h"
19 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h" 19 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h"
20 20
21 namespace media { 21 namespace media {
22 class AudioParameters; 22 class AudioParameters;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class RenderViewImpl;
27 #if defined(ENABLE_WEBRTC) 26 #if defined(ENABLE_WEBRTC)
28 class SpeechRecognitionAudioSink; 27 class SpeechRecognitionAudioSink;
29 #endif 28 #endif
30 struct SpeechRecognitionError; 29 struct SpeechRecognitionError;
31 struct SpeechRecognitionResult; 30 struct SpeechRecognitionResult;
32 31
33 // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for 32 // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for
34 // scripted JS speech APIs. It's the complement of 33 // scripted JS speech APIs. It's the complement of
35 // SpeechRecognitionDispatcherHost (owned by RenderViewHost). 34 // SpeechRecognitionDispatcherHost (owned by RenderFrameHost).
36 class SpeechRecognitionDispatcher : public RenderViewObserver, 35 class SpeechRecognitionDispatcher : public RenderFrameObserver,
37 public blink::WebSpeechRecognizer { 36 public blink::WebSpeechRecognizer {
38 public: 37 public:
39 explicit SpeechRecognitionDispatcher(RenderViewImpl* render_view); 38 explicit SpeechRecognitionDispatcher(RenderFrame* render_frame);
40 virtual ~SpeechRecognitionDispatcher(); 39 virtual ~SpeechRecognitionDispatcher();
41 40
42 // Aborts all speech recognitions.
43 void AbortAllRecognitions();
44
45 private: 41 private:
46 // RenderViewObserver implementation. 42 // RenderFrameObserver implementation.
47 bool OnMessageReceived(const IPC::Message& message) override; 43 bool OnMessageReceived(const IPC::Message& message) override;
44 void WasHidden() override;
48 45
49 // blink::WebSpeechRecognizer implementation. 46 // blink::WebSpeechRecognizer implementation.
50 virtual void start(const blink::WebSpeechRecognitionHandle&, 47 virtual void start(const blink::WebSpeechRecognitionHandle&,
51 const blink::WebSpeechRecognitionParams&, 48 const blink::WebSpeechRecognitionParams&,
52 blink::WebSpeechRecognizerClient*); 49 blink::WebSpeechRecognizerClient*);
53 virtual void stop(const blink::WebSpeechRecognitionHandle&, 50 virtual void stop(const blink::WebSpeechRecognitionHandle&,
54 blink::WebSpeechRecognizerClient*); 51 blink::WebSpeechRecognizerClient*);
55 virtual void abort(const blink::WebSpeechRecognitionHandle&, 52 virtual void abort(const blink::WebSpeechRecognitionHandle&,
56 blink::WebSpeechRecognizerClient*); 53 blink::WebSpeechRecognizerClient*);
57 54
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap; 87 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap;
91 HandleMap handle_map_; 88 HandleMap handle_map_;
92 int next_id_; 89 int next_id_;
93 90
94 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher); 91 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher);
95 }; 92 };
96 93
97 } // namespace content 94 } // namespace content
98 95
99 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ 96 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/speech_recognition_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698