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 "media/video/capture/screen/mouse_cursor_shape.h" | 7 #include "media/video/capture/screen/mouse_cursor_shape.h" |
8 #include "media/video/capture/screen/screen_capture_data.h" | 8 #include "media/video/capture/screen/screen_capture_data.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 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 17 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
18 } | 18 } |
19 | 19 |
20 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { | 20 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { |
21 } | 21 } |
22 | 22 |
23 void IpcVideoFrameCapturer::Start(Delegate* delegate) { | 23 void IpcVideoFrameCapturer::Start(Delegate* delegate) { |
24 delegate_ = delegate; | 24 delegate_ = delegate; |
25 desktop_session_proxy_->SetVideoCapturer(weak_factory_.GetWeakPtr()); | 25 desktop_session_proxy_->SetVideoCapturer(weak_factory_.GetWeakPtr()); |
26 } | 26 } |
27 | 27 |
28 void IpcVideoFrameCapturer::Stop() { | |
29 delegate_ = NULL; | |
30 weak_factory_.InvalidateWeakPtrs(); | |
31 } | |
32 | |
33 void IpcVideoFrameCapturer::InvalidateRegion(const SkRegion& invalid_region) { | |
34 desktop_session_proxy_->InvalidateRegion(invalid_region); | |
35 } | |
36 | |
37 void IpcVideoFrameCapturer::CaptureFrame() { | 28 void IpcVideoFrameCapturer::CaptureFrame() { |
38 desktop_session_proxy_->CaptureFrame(); | 29 desktop_session_proxy_->CaptureFrame(); |
39 } | 30 } |
40 | 31 |
41 void IpcVideoFrameCapturer::OnCaptureCompleted( | 32 void IpcVideoFrameCapturer::OnCaptureCompleted( |
42 scoped_refptr<media::ScreenCaptureData> capture_data) { | 33 scoped_refptr<media::ScreenCaptureData> capture_data) { |
43 if (delegate_) | 34 if (delegate_) |
44 delegate_->OnCaptureCompleted(capture_data); | 35 delegate_->OnCaptureCompleted(capture_data); |
45 } | 36 } |
46 | 37 |
47 void IpcVideoFrameCapturer::OnCursorShapeChanged( | 38 void IpcVideoFrameCapturer::OnCursorShapeChanged( |
48 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 39 scoped_ptr<media::MouseCursorShape> cursor_shape) { |
49 if (delegate_) | 40 if (delegate_) |
50 delegate_->OnCursorShapeChanged(cursor_shape.Pass()); | 41 delegate_->OnCursorShapeChanged(cursor_shape.Pass()); |
51 } | 42 } |
52 | 43 |
53 } // namespace remoting | 44 } // namespace remoting |
OLD | NEW |