Index: content/browser/renderer_host/media/desktop_capture_device_aura.cc |
diff --git a/content/browser/renderer_host/media/desktop_capture_device_ash.cc b/content/browser/renderer_host/media/desktop_capture_device_aura.cc |
similarity index 91% |
rename from content/browser/renderer_host/media/desktop_capture_device_ash.cc |
rename to content/browser/renderer_host/media/desktop_capture_device_aura.cc |
index 496ff0308d65176b67981b3e11a099f9d071c5c1..1b07b743685d2b43ac6bcc138b900cebb9b70726 100644 |
--- a/content/browser/renderer_host/media/desktop_capture_device_ash.cc |
+++ b/content/browser/renderer_host/media/desktop_capture_device_aura.cc |
@@ -1,8 +1,8 @@ |
// Copyright 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// |
-#include "content/browser/renderer_host/media/desktop_capture_device_ash.h" |
+ |
+#include "content/browser/renderer_host/media/desktop_capture_device_aura.h" |
#include "base/logging.h" |
#include "base/timer/timer.h" |
@@ -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. |
+ 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()); |
} |
} |
@@ -294,33 +292,29 @@ void DesktopVideoCaptureMachine::OnCompositingEnded( |
} // namespace |
-DesktopCaptureDeviceAsh::DesktopCaptureDeviceAsh( |
+DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( |
const DesktopMediaID& source) |
: impl_(new VideoCaptureDeviceImpl(scoped_ptr<VideoCaptureMachine>( |
new DesktopVideoCaptureMachine(source)))) {} |
-DesktopCaptureDeviceAsh::~DesktopCaptureDeviceAsh() { |
- DVLOG(2) << "DesktopCaptureDeviceAsh@" << this << " destroying."; |
+DesktopCaptureDeviceAura::~DesktopCaptureDeviceAura() { |
+ DVLOG(2) << "DesktopCaptureDeviceAura@" << this << " destroying."; |
} |
// static |
-media::VideoCaptureDevice* DesktopCaptureDeviceAsh::Create( |
+media::VideoCaptureDevice* DesktopCaptureDeviceAura::Create( |
const DesktopMediaID& source) { |
- // This implementation only supports screen capture. |
- if (source.type != DesktopMediaID::TYPE_SCREEN) |
- return NULL; |
- |
- return new DesktopCaptureDeviceAsh(source); |
+ return new DesktopCaptureDeviceAura(source); |
} |
-void DesktopCaptureDeviceAsh::AllocateAndStart( |
+void DesktopCaptureDeviceAura::AllocateAndStart( |
const media::VideoCaptureParams& params, |
scoped_ptr<Client> client) { |
DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
impl_->AllocateAndStart(params, client.Pass()); |
} |
-void DesktopCaptureDeviceAsh::StopAndDeAllocate() { |
+void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
impl_->StopAndDeAllocate(); |
} |