OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/ipc_video_frame_capturer.h" | 5 #include "remoting/host/ipc_video_frame_capturer.h" |
6 | 6 |
7 #include "remoting/capturer/capture_data.h" | 7 #include "remoting/capturer/capture_data.h" |
8 #include "remoting/capturer/mouse_cursor_shape.h" | 8 #include "remoting/capturer/mouse_cursor_shape.h" |
9 #include "remoting/host/desktop_session_proxy.h" | 9 #include "remoting/host/desktop_session_proxy.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 IpcVideoFrameCapturer::IpcVideoFrameCapturer( | 13 IpcVideoFrameCapturer::IpcVideoFrameCapturer( |
14 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) | 14 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) |
15 : delegate_(NULL), | 15 : delegate_(NULL), |
16 desktop_session_proxy_(desktop_session_proxy), | 16 desktop_session_proxy_(desktop_session_proxy) { |
17 size_most_recent_(SkISize::Make(0, 0)) { | |
18 } | 17 } |
19 | 18 |
20 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { | 19 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { |
21 } | 20 } |
22 | 21 |
23 void IpcVideoFrameCapturer::Start(Delegate* delegate) { | 22 void IpcVideoFrameCapturer::Start(Delegate* delegate) { |
24 delegate_ = delegate; | 23 delegate_ = delegate; |
25 desktop_session_proxy_->StartVideoCapturer(this); | 24 desktop_session_proxy_->StartVideoCapturer(this); |
26 } | 25 } |
27 | 26 |
28 void IpcVideoFrameCapturer::Stop() { | 27 void IpcVideoFrameCapturer::Stop() { |
29 desktop_session_proxy_->StopVideoCapturer(); | 28 desktop_session_proxy_->StopVideoCapturer(); |
30 delegate_ = NULL; | 29 delegate_ = NULL; |
31 } | 30 } |
32 | 31 |
33 void IpcVideoFrameCapturer::InvalidateRegion(const SkRegion& invalid_region) { | 32 void IpcVideoFrameCapturer::InvalidateRegion(const SkRegion& invalid_region) { |
34 desktop_session_proxy_->InvalidateRegion(invalid_region); | 33 desktop_session_proxy_->InvalidateRegion(invalid_region); |
35 } | 34 } |
36 | 35 |
37 void IpcVideoFrameCapturer::CaptureFrame() { | 36 void IpcVideoFrameCapturer::CaptureFrame() { |
38 desktop_session_proxy_->CaptureFrame(); | 37 desktop_session_proxy_->CaptureFrame(); |
39 } | 38 } |
40 | 39 |
41 const SkISize& IpcVideoFrameCapturer::size_most_recent() const { | |
42 return size_most_recent_; | |
43 } | |
44 | |
45 void IpcVideoFrameCapturer::OnCaptureCompleted( | 40 void IpcVideoFrameCapturer::OnCaptureCompleted( |
46 scoped_refptr<CaptureData> capture_data) { | 41 scoped_refptr<CaptureData> capture_data) { |
47 if (capture_data) | |
48 size_most_recent_ = capture_data->size(); | |
49 | |
50 if (delegate_) | 42 if (delegate_) |
51 delegate_->OnCaptureCompleted(capture_data); | 43 delegate_->OnCaptureCompleted(capture_data); |
52 } | 44 } |
53 | 45 |
54 void IpcVideoFrameCapturer::OnCursorShapeChanged( | 46 void IpcVideoFrameCapturer::OnCursorShapeChanged( |
55 scoped_ptr<MouseCursorShape> cursor_shape) { | 47 scoped_ptr<MouseCursorShape> cursor_shape) { |
56 if (delegate_) | 48 if (delegate_) |
57 delegate_->OnCursorShapeChanged(cursor_shape.Pass()); | 49 delegate_->OnCursorShapeChanged(cursor_shape.Pass()); |
58 } | 50 } |
59 | 51 |
60 } // namespace remoting | 52 } // namespace remoting |
OLD | NEW |