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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.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 // MediaStreamManager is used to open/enumerate media capture devices (video 5 // MediaStreamManager is used to open/enumerate media capture devices (video
6 // supported now). Call flow: 6 // supported now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual ~MediaStreamManager(); 74 virtual ~MediaStreamManager();
75 75
76 // Used to access VideoCaptureManager. 76 // Used to access VideoCaptureManager.
77 VideoCaptureManager* video_capture_manager(); 77 VideoCaptureManager* video_capture_manager();
78 78
79 // Used to access AudioInputDeviceManager. 79 // Used to access AudioInputDeviceManager.
80 AudioInputDeviceManager* audio_input_device_manager(); 80 AudioInputDeviceManager* audio_input_device_manager();
81 81
82 // Creates a new media access request which is identified by a unique string 82 // Creates a new media access request which is identified by a unique string
83 // that's returned to the caller. This will trigger the infobar and ask users 83 // that's returned to the caller. This will trigger the infobar and ask users
84 // for access to the device. |render_process_id| and |render_view_id| refer 84 // for access to the device. |render_process_id| and |render_frame_id| are
85 // to the view where the infobar will appear to the user. |callback| is 85 // used to determine where the infobar will appear to the user. |callback| is
86 // used to send the selected device to the clients. An empty list of device 86 // used to send the selected device to the clients. An empty list of device
87 // will be returned if the users deny the access. 87 // will be returned if the users deny the access.
88 std::string MakeMediaAccessRequest( 88 std::string MakeMediaAccessRequest(
89 int render_process_id, 89 int render_process_id,
90 int render_view_id, 90 int render_frame_id,
91 int page_request_id, 91 int page_request_id,
92 const StreamOptions& options, 92 const StreamOptions& options,
93 const GURL& security_origin, 93 const GURL& security_origin,
94 const MediaRequestResponseCallback& callback); 94 const MediaRequestResponseCallback& callback);
95 95
96 // GenerateStream opens new media devices according to |components|. It 96 // GenerateStream opens new media devices according to |components|. It
97 // creates a new request which is identified by a unique string that's 97 // creates a new request which is identified by a unique string that's
98 // returned to the caller. |render_process_id| and |render_view_id| refer to 98 // returned to the caller. |render_process_id| and |render_frame_id| are used
99 // the view where the infobar will appear to the user. 99 // to determine where the infobar will appear to the user.
100 void GenerateStream(MediaStreamRequester* requester, 100 void GenerateStream(MediaStreamRequester* requester,
101 int render_process_id, 101 int render_process_id,
102 int render_view_id, 102 int render_frame_id,
103 const ResourceContext::SaltCallback& sc, 103 const ResourceContext::SaltCallback& sc,
104 int page_request_id, 104 int page_request_id,
105 const StreamOptions& components, 105 const StreamOptions& components,
106 const GURL& security_origin, 106 const GURL& security_origin,
107 bool user_gesture); 107 bool user_gesture);
108 108
109 void CancelRequest(int render_process_id, 109 void CancelRequest(int render_process_id,
110 int render_view_id, 110 int render_frame_id,
111 int page_request_id); 111 int page_request_id);
112 112
113 // Cancel an open request identified by |label|. 113 // Cancel an open request identified by |label|.
114 virtual void CancelRequest(const std::string& label); 114 virtual void CancelRequest(const std::string& label);
115 115
116 // Cancel all requests for the given |render_process_id|. 116 // Cancel all requests for the given |render_process_id|.
117 void CancelAllRequests(int render_process_id); 117 void CancelAllRequests(int render_process_id);
118 118
119 // Closes the stream device for a certain render view. The stream must have 119 // Closes the stream device for a certain render frame. The stream must have
120 // been opened by a call to GenerateStream. 120 // been opened by a call to GenerateStream.
121 void StopStreamDevice(int render_process_id, 121 void StopStreamDevice(int render_process_id,
122 int render_view_id, 122 int render_frame_id,
123 const std::string& device_id); 123 const std::string& device_id);
124 124
125 // Gets a list of devices of |type|, which must be MEDIA_DEVICE_AUDIO_CAPTURE 125 // Gets a list of devices of |type|, which must be MEDIA_DEVICE_AUDIO_CAPTURE
126 // or MEDIA_DEVICE_VIDEO_CAPTURE. 126 // or MEDIA_DEVICE_VIDEO_CAPTURE.
127 // The request is identified using the string returned to the caller. 127 // The request is identified using the string returned to the caller.
128 // When the |requester| is NULL, MediaStreamManager will enumerate both audio 128 // When the |requester| is NULL, MediaStreamManager will enumerate both audio
129 // and video devices and also start monitoring device changes, such as 129 // and video devices and also start monitoring device changes, such as
130 // plug/unplug. The new device lists will be delivered via media observer to 130 // plug/unplug. The new device lists will be delivered via media observer to
131 // MediaCaptureDevicesDispatcher. 131 // MediaCaptureDevicesDispatcher.
132 // If |have_permission| is false, we remove the device label from the result. 132 // If |have_permission| is false, we remove the device label from the result.
133 virtual std::string EnumerateDevices(MediaStreamRequester* requester, 133 virtual std::string EnumerateDevices(MediaStreamRequester* requester,
134 int render_process_id, 134 int render_process_id,
135 int render_view_id, 135 int render_frame_id,
136 const ResourceContext::SaltCallback& sc, 136 const ResourceContext::SaltCallback& sc,
137 int page_request_id, 137 int page_request_id,
138 MediaStreamType type, 138 MediaStreamType type,
139 const GURL& security_origin, 139 const GURL& security_origin,
140 bool have_permission); 140 bool have_permission);
141 141
142 // Open a device identified by |device_id|. |type| must be either 142 // Open a device identified by |device_id|. |type| must be either
143 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE. 143 // MEDIA_DEVICE_AUDIO_CAPTURE or MEDIA_DEVICE_VIDEO_CAPTURE.
144 // The request is identified using string returned to the caller. 144 // The request is identified using string returned to the caller.
145 void OpenDevice(MediaStreamRequester* requester, 145 void OpenDevice(MediaStreamRequester* requester,
146 int render_process_id, 146 int render_process_id,
147 int render_view_id, 147 int render_frame_id,
148 const ResourceContext::SaltCallback& sc, 148 const ResourceContext::SaltCallback& sc,
149 int page_request_id, 149 int page_request_id,
150 const std::string& device_id, 150 const std::string& device_id,
151 MediaStreamType type, 151 MediaStreamType type,
152 const GURL& security_origin); 152 const GURL& security_origin);
153 153
154 // Finds and returns the device id corresponding to the given 154 // Finds and returns the device id corresponding to the given
155 // |source_id|. Returns true if there was a raw device id that matched the 155 // |source_id|. Returns true if there was a raw device id that matched the
156 // given |source_id|, false if nothing matched it. 156 // given |source_id|, false if nothing matched it.
157 bool TranslateSourceIdToDeviceId( 157 bool TranslateSourceIdToDeviceId(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // StreamOptions::Constraints for requested tab capture IDs. 294 // StreamOptions::Constraints for requested tab capture IDs.
295 bool SetupTabCaptureRequest(DeviceRequest* request); 295 bool SetupTabCaptureRequest(DeviceRequest* request);
296 // Prepare |request| of type MEDIA_LOOPBACK_AUDIO_CAPTURE and/or 296 // Prepare |request| of type MEDIA_LOOPBACK_AUDIO_CAPTURE and/or
297 // MEDIA_DESKTOP_VIDEO_CAPTURE for being posted to the UI by parsing 297 // MEDIA_DESKTOP_VIDEO_CAPTURE for being posted to the UI by parsing
298 // StreamOptions::Constraints for the requested desktop ID. 298 // StreamOptions::Constraints for the requested desktop ID.
299 bool SetupScreenCaptureRequest(DeviceRequest* request); 299 bool SetupScreenCaptureRequest(DeviceRequest* request);
300 // Called when a request has been setup and devices have been enumerated if 300 // Called when a request has been setup and devices have been enumerated if
301 // needed. 301 // needed.
302 void PostRequestToUI(const std::string& label, DeviceRequest* request); 302 void PostRequestToUI(const std::string& label, DeviceRequest* request);
303 // Returns true if a device with |device_id| has already been requested with 303 // Returns true if a device with |device_id| has already been requested with
304 // a render procecss_id and render_view_id and type equal to the the values 304 // a render procecss_id and render_frame_id and type equal to the the values
305 // in |request|. If it has been requested, |device_info| contain information 305 // in |request|. If it has been requested, |device_info| contain information
306 // about the device. 306 // about the device.
307 bool FindExistingRequestedDeviceInfo( 307 bool FindExistingRequestedDeviceInfo(
308 const DeviceRequest& new_request, 308 const DeviceRequest& new_request,
309 const MediaStreamDevice& new_device_info, 309 const MediaStreamDevice& new_device_info,
310 StreamDeviceInfo* existing_device_info, 310 StreamDeviceInfo* existing_device_info,
311 MediaRequestState* existing_request_state) const; 311 MediaRequestState* existing_request_state) const;
312 312
313 void FinalizeGenerateStream(const std::string& label, 313 void FinalizeGenerateStream(const std::string& label,
314 DeviceRequest* request); 314 DeviceRequest* request);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 bool use_fake_ui_; 394 bool use_fake_ui_;
395 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; 395 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_;
396 396
397 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 397 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
398 }; 398 };
399 399
400 } // namespace content 400 } // namespace content
401 401
402 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 402 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698