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

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

Issue 364123002: [Cross-Site Isolation] Migrate entire MediaStream verticals to be per-RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It's random enough. + REBASE Created 6 years, 5 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) 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 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/renderer_host/media/media_stream_manager.h" 12 #include "content/browser/renderer_host/media/media_stream_manager.h"
13 #include "content/browser/renderer_host/media/media_stream_requester.h" 13 #include "content/browser/renderer_host/media/media_stream_requester.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #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" 16 #include "content/public/browser/browser_message_filter.h"
17 #include "content/public/browser/resource_context.h" 17 #include "content/public/browser/resource_context.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 class MediaStreamManager; 21 class MediaStreamManager;
22 class ResourceContext; 22 class ResourceContext;
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. There is one MediaStreamDispatcherHost per
26 // (owned by RenderView). 26 // RenderProcessHost, the former owned by the latter.
27 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, 27 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter,
28 public MediaStreamRequester { 28 public MediaStreamRequester {
29 public: 29 public:
30 MediaStreamDispatcherHost( 30 MediaStreamDispatcherHost(
31 int render_process_id, 31 int render_process_id,
32 const ResourceContext::SaltCallback& salt_callback, 32 const ResourceContext::SaltCallback& salt_callback,
33 MediaStreamManager* media_stream_manager, 33 MediaStreamManager* media_stream_manager,
34 ResourceContext* resource_context); 34 ResourceContext* resource_context);
35 35
36 // MediaStreamRequester implementation. 36 // MediaStreamRequester implementation.
37 virtual void StreamGenerated( 37 virtual void StreamGenerated(
38 int render_view_id, 38 int render_frame_id,
39 int page_request_id, 39 int page_request_id,
40 const std::string& label, 40 const std::string& label,
41 const StreamDeviceInfoArray& audio_devices, 41 const StreamDeviceInfoArray& audio_devices,
42 const StreamDeviceInfoArray& video_devices) OVERRIDE; 42 const StreamDeviceInfoArray& video_devices) OVERRIDE;
43 virtual void StreamGenerationFailed( 43 virtual void StreamGenerationFailed(
44 int render_view_id, 44 int render_frame_id,
45 int page_request_id, 45 int page_request_id,
46 content::MediaStreamRequestResult result) OVERRIDE; 46 content::MediaStreamRequestResult result) OVERRIDE;
47 virtual void DeviceStopped(int render_view_id, 47 virtual void DeviceStopped(int render_frame_id,
48 const std::string& label, 48 const std::string& label,
49 const StreamDeviceInfo& device) OVERRIDE; 49 const StreamDeviceInfo& device) OVERRIDE;
50 virtual void DevicesEnumerated(int render_view_id, 50 virtual void DevicesEnumerated(int render_frame_id,
51 int page_request_id, 51 int page_request_id,
52 const std::string& label, 52 const std::string& label,
53 const StreamDeviceInfoArray& devices) OVERRIDE; 53 const StreamDeviceInfoArray& devices) OVERRIDE;
54 virtual void DeviceOpened(int render_view_id, 54 virtual void DeviceOpened(int render_frame_id,
55 int page_request_id, 55 int page_request_id,
56 const std::string& label, 56 const std::string& label,
57 const StreamDeviceInfo& video_device) OVERRIDE; 57 const StreamDeviceInfo& video_device) OVERRIDE;
58 58
59 // BrowserMessageFilter implementation. 59 // BrowserMessageFilter implementation.
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 virtual void OnChannelClosing() OVERRIDE; 61 virtual void OnChannelClosing() OVERRIDE;
62 62
63 protected: 63 protected:
64 virtual ~MediaStreamDispatcherHost(); 64 virtual ~MediaStreamDispatcherHost();
65 65
66 private: 66 private:
67 friend class MockMediaStreamDispatcherHost; 67 friend class MockMediaStreamDispatcherHost;
68 68
69 void OnGenerateStream(int render_view_id, 69 void OnGenerateStream(int render_frame_id,
70 int page_request_id, 70 int page_request_id,
71 const StreamOptions& components, 71 const StreamOptions& components,
72 const GURL& security_origin, 72 const GURL& security_origin,
73 bool user_gesture); 73 bool user_gesture);
74 void OnCancelGenerateStream(int render_view_id, 74 void OnCancelGenerateStream(int render_frame_id,
75 int page_request_id); 75 int page_request_id);
76 void OnStopStreamDevice(int render_view_id, 76 void OnStopStreamDevice(int render_frame_id,
77 const std::string& device_id); 77 const std::string& device_id);
78 78
79 void OnEnumerateDevices(int render_view_id, 79 void OnEnumerateDevices(int render_frame_id,
80 int page_request_id, 80 int page_request_id,
81 MediaStreamType type, 81 MediaStreamType type,
82 const GURL& security_origin, 82 const GURL& security_origin,
83 bool hide_labels_if_no_access); 83 bool hide_labels_if_no_access);
84 84
85 void OnCancelEnumerateDevices(int render_view_id, 85 void OnCancelEnumerateDevices(int render_frame_id,
86 int page_request_id); 86 int page_request_id);
87 87
88 void OnOpenDevice(int render_view_id, 88 void OnOpenDevice(int render_frame_id,
89 int page_request_id, 89 int page_request_id,
90 const std::string& device_id, 90 const std::string& device_id,
91 MediaStreamType type, 91 MediaStreamType type,
92 const GURL& security_origin); 92 const GURL& security_origin);
93 93
94 void OnCloseDevice(int render_view_id, 94 void OnCloseDevice(int render_frame_id,
95 const std::string& label); 95 const std::string& label);
96 96
97 void StoreRequest(int render_view_id, 97 void StoreRequest(int render_frame_id,
98 int page_request_id, 98 int page_request_id,
99 const std::string& label); 99 const std::string& label);
100 100
101 bool IsURLAllowed(const GURL& url); 101 bool IsURLAllowed(const GURL& url);
102 102
103 int render_process_id_; 103 int render_process_id_;
104 ResourceContext::SaltCallback salt_callback_; 104 ResourceContext::SaltCallback salt_callback_;
105 MediaStreamManager* media_stream_manager_; 105 MediaStreamManager* media_stream_manager_;
106 106
107 // Owned by ProfileIOData which is guaranteed to outlive MSDH. 107 // Owned by ProfileIOData which is guaranteed to outlive MSDH.
108 ResourceContext* const resource_context_; 108 ResourceContext* const resource_context_;
109 109
110 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); 110 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost);
111 }; 111 };
112 112
113 } // namespace content 113 } // namespace content
114 114
115 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ 115 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698