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

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

Issue 2517953003: Move enable_webrtc to a buildflag header. (Closed)
Patch Set: Fix Created 4 years 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/renderer_main.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 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.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_view_observer.h"
16 #include "media/media_features.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 18 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebSpeechRecognitionHandle.h" 19 #include "third_party/WebKit/public/web/WebSpeechRecognitionHandle.h"
19 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h" 20 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h"
20 21
21 namespace media { 22 namespace media {
22 class AudioParameters; 23 class AudioParameters;
23 } 24 }
24 25
25 namespace content { 26 namespace content {
26 class RenderViewImpl; 27 class RenderViewImpl;
27 #if defined(ENABLE_WEBRTC) 28 #if BUILDFLAG(ENABLE_WEBRTC)
28 class SpeechRecognitionAudioSink; 29 class SpeechRecognitionAudioSink;
29 #endif 30 #endif
30 struct SpeechRecognitionError; 31 struct SpeechRecognitionError;
31 struct SpeechRecognitionResult; 32 struct SpeechRecognitionResult;
32 33
33 // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for 34 // SpeechRecognitionDispatcher is a delegate for methods used by WebKit for
34 // scripted JS speech APIs. It's the complement of 35 // scripted JS speech APIs. It's the complement of
35 // SpeechRecognitionDispatcherHost (owned by RenderViewHost). 36 // SpeechRecognitionDispatcherHost (owned by RenderViewHost).
36 class SpeechRecognitionDispatcher : public RenderViewObserver, 37 class SpeechRecognitionDispatcher : public RenderViewObserver,
37 public blink::WebSpeechRecognizer { 38 public blink::WebSpeechRecognizer {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 void ResetAudioSink(); 74 void ResetAudioSink();
74 75
75 int GetOrCreateIDForHandle(const blink::WebSpeechRecognitionHandle& handle); 76 int GetOrCreateIDForHandle(const blink::WebSpeechRecognitionHandle& handle);
76 bool HandleExists(const blink::WebSpeechRecognitionHandle& handle); 77 bool HandleExists(const blink::WebSpeechRecognitionHandle& handle);
77 const blink::WebSpeechRecognitionHandle& GetHandleFromID(int handle_id); 78 const blink::WebSpeechRecognitionHandle& GetHandleFromID(int handle_id);
78 79
79 // The WebKit client class that we use to send events back to the JS world. 80 // The WebKit client class that we use to send events back to the JS world.
80 blink::WebSpeechRecognizerClient* recognizer_client_; 81 blink::WebSpeechRecognizerClient* recognizer_client_;
81 82
82 #if defined(ENABLE_WEBRTC) 83 #if BUILDFLAG(ENABLE_WEBRTC)
83 // Media stream audio track that the speech recognition connects to. 84 // Media stream audio track that the speech recognition connects to.
84 // Accessed on the render thread. 85 // Accessed on the render thread.
85 blink::WebMediaStreamTrack audio_track_; 86 blink::WebMediaStreamTrack audio_track_;
86 87
87 // Audio sink used to provide audio from the track. 88 // Audio sink used to provide audio from the track.
88 std::unique_ptr<SpeechRecognitionAudioSink> speech_audio_sink_; 89 std::unique_ptr<SpeechRecognitionAudioSink> speech_audio_sink_;
89 #endif 90 #endif
90 91
91 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap; 92 typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap;
92 HandleMap handle_map_; 93 HandleMap handle_map_;
93 int next_id_; 94 int next_id_;
94 95
95 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher); 96 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcher);
96 }; 97 };
97 98
98 } // namespace content 99 } // namespace content
99 100
100 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_ 101 #endif // CONTENT_RENDERER_SPEECH_RECOGNITION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | content/renderer/speech_recognition_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698