| 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 | |
| 196 class PlatformAudio { | 183 class PlatformAudio { |
| 197 public: | 184 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 |
| 198 // Starts the playback. Returns false on error or if called before the | 196 // Starts the playback. Returns false on error or if called before the |
| 199 // stream is created or after the stream is closed. | 197 // stream is created or after the stream is closed. |
| 200 virtual bool StartPlayback() = 0; | 198 virtual bool StartPlayback() = 0; |
| 201 | 199 |
| 202 // Stops the playback. Returns false on error or if called before the stream | 200 // Stops the playback. Returns false on error or if called before the stream |
| 203 // is created or after the stream is closed. | 201 // is created or after the stream is closed. |
| 204 virtual bool StopPlayback() = 0; | 202 virtual bool StopPlayback() = 0; |
| 205 | 203 |
| 206 // Closes the stream. Make sure to call this before the object is | 204 // Closes the stream. Make sure to call this before the object is |
| 207 // destructed. | 205 // destructed. |
| 208 virtual void ShutDown() = 0; | 206 virtual void ShutDown() = 0; |
| 209 | 207 |
| 210 protected: | 208 protected: |
| 211 virtual ~PlatformAudio() {} | 209 virtual ~PlatformAudio() {} |
| 212 }; | 210 }; |
| 213 | 211 |
| 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 | |
| 232 // Interface for PlatformVideoDecoder is directly inherited from general media | 212 // Interface for PlatformVideoDecoder is directly inherited from general media |
| 233 // VideoDecodeAccelerator interface. | 213 // VideoDecodeAccelerator interface. |
| 234 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { | 214 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { |
| 235 protected: | 215 protected: |
| 236 virtual ~PlatformVideoDecoder() {} | 216 virtual ~PlatformVideoDecoder() {} |
| 237 }; | 217 }; |
| 238 | 218 |
| 239 class PlatformVideoCapture : public media::VideoCapture { | 219 class PlatformVideoCapture : public media::VideoCapture { |
| 240 public: | 220 public: |
| 241 virtual ~PlatformVideoCapture() {} | 221 virtual ~PlatformVideoCapture() {} |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 278 |
| 299 // The caller will own the pointer returned from this. | 279 // The caller will own the pointer returned from this. |
| 300 virtual PlatformVideoDecoder* CreateVideoDecoder( | 280 virtual PlatformVideoDecoder* CreateVideoDecoder( |
| 301 media::VideoDecodeAccelerator::Client* client, | 281 media::VideoDecodeAccelerator::Client* client, |
| 302 int32 command_buffer_route_id) = 0; | 282 int32 command_buffer_route_id) = 0; |
| 303 | 283 |
| 304 // The caller is responsible for calling Shutdown() on the returned pointer | 284 // The caller is responsible for calling Shutdown() on the returned pointer |
| 305 // to clean up the corresponding resources allocated during this call. | 285 // to clean up the corresponding resources allocated during this call. |
| 306 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, | 286 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, |
| 307 uint32_t sample_count, | 287 uint32_t sample_count, |
| 308 PlatformAudioCommonClient* client) = 0; | 288 PlatformAudio::Client* 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; | |
| 315 | 289 |
| 316 // A pointer is returned immediately, but it is not ready to be used until | 290 // A pointer is returned immediately, but it is not ready to be used until |
| 317 // BrokerConnected has been called. | 291 // BrokerConnected has been called. |
| 318 // The caller is responsible for calling Release() on the returned pointer | 292 // The caller is responsible for calling Release() on the returned pointer |
| 319 // to clean up the corresponding resources allocated during this call. | 293 // to clean up the corresponding resources allocated during this call. |
| 320 virtual PpapiBroker* ConnectToPpapiBroker( | 294 virtual PpapiBroker* ConnectToPpapiBroker( |
| 321 webkit::ppapi::PPB_Broker_Impl* client) = 0; | 295 webkit::ppapi::PPB_Broker_Impl* client) = 0; |
| 322 | 296 |
| 323 // Notifies that the number of find results has changed. | 297 // Notifies that the number of find results has changed. |
| 324 virtual void NumberOfFindResultsChanged(int identifier, | 298 virtual void NumberOfFindResultsChanged(int identifier, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; | 457 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; |
| 484 | 458 |
| 485 // Determines if the browser entered fullscreen mode. | 459 // Determines if the browser entered fullscreen mode. |
| 486 virtual bool IsInFullscreenMode() = 0; | 460 virtual bool IsInFullscreenMode() = 0; |
| 487 }; | 461 }; |
| 488 | 462 |
| 489 } // namespace ppapi | 463 } // namespace ppapi |
| 490 } // namespace webkit | 464 } // namespace webkit |
| 491 | 465 |
| 492 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 466 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
| OLD | NEW |