| 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 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
| 6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
| 12 | |
| 13 namespace media { | |
| 14 struct MouseCursorShape; | |
| 15 } // namespace media | |
| 16 | 12 |
| 17 namespace remoting { | 13 namespace remoting { |
| 18 | 14 |
| 19 class DesktopSessionProxy; | 15 class DesktopSessionProxy; |
| 20 | 16 |
| 21 // Routes webrtc::ScreenCapturer calls though the IPC channel to the desktop | 17 // Routes webrtc::DesktopCapturer calls though the IPC channel to the desktop |
| 22 // session agent running in the desktop integration process. | 18 // session agent running in the desktop integration process. |
| 23 class IpcVideoFrameCapturer : public webrtc::ScreenCapturer { | 19 class IpcVideoFrameCapturer : public webrtc::DesktopCapturer { |
| 24 public: | 20 public: |
| 25 explicit IpcVideoFrameCapturer( | 21 explicit IpcVideoFrameCapturer( |
| 26 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); | 22 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); |
| 27 virtual ~IpcVideoFrameCapturer(); | 23 virtual ~IpcVideoFrameCapturer(); |
| 28 | 24 |
| 29 // webrtc::DesktopCapturer interface. | 25 // webrtc::DesktopCapturer interface. |
| 30 virtual void Start(Callback* callback) OVERRIDE; | 26 virtual void Start(Callback* callback) OVERRIDE; |
| 31 virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; | 27 virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; |
| 32 | 28 |
| 33 // webrtc::ScreenCapturer interface. | |
| 34 virtual void SetMouseShapeObserver( | |
| 35 MouseShapeObserver* mouse_shape_observer) OVERRIDE; | |
| 36 | |
| 37 virtual bool GetScreenList(ScreenList* screens) OVERRIDE; | |
| 38 | |
| 39 virtual bool SelectScreen(webrtc::ScreenId id) OVERRIDE; | |
| 40 | |
| 41 // Called when a video |frame| has been captured. | 29 // Called when a video |frame| has been captured. |
| 42 void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); | 30 void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
| 43 | 31 |
| 44 // Called when the cursor shape has changed. | |
| 45 void OnCursorShapeChanged(scoped_ptr<webrtc::MouseCursorShape> cursor_shape); | |
| 46 | |
| 47 private: | 32 private: |
| 48 // Points to the callback passed to webrtc::ScreenCapturer::Start(). | 33 // Points to the callback passed to webrtc::DesktopCapturer::Start(). |
| 49 webrtc::ScreenCapturer::Callback* callback_; | 34 webrtc::DesktopCapturer::Callback* callback_; |
| 50 | |
| 51 MouseShapeObserver* mouse_shape_observer_; | |
| 52 | 35 |
| 53 // Wraps the IPC channel to the desktop session agent. | 36 // Wraps the IPC channel to the desktop session agent. |
| 54 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; | 37 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; |
| 55 | 38 |
| 56 // Set to true when a frame is being captured. | 39 // Set to true when a frame is being captured. |
| 57 bool capture_pending_; | 40 bool capture_pending_; |
| 58 | 41 |
| 59 // Used to cancel tasks pending on the capturer when it is stopped. | 42 // Used to cancel tasks pending on the capturer when it is stopped. |
| 60 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; | 43 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; |
| 61 | 44 |
| 62 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); | 45 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); |
| 63 }; | 46 }; |
| 64 | 47 |
| 65 } // namespace remoting | 48 } // namespace remoting |
| 66 | 49 |
| 67 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 50 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
| OLD | NEW |