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 08a74826b49b24b79544f3eecc5b3f33ddc60a88..496ff0308d65176b67981b3e11a099f9d071c5c1 100644 |
--- a/content/browser/renderer_host/media/desktop_capture_device_ash.cc |
+++ b/content/browser/renderer_host/media/desktop_capture_device_ash.cc |
@@ -41,6 +41,9 @@ class DesktopVideoCaptureMachine |
virtual void Stop() OVERRIDE; |
// Implements aura::WindowObserver. |
+ virtual void OnWindowBoundsChanged(aura::Window* window, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds) OVERRIDE; |
virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
// Implements ui::CompositorObserver. |
@@ -60,6 +63,9 @@ class DesktopVideoCaptureMachine |
// |dirty| is false for timer polls and true for compositor updates. |
void Capture(bool dirty); |
+ // Update capture size. Must be called on the UI thread. |
+ void UpdateCaptureSize(); |
+ |
// Response callback for cc::Layer::RequestCopyOfOutput(). |
void DidCopyOutput( |
scoped_refptr<media::VideoFrame> video_frame, |
@@ -117,6 +123,9 @@ bool DesktopVideoCaptureMachine::Start( |
DCHECK(oracle_proxy.get()); |
oracle_proxy_ = oracle_proxy; |
+ // Update capture size. |
+ UpdateCaptureSize(); |
+ |
// Start observing window events. |
desktop_window_->AddObserver(this); |
@@ -156,6 +165,14 @@ void DesktopVideoCaptureMachine::Stop() { |
started_ = false; |
} |
+void DesktopVideoCaptureMachine::UpdateCaptureSize() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (oracle_proxy_ && desktop_layer_) { |
+ oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel( |
+ desktop_layer_, desktop_layer_->bounds().size())); |
+ } |
+} |
+ |
void DesktopVideoCaptureMachine::Capture(bool dirty) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
@@ -248,6 +265,17 @@ void DesktopVideoCaptureMachine::DidCopyOutput( |
base::Passed(&release_callback))); |
} |
+void DesktopVideoCaptureMachine::OnWindowBoundsChanged( |
+ aura::Window* window, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds) { |
+ DCHECK(desktop_window_ && window == desktop_window_); |
+ |
+ // Post task to update capture size on UI thread. |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
+ &DesktopVideoCaptureMachine::UpdateCaptureSize, AsWeakPtr())); |
+} |
+ |
void DesktopVideoCaptureMachine::OnWindowDestroyed(aura::Window* window) { |
DCHECK(desktop_window_ && window == desktop_window_); |
desktop_window_ = NULL; |