| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Set an optional callback that will be invoked when the context is lost | 174 // Set an optional callback that will be invoked when the context is lost |
| 175 // (e.g. gpu process crash). Takes ownership of the callback. | 175 // (e.g. gpu process crash). Takes ownership of the callback. |
| 176 virtual void SetContextLostCallback( | 176 virtual void SetContextLostCallback( |
| 177 const base::Callback<void()>& callback) = 0; | 177 const base::Callback<void()>& callback) = 0; |
| 178 | 178 |
| 179 // Run the callback once the channel has been flushed. | 179 // Run the callback once the channel has been flushed. |
| 180 virtual bool Echo(const base::Callback<void()>& callback) = 0; | 180 virtual bool Echo(const base::Callback<void()>& callback) = 0; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // The (interface for the) client used by |PlatformAudio| and |
| 184 // |PlatformAudioInput|. |
| 185 class PlatformAudioCommonClient { |
| 186 protected: |
| 187 virtual ~PlatformAudioCommonClient() {} |
| 188 |
| 189 public: |
| 190 // Called when the stream is created. |
| 191 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, |
| 192 size_t shared_memory_size, |
| 193 base::SyncSocket::Handle socket) = 0; |
| 194 }; |
| 195 |
| 183 class PlatformAudio { | 196 class PlatformAudio { |
| 184 public: | 197 public: |
| 185 class Client { | |
| 186 protected: | |
| 187 virtual ~Client() {} | |
| 188 | |
| 189 public: | |
| 190 // Called when the stream is created. | |
| 191 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, | |
| 192 size_t shared_memory_size, | |
| 193 base::SyncSocket::Handle socket) = 0; | |
| 194 }; | |
| 195 | |
| 196 // Starts the playback. Returns false on error or if called before the | 198 // Starts the playback. Returns false on error or if called before the |
| 197 // stream is created or after the stream is closed. | 199 // stream is created or after the stream is closed. |
| 198 virtual bool StartPlayback() = 0; | 200 virtual bool StartPlayback() = 0; |
| 199 | 201 |
| 200 // Stops the playback. Returns false on error or if called before the stream | 202 // Stops the playback. Returns false on error or if called before the stream |
| 201 // is created or after the stream is closed. | 203 // is created or after the stream is closed. |
| 202 virtual bool StopPlayback() = 0; | 204 virtual bool StopPlayback() = 0; |
| 203 | 205 |
| 204 // Closes the stream. Make sure to call this before the object is | 206 // Closes the stream. Make sure to call this before the object is |
| 205 // destructed. | 207 // destructed. |
| 206 virtual void ShutDown() = 0; | 208 virtual void ShutDown() = 0; |
| 207 | 209 |
| 208 protected: | 210 protected: |
| 209 virtual ~PlatformAudio() {} | 211 virtual ~PlatformAudio() {} |
| 210 }; | 212 }; |
| 211 | 213 |
| 214 class PlatformAudioInput { |
| 215 public: |
| 216 // Starts the playback. Returns false on error or if called before the |
| 217 // stream is created or after the stream is closed. |
| 218 virtual bool StartCapture() = 0; |
| 219 |
| 220 // Stops the capture. Returns false on error or if called before the stream |
| 221 // is created or after the stream is closed. |
| 222 virtual bool StopCapture() = 0; |
| 223 |
| 224 // Closes the stream. Make sure to call this before the object is |
| 225 // destructed. |
| 226 virtual void ShutDown() = 0; |
| 227 |
| 228 protected: |
| 229 virtual ~PlatformAudioInput() {} |
| 230 }; |
| 231 |
| 212 // Interface for PlatformVideoDecoder is directly inherited from general media | 232 // Interface for PlatformVideoDecoder is directly inherited from general media |
| 213 // VideoDecodeAccelerator interface. | 233 // VideoDecodeAccelerator interface. |
| 214 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { | 234 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { |
| 215 protected: | 235 protected: |
| 216 virtual ~PlatformVideoDecoder() {} | 236 virtual ~PlatformVideoDecoder() {} |
| 217 }; | 237 }; |
| 218 | 238 |
| 219 class PlatformVideoCapture : public media::VideoCapture { | 239 class PlatformVideoCapture : public media::VideoCapture { |
| 220 public: | 240 public: |
| 221 virtual ~PlatformVideoCapture() {} | 241 virtual ~PlatformVideoCapture() {} |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 298 |
| 279 // The caller will own the pointer returned from this. | 299 // The caller will own the pointer returned from this. |
| 280 virtual PlatformVideoDecoder* CreateVideoDecoder( | 300 virtual PlatformVideoDecoder* CreateVideoDecoder( |
| 281 media::VideoDecodeAccelerator::Client* client, | 301 media::VideoDecodeAccelerator::Client* client, |
| 282 int32 command_buffer_route_id) = 0; | 302 int32 command_buffer_route_id) = 0; |
| 283 | 303 |
| 284 // The caller is responsible for calling Shutdown() on the returned pointer | 304 // The caller is responsible for calling Shutdown() on the returned pointer |
| 285 // to clean up the corresponding resources allocated during this call. | 305 // to clean up the corresponding resources allocated during this call. |
| 286 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, | 306 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, |
| 287 uint32_t sample_count, | 307 uint32_t sample_count, |
| 288 PlatformAudio::Client* client) = 0; | 308 PlatformAudioCommonClient* client) = 0; |
| 309 |
| 310 // The caller is responsible for calling Shutdown() on the returned pointer |
| 311 // to clean up the corresponding resources allocated during this call. |
| 312 virtual PlatformAudioInput* CreateAudioInput(uint32_t sample_rate, |
| 313 uint32_t sample_count, |
| 314 PlatformAudioCommonClient* client) = 0; |
| 289 | 315 |
| 290 // A pointer is returned immediately, but it is not ready to be used until | 316 // A pointer is returned immediately, but it is not ready to be used until |
| 291 // BrokerConnected has been called. | 317 // BrokerConnected has been called. |
| 292 // The caller is responsible for calling Release() on the returned pointer | 318 // The caller is responsible for calling Release() on the returned pointer |
| 293 // to clean up the corresponding resources allocated during this call. | 319 // to clean up the corresponding resources allocated during this call. |
| 294 virtual PpapiBroker* ConnectToPpapiBroker( | 320 virtual PpapiBroker* ConnectToPpapiBroker( |
| 295 webkit::ppapi::PPB_Broker_Impl* client) = 0; | 321 webkit::ppapi::PPB_Broker_Impl* client) = 0; |
| 296 | 322 |
| 297 // Notifies that the number of find results has changed. | 323 // Notifies that the number of find results has changed. |
| 298 virtual void NumberOfFindResultsChanged(int identifier, | 324 virtual void NumberOfFindResultsChanged(int identifier, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; | 483 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; |
| 458 | 484 |
| 459 // Determines if the browser entered fullscreen mode. | 485 // Determines if the browser entered fullscreen mode. |
| 460 virtual bool IsInFullscreenMode() = 0; | 486 virtual bool IsInFullscreenMode() = 0; |
| 461 }; | 487 }; |
| 462 | 488 |
| 463 } // namespace ppapi | 489 } // namespace ppapi |
| 464 } // namespace webkit | 490 } // namespace webkit |
| 465 | 491 |
| 466 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 492 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
| OLD | NEW |