OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mouse_shape_pump.h" | 5 #include "remoting/host/mouse_shape_pump.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "remoting/proto/control.pb.h" | 12 #include "remoting/proto/control.pb.h" |
13 #include "remoting/protocol/cursor_shape_stub.h" | 13 #include "remoting/protocol/cursor_shape_stub.h" |
14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
15 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" | 15 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" |
16 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 16 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 // Poll mouse shape 10 times a second. | 20 // Poll mouse shape 10 times a second. |
21 static const int kCursorCaptureIntervalMs = 100; | 21 static const int kCursorCaptureIntervalMs = 100; |
22 | 22 |
23 MouseShapePump::MouseShapePump( | 23 MouseShapePump::MouseShapePump( |
24 std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, | 24 std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, |
25 protocol::CursorShapeStub* cursor_shape_stub) | 25 protocol::CursorShapeStub* cursor_shape_stub) |
26 : mouse_cursor_monitor_(std::move(mouse_cursor_monitor)), | 26 : mouse_cursor_monitor_(std::move(mouse_cursor_monitor)), |
27 cursor_shape_stub_(cursor_shape_stub), | 27 cursor_shape_stub_(cursor_shape_stub) { |
28 capture_timer_(true, true) { | |
29 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); | 28 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); |
30 capture_timer_.Start( | 29 capture_timer_.Start( |
31 FROM_HERE, base::TimeDelta::FromMilliseconds(kCursorCaptureIntervalMs), | 30 FROM_HERE, base::TimeDelta::FromMilliseconds(kCursorCaptureIntervalMs), |
32 base::Bind(&MouseShapePump::Capture, base::Unretained(this))); | 31 base::Bind(&MouseShapePump::Capture, base::Unretained(this))); |
33 } | 32 } |
34 | 33 |
35 MouseShapePump::~MouseShapePump() {} | 34 MouseShapePump::~MouseShapePump() {} |
36 | 35 |
37 void MouseShapePump::Capture() { | 36 void MouseShapePump::Capture() { |
38 DCHECK(thread_checker_.CalledOnValidThread()); | 37 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 27 matching lines...) Expand all Loading... |
66 } | 65 } |
67 | 66 |
68 void MouseShapePump::OnMouseCursorPosition( | 67 void MouseShapePump::OnMouseCursorPosition( |
69 webrtc::MouseCursorMonitor::CursorState state, | 68 webrtc::MouseCursorMonitor::CursorState state, |
70 const webrtc::DesktopVector& position) { | 69 const webrtc::DesktopVector& position) { |
71 // We're not subscribing to mouse position changes. | 70 // We're not subscribing to mouse position changes. |
72 NOTREACHED(); | 71 NOTREACHED(); |
73 } | 72 } |
74 | 73 |
75 } // namespace remoting | 74 } // namespace remoting |
OLD | NEW |