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

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

Issue 100743003: Extend content::DesktopMediaID to allow Aura windows as capture sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
Index: content/browser/renderer_host/media/desktop_capture_device_ash.cc
diff --git a/content/browser/renderer_host/media/desktop_capture_device_ash.cc b/content/browser/renderer_host/media/desktop_capture_device_ash.cc
index 496ff0308d65176b67981b3e11a099f9d071c5c1..8fd7cfa9ad4fad39ea248e24043ec3fa1580792d 100644
--- a/content/browser/renderer_host/media/desktop_capture_device_ash.cc
+++ b/content/browser/renderer_host/media/desktop_capture_device_ash.cc
@@ -82,8 +82,8 @@ class DesktopVideoCaptureMachine
// The timer that kicks off period captures.
base::Timer timer_;
- // The desktop id.
- DesktopMediaID desktop_id_;
+ // The id of the window being captured.
+ const DesktopMediaID& window_id_;
// Makes all the decisions about which frames to copy, and how.
scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_;
@@ -99,7 +99,7 @@ DesktopVideoCaptureMachine::DesktopVideoCaptureMachine(
: desktop_window_(NULL),
desktop_layer_(NULL),
timer_(true, true),
- desktop_id_(source) {}
+ window_id_(source) {}
DesktopVideoCaptureMachine::~DesktopVideoCaptureMachine() {}
@@ -107,11 +107,7 @@ bool DesktopVideoCaptureMachine::Start(
const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // TODO(hshi): get the correct display specified by |desktop_id_|.
- const gfx::Display& primary_display =
- gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
- desktop_window_ = gfx::Screen::GetNativeScreen()->GetWindowAtScreenPoint(
- primary_display.bounds().CenterPoint())->GetRootWindow();
+ desktop_window_ = content::DesktopMediaID::GetAuraWindowById(window_id_);
if (!desktop_window_)
return false;
@@ -193,9 +189,11 @@ void DesktopVideoCaptureMachine::Capture(bool dirty) {
cc::CopyOutputRequest::CreateRequest(
base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput,
AsWeakPtr(), frame, start_time, capture_frame_cb));
- gfx::Rect desktop_size = ui::ConvertRectToPixel(
- desktop_layer_, desktop_layer_->bounds());
- request->set_area(desktop_size);
+ gfx::Rect window_rect =
+ ui::ConvertRectToPixel(desktop_window_->layer(),
+ gfx::Rect(desktop_window_->bounds().width(),
+ desktop_window_->bounds().height()));
+ request->set_area(window_rect);
desktop_layer_->RequestCopyOfOutput(request.Pass());
}
}
@@ -306,10 +304,6 @@ DesktopCaptureDeviceAsh::~DesktopCaptureDeviceAsh() {
// static
media::VideoCaptureDevice* DesktopCaptureDeviceAsh::Create(
const DesktopMediaID& source) {
- // This implementation only supports screen capture.
- if (source.type != DesktopMediaID::TYPE_SCREEN)
- return NULL;
-
return new DesktopCaptureDeviceAsh(source);
}

Powered by Google App Engine
This is Rietveld 408576698