| 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 MediaStreamDispatcherHost(const content::ResourceContext* resource_context, | 31 MediaStreamDispatcherHost(const content::ResourceContext* resource_context, |
| 32 int render_process_id); | 32 int render_process_id); |
| 33 virtual ~MediaStreamDispatcherHost(); | 33 virtual ~MediaStreamDispatcherHost(); |
| 34 | 34 |
| 35 // MediaStreamRequester implementation. | 35 // MediaStreamRequester implementation. |
| 36 virtual void StreamGenerated( | 36 virtual void StreamGenerated( |
| 37 const std::string& label, | 37 const std::string& label, |
| 38 const StreamDeviceInfoArray& audio_devices, | 38 const StreamDeviceInfoArray& audio_devices, |
| 39 const StreamDeviceInfoArray& video_devices) OVERRIDE; | 39 const StreamDeviceInfoArray& video_devices) OVERRIDE; |
| 40 | |
| 41 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; | 40 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; |
| 42 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE; | 41 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE; |
| 43 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE; | 42 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE; |
| 43 virtual void DevicesEnumerated(const std::string& label, |
| 44 const StreamDeviceInfoArray& devices) OVERRIDE; |
| 45 virtual void DevicesEnumerationFailed(const std::string& label) OVERRIDE; |
| 46 virtual void DeviceOpened(const std::string& label, |
| 47 const StreamDeviceInfo& video_device) OVERRIDE; |
| 48 virtual void DeviceOpenFailed(const std::string& label) OVERRIDE; |
| 44 | 49 |
| 45 // content::BrowserMessageFilter implementation. | 50 // content::BrowserMessageFilter implementation. |
| 46 virtual bool OnMessageReceived(const IPC::Message& message, | 51 virtual bool OnMessageReceived(const IPC::Message& message, |
| 47 bool* message_was_ok) OVERRIDE; | 52 bool* message_was_ok) OVERRIDE; |
| 48 virtual void OnChannelClosing() OVERRIDE; | 53 virtual void OnChannelClosing() OVERRIDE; |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 friend class MockMediaStreamDispatcherHost; | 56 friend class MockMediaStreamDispatcherHost; |
| 52 | 57 |
| 53 void OnGenerateStream(int render_view_id, | 58 void OnGenerateStream(int render_view_id, |
| 54 int page_request_id, | 59 int page_request_id, |
| 55 const StreamOptions& components, | 60 const StreamOptions& components, |
| 56 const std::string& security_origin); | 61 const std::string& security_origin); |
| 57 | 62 |
| 58 void OnStopGeneratedStream(int render_view_id, const std::string& label); | 63 void OnStopGeneratedStream(int render_view_id, const std::string& label); |
| 59 | 64 |
| 65 void OnEnumerateDevices(int render_view_id, |
| 66 int page_request_id, |
| 67 media_stream::MediaStreamType type, |
| 68 const std::string& security_origin); |
| 69 |
| 70 void OnOpenDevice(int render_view_id, |
| 71 int page_request_id, |
| 72 const std::string& device_id, |
| 73 media_stream::MediaStreamType type, |
| 74 const std::string& security_origin); |
| 75 |
| 60 // Returns the media stream manager to forward events to, | 76 // Returns the media stream manager to forward events to, |
| 61 // creating one if needed. | 77 // creating one if needed. |
| 62 MediaStreamManager* manager(); | 78 MediaStreamManager* manager(); |
| 63 | 79 |
| 64 const content::ResourceContext* resource_context_; | 80 const content::ResourceContext* resource_context_; |
| 65 int render_process_id_; | 81 int render_process_id_; |
| 66 | 82 |
| 67 struct StreamRequest; | 83 struct StreamRequest; |
| 68 typedef std::map<std::string, StreamRequest> StreamMap; | 84 typedef std::map<std::string, StreamRequest> StreamMap; |
| 69 // Streams generated for this host. | 85 // Streams generated for this host. |
| 70 StreamMap streams_; | 86 StreamMap streams_; |
| 71 | 87 |
| 72 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); | 88 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); |
| 73 }; | 89 }; |
| 74 | 90 |
| 75 } // namespace media_stream | 91 } // namespace media_stream |
| 76 | 92 |
| 77 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 93 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
| OLD | NEW |