| OLD | NEW |
| 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 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // sends a console message. | 196 // sends a console message. |
| 197 typedef base::Callback<void(const std::string&, int)> | 197 typedef base::Callback<void(const std::string&, int)> |
| 198 ConsoleMessageCallback; | 198 ConsoleMessageCallback; |
| 199 virtual void SetOnConsoleMessageCallback( | 199 virtual void SetOnConsoleMessageCallback( |
| 200 const ConsoleMessageCallback& callback) = 0; | 200 const ConsoleMessageCallback& callback) = 0; |
| 201 | 201 |
| 202 // Run the callback once the channel has been flushed. | 202 // Run the callback once the channel has been flushed. |
| 203 virtual bool Echo(const base::Callback<void()>& callback) = 0; | 203 virtual bool Echo(const base::Callback<void()>& callback) = 0; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 // The (interface for the) client used by |PlatformAudio| and | 206 // The base class of clients used by |PlatformAudioOutput| and |
| 207 // |PlatformAudioInput|. | 207 // |PlatformAudioInput|. |
| 208 class PlatformAudioCommonClient { | 208 class PlatformAudioClientBase { |
| 209 protected: | 209 protected: |
| 210 virtual ~PlatformAudioCommonClient() {} | 210 virtual ~PlatformAudioClientBase() {} |
| 211 | 211 |
| 212 public: | 212 public: |
| 213 // Called when the stream is created. | 213 // Called when the stream is created. |
| 214 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, | 214 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, |
| 215 size_t shared_memory_size, | 215 size_t shared_memory_size, |
| 216 base::SyncSocket::Handle socket) = 0; | 216 base::SyncSocket::Handle socket) = 0; |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 class PlatformAudioOutputClient : public PlatformAudioClientBase { |
| 220 protected: |
| 221 virtual ~PlatformAudioOutputClient() {} |
| 222 }; |
| 223 |
| 219 class PlatformAudioOutput { | 224 class PlatformAudioOutput { |
| 220 public: | 225 public: |
| 221 // Starts the playback. Returns false on error or if called before the | 226 // Starts the playback. Returns false on error or if called before the |
| 222 // stream is created or after the stream is closed. | 227 // stream is created or after the stream is closed. |
| 223 virtual bool StartPlayback() = 0; | 228 virtual bool StartPlayback() = 0; |
| 224 | 229 |
| 225 // Stops the playback. Returns false on error or if called before the stream | 230 // Stops the playback. Returns false on error or if called before the stream |
| 226 // is created or after the stream is closed. | 231 // is created or after the stream is closed. |
| 227 virtual bool StopPlayback() = 0; | 232 virtual bool StopPlayback() = 0; |
| 228 | 233 |
| 229 // Closes the stream. Make sure to call this before the object is | 234 // Closes the stream. Make sure to call this before the object is |
| 230 // destructed. | 235 // destructed. |
| 231 virtual void ShutDown() = 0; | 236 virtual void ShutDown() = 0; |
| 232 | 237 |
| 233 protected: | 238 protected: |
| 234 virtual ~PlatformAudioOutput() {} | 239 virtual ~PlatformAudioOutput() {} |
| 235 }; | 240 }; |
| 236 | 241 |
| 242 class PlatformAudioInputClient : public PlatformAudioClientBase { |
| 243 public: |
| 244 virtual void StreamCreationFailed() = 0; |
| 245 |
| 246 protected: |
| 247 virtual ~PlatformAudioInputClient() {} |
| 248 }; |
| 249 |
| 237 class PlatformAudioInput { | 250 class PlatformAudioInput { |
| 238 public: | 251 public: |
| 239 // Starts the capture. Returns false on error or if called before the | 252 virtual void StartCapture() = 0; |
| 240 // stream is created or after the stream is closed. | 253 virtual void StopCapture() = 0; |
| 241 virtual bool StartCapture() = 0; | |
| 242 | |
| 243 // Stops the capture. Returns false on error or if called before the stream | |
| 244 // is created or after the stream is closed. | |
| 245 virtual bool StopCapture() = 0; | |
| 246 | 254 |
| 247 // Closes the stream. Make sure to call this before the object is | 255 // Closes the stream. Make sure to call this before the object is |
| 248 // destructed. | 256 // destructed. |
| 249 virtual void ShutDown() = 0; | 257 virtual void ShutDown() = 0; |
| 250 | 258 |
| 251 protected: | 259 protected: |
| 252 virtual ~PlatformAudioInput() {} | 260 virtual ~PlatformAudioInput() {} |
| 253 }; | 261 }; |
| 254 | 262 |
| 255 // Interface for PlatformVideoDecoder is directly inherited from general media | 263 // Interface for PlatformVideoDecoder is directly inherited from general media |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 virtual uint32_t GetAudioHardwareOutputSampleRate() = 0; | 357 virtual uint32_t GetAudioHardwareOutputSampleRate() = 0; |
| 350 | 358 |
| 351 // Get audio hardware output buffer size. | 359 // Get audio hardware output buffer size. |
| 352 virtual uint32_t GetAudioHardwareOutputBufferSize() = 0; | 360 virtual uint32_t GetAudioHardwareOutputBufferSize() = 0; |
| 353 | 361 |
| 354 // The caller is responsible for calling Shutdown() on the returned pointer | 362 // The caller is responsible for calling Shutdown() on the returned pointer |
| 355 // to clean up the corresponding resources allocated during this call. | 363 // to clean up the corresponding resources allocated during this call. |
| 356 virtual PlatformAudioOutput* CreateAudioOutput( | 364 virtual PlatformAudioOutput* CreateAudioOutput( |
| 357 uint32_t sample_rate, | 365 uint32_t sample_rate, |
| 358 uint32_t sample_count, | 366 uint32_t sample_count, |
| 359 PlatformAudioCommonClient* client) = 0; | 367 PlatformAudioOutputClient* client) = 0; |
| 360 | 368 |
| 369 // If |device_id| is empty, the default audio input device will be used. |
| 361 // The caller is responsible for calling Shutdown() on the returned pointer | 370 // The caller is responsible for calling Shutdown() on the returned pointer |
| 362 // to clean up the corresponding resources allocated during this call. | 371 // to clean up the corresponding resources allocated during this call. |
| 363 virtual PlatformAudioInput* CreateAudioInput( | 372 virtual PlatformAudioInput* CreateAudioInput( |
| 373 const std::string& device_id, |
| 364 uint32_t sample_rate, | 374 uint32_t sample_rate, |
| 365 uint32_t sample_count, | 375 uint32_t sample_count, |
| 366 PlatformAudioCommonClient* client) = 0; | 376 PlatformAudioInputClient* client) = 0; |
| 367 | 377 |
| 368 // A pointer is returned immediately, but it is not ready to be used until | 378 // A pointer is returned immediately, but it is not ready to be used until |
| 369 // BrokerConnected has been called. | 379 // BrokerConnected has been called. |
| 370 // The caller is responsible for calling Release() on the returned pointer | 380 // The caller is responsible for calling Release() on the returned pointer |
| 371 // to clean up the corresponding resources allocated during this call. | 381 // to clean up the corresponding resources allocated during this call. |
| 372 virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0; | 382 virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0; |
| 373 | 383 |
| 374 // Notifies that the number of find results has changed. | 384 // Notifies that the number of find results has changed. |
| 375 virtual void NumberOfFindResultsChanged(int identifier, | 385 virtual void NumberOfFindResultsChanged(int identifier, |
| 376 int total, | 386 int total, |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 const EnumerateDevicesCallback& callback) = 0; | 622 const EnumerateDevicesCallback& callback) = 0; |
| 613 // Create a ClipboardClient for writing to the clipboard. The caller will own | 623 // Create a ClipboardClient for writing to the clipboard. The caller will own |
| 614 // the pointer to this. | 624 // the pointer to this. |
| 615 virtual webkit_glue::ClipboardClient* CreateClipboardClient() const = 0; | 625 virtual webkit_glue::ClipboardClient* CreateClipboardClient() const = 0; |
| 616 }; | 626 }; |
| 617 | 627 |
| 618 } // namespace ppapi | 628 } // namespace ppapi |
| 619 } // namespace webkit | 629 } // namespace webkit |
| 620 | 630 |
| 621 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 631 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
| OLD | NEW |