OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 5 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
12 #include "content/browser/frame_host/render_frame_host_delegate.h" | 12 #include "content/browser/frame_host/render_frame_host_delegate.h" |
13 #include "content/browser/frame_host/render_frame_host_impl.h" | 13 #include "content/browser/frame_host/render_frame_host_impl.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
16 #include "media/capture/video/fake_video_capture_device.h" | 16 #include "media/capture/video/fake_video_capture_device.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 #include "url/origin.h" | 18 #include "url/origin.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 namespace { | |
23 | |
24 GURL ConvertToGURL(const url::Origin& origin) { | |
25 return origin.unique() ? GURL() : GURL(origin.Serialize()); | |
26 } | |
27 | |
28 } // namespace | |
29 | |
30 void SetAndCheckAncestorFlag(MediaStreamRequest* request) { | 22 void SetAndCheckAncestorFlag(MediaStreamRequest* request) { |
31 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 23 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
32 RenderFrameHostImpl* rfh = | 24 RenderFrameHostImpl* rfh = |
33 RenderFrameHostImpl::FromID(request->render_process_id, | 25 RenderFrameHostImpl::FromID(request->render_process_id, |
34 request->render_frame_id); | 26 request->render_frame_id); |
35 | 27 |
36 if (rfh == NULL) { | 28 if (rfh == NULL) { |
37 // RenderFrame destroyed before the request is handled? | 29 // RenderFrame destroyed before the request is handled? |
38 return; | 30 return; |
39 } | 31 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const url::Origin& security_origin, | 198 const url::Origin& security_origin, |
207 MediaStreamType type, | 199 MediaStreamType type, |
208 int render_process_id, | 200 int render_process_id, |
209 int render_frame_id, | 201 int render_frame_id, |
210 const base::Callback<void(bool)>& callback) { | 202 const base::Callback<void(bool)>& callback) { |
211 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 203 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
212 | 204 |
213 BrowserThread::PostTaskAndReplyWithResult( | 205 BrowserThread::PostTaskAndReplyWithResult( |
214 BrowserThread::UI, FROM_HERE, | 206 BrowserThread::UI, FROM_HERE, |
215 base::Bind(&Core::CheckAccess, base::Unretained(core_.get()), | 207 base::Bind(&Core::CheckAccess, base::Unretained(core_.get()), |
216 ConvertToGURL(security_origin), type, render_process_id, | 208 security_origin.GetURL(), type, render_process_id, |
217 render_frame_id), | 209 render_frame_id), |
218 base::Bind(&MediaStreamUIProxy::OnCheckedAccess, | 210 base::Bind(&MediaStreamUIProxy::OnCheckedAccess, |
219 weak_factory_.GetWeakPtr(), callback)); | 211 weak_factory_.GetWeakPtr(), callback)); |
220 } | 212 } |
221 | 213 |
222 void MediaStreamUIProxy::OnStarted(const base::Closure& stop_callback, | 214 void MediaStreamUIProxy::OnStarted(const base::Closure& stop_callback, |
223 const WindowIdCallback& window_id_callback) { | 215 const WindowIdCallback& window_id_callback) { |
224 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 216 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
225 | 217 |
226 stop_callback_ = stop_callback; | 218 stop_callback_ = stop_callback; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 callback, | 371 callback, |
380 have_access)); | 372 have_access)); |
381 return; | 373 return; |
382 } | 374 } |
383 | 375 |
384 void FakeMediaStreamUIProxy::OnStarted( | 376 void FakeMediaStreamUIProxy::OnStarted( |
385 const base::Closure& stop_callback, | 377 const base::Closure& stop_callback, |
386 const WindowIdCallback& window_id_callback) {} | 378 const WindowIdCallback& window_id_callback) {} |
387 | 379 |
388 } // namespace content | 380 } // namespace content |
OLD | NEW |