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

Unified Diff: content/browser/renderer_host/media/web_contents_video_capture_device.cc

Issue 12026029: Allow TabCapture to capture full screen flash widgets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/web_contents_video_capture_device.cc
diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device.cc b/content/browser/renderer_host/media/web_contents_video_capture_device.cc
index 5920ec83a7dd3a24deebc0dc9a7d688a6253151b..0240f8b4498a54e2028611ad07cf54b06fef2e83 100644
--- a/content/browser/renderer_host/media/web_contents_video_capture_device.cc
+++ b/content/browser/renderer_host/media/web_contents_video_capture_device.cc
@@ -56,6 +56,7 @@
#include "base/threading/thread.h"
#include "base/time.h"
#include "content/browser/renderer_host/media/web_contents_capture_util.h"
+#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -162,6 +163,17 @@ class BackingStoreCopier : public WebContentsObserver {
void StartCopy(int frame_number, int desired_width, int desired_height,
const DoneCB& done_cb);
+ virtual void DidShowFullscreenWidget(int routing_id) OVERRIDE {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ fullscreen_widget_id_ = routing_id;
+ }
+
+ virtual void DidDestroyFullscreenWidget(int routing_id) OVERRIDE {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_EQ(fullscreen_widget_id_, routing_id);
+ fullscreen_widget_id_ = MSG_ROUTING_NONE;
+ }
+
private:
void LookUpAndObserveWebContents();
@@ -173,6 +185,10 @@ class BackingStoreCopier : public WebContentsObserver {
const int render_process_id_;
const int render_view_id_;
+ // Routing ID of any active fullscreen render widget or MSG_ROUTING_NONE
+ // otherwise.
+ int fullscreen_widget_id_;
+
// Last known RenderView size.
gfx::Size last_view_size_;
@@ -272,7 +288,7 @@ class VideoFrameDeliverer {
BackingStoreCopier::BackingStoreCopier(int render_process_id,
int render_view_id)
: render_process_id_(render_process_id), render_view_id_(render_view_id),
- rwh_for_testing_(NULL) {}
+ fullscreen_widget_id_(MSG_ROUTING_NONE), rwh_for_testing_(NULL) {}
void BackingStoreCopier::LookUpAndObserveWebContents() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -295,6 +311,11 @@ void BackingStoreCopier::LookUpAndObserveWebContents() {
Observe(rvh ? WebContents::FromRenderViewHost(rvh) : NULL);
DVLOG_IF(1, !web_contents())
<< "WebContents::FromRenderViewHost(" << rvh << ") returned NULL.";
+
+ if (fullscreen_widget_id_ == MSG_ROUTING_NONE && web_contents()) {
+ fullscreen_widget_id_ = static_cast<WebContentsImpl*>(web_contents())->
+ GetFullscreenWidgetRoutingID();
+ }
}
void BackingStoreCopier::SetRenderWidgetHostForTesting(
@@ -322,7 +343,15 @@ void BackingStoreCopier::StartCopy(int frame_number,
return;
}
}
- rwh = web_contents()->GetRenderViewHost();
+
+ if (fullscreen_widget_id_ != MSG_ROUTING_NONE) {
+ RenderProcessHost* process = web_contents()->GetRenderProcessHost();
+ rwh = process ? process->GetRenderWidgetHostByID(fullscreen_widget_id_)
+ : NULL;
+ } else {
+ rwh = web_contents()->GetRenderViewHost();
+ }
+
if (!rwh) {
// Transient failure state (e.g., a RenderView is being replaced).
done_cb.Run(TRANSIENT_ERROR,
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698