Chromium Code Reviews| Index: chrome/browser/extensions/api/tab_capture/tab_capture_api.cc |
| diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc |
| index c88fbc9dc980c85266ce6da8b2dd69f04a1e8869..0a34b9a5dd82f6edf3c9808dc95be7411745220a 100644 |
| --- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc |
| +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc |
| @@ -20,8 +20,8 @@ |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| +#include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/render_process_host.h" |
| -#include "content/public/browser/render_view_host.h" |
| #include "extensions/common/features/feature.h" |
| #include "extensions/common/features/feature_provider.h" |
| #include "extensions/common/features/simple_feature.h" |
| @@ -102,10 +102,6 @@ bool TabCaptureCaptureFunction::RunSync() { |
| return false; |
| } |
| - content::RenderViewHost* const rvh = target_contents->GetRenderViewHost(); |
| - int render_process_id = rvh->GetProcess()->GetID(); |
| - int routing_id = rvh->GetRoutingID(); |
| - |
| // Create a constraints vector. We will modify all the constraints in this |
| // vector to append our chrome specific constraints. |
| std::vector<MediaStreamConstraint*> constraints; |
| @@ -131,8 +127,13 @@ bool TabCaptureCaptureFunction::RunSync() { |
| } |
| // Device id we use for Tab Capture. |
| - std::string device_id = |
| - base::StringPrintf("%i:%i", render_process_id, routing_id); |
| + content::RenderFrameHost* const main_frame = target_contents->GetMainFrame(); |
| + // TODO(miu): We should instead use a "randomly generated device ID" scheme, |
| + // like that employed by the desktop capture API. http://crbug.com/163100 |
| + const std::string device_id = base::StringPrintf( |
| + "web-contents-media-stream://%i:%i", |
|
ncarter (slow)
2014/07/10 01:17:51
Does introducing the scheme here fix a bug? How is
miu
2014/07/10 22:16:11
It addresses crbug.com/163100. There isn't really
ncarter (slow)
2014/07/11 22:32:24
Acknowledged.
|
| + main_frame->GetProcess()->GetID(), |
| + main_frame->GetRoutingID()); |
| // Append chrome specific tab constraints. |
| for (std::vector<MediaStreamConstraint*>::iterator it = constraints.begin(); |
| @@ -144,8 +145,7 @@ bool TabCaptureCaptureFunction::RunSync() { |
| extensions::TabCaptureRegistry* registry = |
| extensions::TabCaptureRegistry::Get(GetProfile()); |
| - if (!registry->AddRequest(render_process_id, |
| - routing_id, |
| + if (!registry->AddRequest(target_contents, |
| extension_id, |
| tab_id, |
| tab_capture::TAB_CAPTURE_STATE_NONE)) { |