OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 | 180 |
181 // Set an optional callback that will be invoked when the context is lost | 181 // Set an optional callback that will be invoked when the context is lost |
182 // (e.g. gpu process crash). Takes ownership of the callback. | 182 // (e.g. gpu process crash). Takes ownership of the callback. |
183 virtual void SetContextLostCallback( | 183 virtual void SetContextLostCallback( |
184 const base::Callback<void()>& callback) = 0; | 184 const base::Callback<void()>& callback) = 0; |
185 | 185 |
186 // Run the callback once the channel has been flushed. | 186 // Run the callback once the channel has been flushed. |
187 virtual bool Echo(const base::Callback<void()>& callback) = 0; | 187 virtual bool Echo(const base::Callback<void()>& callback) = 0; |
188 }; | 188 }; |
189 | 189 |
190 // The (interface for the) client used by |PlatformAudio| and | |
191 // |PlatformAudioInput|. | |
192 class PlatformAudioCommonClient { | |
193 protected: | |
194 virtual ~PlatformAudioCommonClient() {} | |
195 | |
196 public: | |
197 // Called when the stream is created. | |
198 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, | |
199 size_t shared_memory_size, | |
200 base::SyncSocket::Handle socket) = 0; | |
201 }; | |
202 | |
190 class PlatformAudio { | 203 class PlatformAudio { |
191 public: | 204 public: |
192 class Client { | |
193 protected: | |
194 virtual ~Client() {} | |
195 | |
196 public: | |
197 // Called when the stream is created. | |
198 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, | |
199 size_t shared_memory_size, | |
200 base::SyncSocket::Handle socket) = 0; | |
201 }; | |
202 | |
203 // Starts the playback. Returns false on error or if called before the | 205 // Starts the playback. Returns false on error or if called before the |
204 // stream is created or after the stream is closed. | 206 // stream is created or after the stream is closed. |
205 virtual bool StartPlayback() = 0; | 207 virtual bool StartPlayback() = 0; |
206 | 208 |
207 // Stops the playback. Returns false on error or if called before the stream | 209 // Stops the playback. Returns false on error or if called before the stream |
208 // is created or after the stream is closed. | 210 // is created or after the stream is closed. |
209 virtual bool StopPlayback() = 0; | 211 virtual bool StopPlayback() = 0; |
210 | 212 |
211 // Closes the stream. Make sure to call this before the object is | 213 // Closes the stream. Make sure to call this before the object is |
212 // destructed. | 214 // destructed. |
213 virtual void ShutDown() = 0; | 215 virtual void ShutDown() = 0; |
214 | 216 |
215 protected: | 217 protected: |
216 virtual ~PlatformAudio() {} | 218 virtual ~PlatformAudio() {} |
217 }; | 219 }; |
218 | 220 |
221 class PlatformAudioInput { | |
222 public: | |
223 // Starts the playback. Returns false on error or if called before the | |
224 // stream is created or after the stream is closed. | |
225 virtual bool StartCapture() = 0; | |
226 | |
227 // Stops the capture. Returns false on error or if called before the stream | |
228 // is created or after the stream is closed. | |
229 virtual bool StopCapture() = 0; | |
230 | |
231 // Closes the stream. Make sure to call this before the object is | |
232 // destructed. | |
233 virtual void ShutDown() = 0; | |
234 | |
235 protected: | |
236 virtual ~PlatformAudioInput() {} | |
237 }; | |
238 | |
219 // Interface for PlatformVideoDecoder is directly inherited from general media | 239 // Interface for PlatformVideoDecoder is directly inherited from general media |
220 // VideoDecodeAccelerator interface. | 240 // VideoDecodeAccelerator interface. |
221 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { | 241 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { |
222 protected: | 242 protected: |
223 virtual ~PlatformVideoDecoder() {} | 243 virtual ~PlatformVideoDecoder() {} |
224 }; | 244 }; |
225 | 245 |
226 class PlatformVideoCapture : public media::VideoCapture { | 246 class PlatformVideoCapture : public media::VideoCapture { |
227 public: | 247 public: |
228 virtual ~PlatformVideoCapture() {} | 248 virtual ~PlatformVideoCapture() {} |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 | 305 |
286 // The caller will own the pointer returned from this. | 306 // The caller will own the pointer returned from this. |
287 virtual PlatformVideoDecoder* CreateVideoDecoder( | 307 virtual PlatformVideoDecoder* CreateVideoDecoder( |
288 media::VideoDecodeAccelerator::Client* client, | 308 media::VideoDecodeAccelerator::Client* client, |
289 int32 command_buffer_route_id) = 0; | 309 int32 command_buffer_route_id) = 0; |
290 | 310 |
291 // The caller is responsible for calling Shutdown() on the returned pointer | 311 // The caller is responsible for calling Shutdown() on the returned pointer |
292 // to clean up the corresponding resources allocated during this call. | 312 // to clean up the corresponding resources allocated during this call. |
293 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, | 313 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, |
294 uint32_t sample_count, | 314 uint32_t sample_count, |
295 PlatformAudio::Client* client) = 0; | 315 PlatformAudioCommonClient* client) = 0; |
316 | |
317 // The caller is responsible for calling Shutdown() on the returned pointer | |
318 // to clean up the corresponding resources allocated during this call. | |
319 virtual PlatformAudioInput* CreateAudioInput(uint32_t sample_rate, | |
dmichael (off chromium)
2011/11/17 18:24:04
nit: I would usually put sample_rate on the next l
| |
320 uint32_t sample_count, | |
321 PlatformAudioCommonClient* client) = 0; | |
296 | 322 |
297 // A pointer is returned immediately, but it is not ready to be used until | 323 // A pointer is returned immediately, but it is not ready to be used until |
298 // BrokerConnected has been called. | 324 // BrokerConnected has been called. |
299 // The caller is responsible for calling Release() on the returned pointer | 325 // The caller is responsible for calling Release() on the returned pointer |
300 // to clean up the corresponding resources allocated during this call. | 326 // to clean up the corresponding resources allocated during this call. |
301 virtual PpapiBroker* ConnectToPpapiBroker( | 327 virtual PpapiBroker* ConnectToPpapiBroker( |
302 webkit::ppapi::PPB_Broker_Impl* client) = 0; | 328 webkit::ppapi::PPB_Broker_Impl* client) = 0; |
303 | 329 |
304 // Notifies that the number of find results has changed. | 330 // Notifies that the number of find results has changed. |
305 virtual void NumberOfFindResultsChanged(int identifier, | 331 virtual void NumberOfFindResultsChanged(int identifier, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; | 490 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; |
465 | 491 |
466 // Determines if the browser entered fullscreen mode. | 492 // Determines if the browser entered fullscreen mode. |
467 virtual bool IsInFullscreenMode() = 0; | 493 virtual bool IsInFullscreenMode() = 0; |
468 }; | 494 }; |
469 | 495 |
470 } // namespace ppapi | 496 } // namespace ppapi |
471 } // namespace webkit | 497 } // namespace webkit |
472 | 498 |
473 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 499 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
OLD | NEW |