Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host.h

Issue 7948004: Removing singelton property of MediaStreamManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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" 12 #include "content/browser/browser_message_filter.h"
13 #include "content/browser/renderer_host/media/media_stream_manager.h" 13 #include "content/browser/renderer_host/media/media_stream_manager.h"
14 #include "content/browser/renderer_host/media/media_stream_requester.h" 14 #include "content/browser/renderer_host/media/media_stream_requester.h"
15 #include "content/common/media/media_stream_options.h" 15 #include "content/common/media/media_stream_options.h"
16 16
17 namespace content {
18 class ResourceContext;
19 } // namespace content
20
17 namespace media_stream { 21 namespace media_stream {
18 22
19 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by 23 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by
20 // MediaStreamImpl. It's the complement of MediaStreamDispatcher 24 // MediaStreamImpl. It's the complement of MediaStreamDispatcher
21 // (owned by RenderView). 25 // (owned by RenderView).
22 class MediaStreamDispatcherHost 26 class MediaStreamDispatcherHost
23 : public BrowserMessageFilter, 27 : public BrowserMessageFilter,
24 public MediaStreamRequester { 28 public MediaStreamRequester {
25 public: 29 public:
26 explicit MediaStreamDispatcherHost(int render_process_id); 30 MediaStreamDispatcherHost(const content::ResourceContext* resource_context,
31 int render_process_id);
27 virtual ~MediaStreamDispatcherHost(); 32 virtual ~MediaStreamDispatcherHost();
28 33
29 // MediaStreamRequester implementation. 34 // MediaStreamRequester implementation.
30 virtual void StreamGenerated(const std::string& label, 35 virtual void StreamGenerated(const std::string& label,
31 const StreamDeviceInfoArray& audio_devices, 36 const StreamDeviceInfoArray& audio_devices,
32 const StreamDeviceInfoArray& video_devices); 37 const StreamDeviceInfoArray& video_devices);
33 38
34 virtual void StreamGenerationFailed(const std::string& label); 39 virtual void StreamGenerationFailed(const std::string& label);
35 virtual void AudioDeviceFailed(const std::string& label, int index); 40 virtual void AudioDeviceFailed(const std::string& label, int index);
36 virtual void VideoDeviceFailed(const std::string& label, int index); 41 virtual void VideoDeviceFailed(const std::string& label, int index);
(...skipping 10 matching lines...) Expand all
47 int page_request_id, 52 int page_request_id,
48 const StreamOptions& components, 53 const StreamOptions& components,
49 const std::string& security_origin); 54 const std::string& security_origin);
50 55
51 void OnStopGeneratedStream(int render_view_id, const std::string& label); 56 void OnStopGeneratedStream(int render_view_id, const std::string& label);
52 57
53 // Returns the media stream manager to forward events to, 58 // Returns the media stream manager to forward events to,
54 // creating one if needed. 59 // creating one if needed.
55 MediaStreamManager* manager(); 60 MediaStreamManager* manager();
56 61
62 const content::ResourceContext* resource_context_;
57 int render_process_id_; 63 int render_process_id_;
64
58 struct StreamRequest { 65 struct StreamRequest {
59 StreamRequest() {} 66 StreamRequest() {}
60 StreamRequest(int render_view_id, int page_request_id) 67 StreamRequest(int render_view_id, int page_request_id)
61 : render_view_id(render_view_id), 68 : render_view_id(render_view_id),
62 page_request_id(page_request_id ) { 69 page_request_id(page_request_id ) {
63 } 70 }
64 int render_view_id; 71 int render_view_id;
65 // Id of the request generated by MediaStreamDispatcher. 72 // Id of the request generated by MediaStreamDispatcher.
66 int page_request_id; 73 int page_request_id;
67 }; 74 };
68 typedef std::map<std::string, StreamRequest> StreamMap; 75 typedef std::map<std::string, StreamRequest> StreamMap;
69 // Streams generated for this host. 76 // Streams generated for this host.
70 StreamMap streams_; 77 StreamMap streams_;
71 78
72 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); 79 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost);
73 }; 80 };
74 81
75 } // namespace media_stream 82 } // namespace media_stream
76 83
77 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ 84 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698