| 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> |
| 11 | 11 |
| 12 #include "content/browser/browser_message_filter.h" | |
| 13 #include "content/browser/renderer_host/media/media_stream_manager.h" | 12 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 14 #include "content/browser/renderer_host/media/media_stream_requester.h" | 13 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 15 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 16 #include "content/common/media/media_stream_options.h" | 15 #include "content/common/media/media_stream_options.h" |
| 16 #include "content/public/browser/browser_message_filter.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class ResourceContext; | 19 class ResourceContext; |
| 20 } // namespace content | 20 } // namespace content |
| 21 | 21 |
| 22 namespace media_stream { | 22 namespace media_stream { |
| 23 | 23 |
| 24 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by | 24 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by |
| 25 // MediaStreamImpl. It's the complement of MediaStreamDispatcher | 25 // MediaStreamImpl. It's the complement of MediaStreamDispatcher |
| 26 // (owned by RenderView). | 26 // (owned by RenderView). |
| 27 class CONTENT_EXPORT MediaStreamDispatcherHost | 27 class CONTENT_EXPORT MediaStreamDispatcherHost |
| 28 : public BrowserMessageFilter, | 28 : public content::BrowserMessageFilter, |
| 29 public MediaStreamRequester { | 29 public MediaStreamRequester { |
| 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 | 40 |
| 41 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; | 41 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; |
| 42 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE; | 42 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE; |
| 43 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE; | 43 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE; |
| 44 | 44 |
| 45 // BrowserMessageFilter implementation. | 45 // content::BrowserMessageFilter implementation. |
| 46 virtual bool OnMessageReceived(const IPC::Message& message, | 46 virtual bool OnMessageReceived(const IPC::Message& message, |
| 47 bool* message_was_ok) OVERRIDE; | 47 bool* message_was_ok) OVERRIDE; |
| 48 virtual void OnChannelClosing() OVERRIDE; | 48 virtual void OnChannelClosing() OVERRIDE; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 friend class MockMediaStreamDispatcherHost; | 51 friend class MockMediaStreamDispatcherHost; |
| 52 | 52 |
| 53 void OnGenerateStream(int render_view_id, | 53 void OnGenerateStream(int render_view_id, |
| 54 int page_request_id, | 54 int page_request_id, |
| 55 const StreamOptions& components, | 55 const StreamOptions& components, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 typedef std::map<std::string, StreamRequest> StreamMap; | 68 typedef std::map<std::string, StreamRequest> StreamMap; |
| 69 // Streams generated for this host. | 69 // Streams generated for this host. |
| 70 StreamMap streams_; | 70 StreamMap streams_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); | 72 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace media_stream | 75 } // namespace media_stream |
| 76 | 76 |
| 77 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
| OLD | NEW |