Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: remoting/host/desktop_session_agent.cc

Issue 92473002: Use webrtc::MouseCursorMonitor for cursor shapes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux build Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_session_agent.cc
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index a7ed484a9da5b723386e630eaa61250e5d22ddf2..b36388ff3e5615f994e7bea3c189481618962ec7 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -27,6 +27,7 @@
#include "remoting/protocol/input_event_tracker.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
+#include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
#include "third_party/webrtc/modules/desktop_capture/shared_memory.h"
namespace remoting {
@@ -298,10 +299,12 @@ void DesktopSessionAgent::OnStartSessionAgent(
FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this));
}
- // Start the video capturer.
+ // Start the video capturer and mouse cursor monitor.
video_capturer_ = desktop_environment_->CreateVideoCapturer();
+ mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor();
video_capture_task_runner_->PostTask(
- FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this));
+ FROM_HERE, base::Bind(
+ &DesktopSessionAgent::StartVideoCapturerAndMouseMonitor, this));
}
void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
@@ -327,14 +330,20 @@ void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame));
}
-void DesktopSessionAgent::OnCursorShapeChanged(
- webrtc::MouseCursorShape* cursor_shape) {
+void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
DCHECK(video_capture_task_runner_->BelongsToCurrentThread());
- scoped_ptr<webrtc::MouseCursorShape> owned_cursor(cursor_shape);
+ scoped_ptr<webrtc::MouseCursor> owned_cursor(cursor);
- SendToNetwork(new ChromotingDesktopNetworkMsg_CursorShapeChanged(
- *cursor_shape));
+ SendToNetwork(
+ new ChromotingDesktopNetworkMsg_MouseCursor(*owned_cursor));
+}
+
+void DesktopSessionAgent::OnMouseCursorPosition(
+ webrtc::MouseCursorMonitor::CursorState state,
+ const webrtc::DesktopVector& position) {
+ // We're not subscribing to mouse position changes.
+ NOTREACHED();
}
void DesktopSessionAgent::InjectClipboardEvent(
@@ -417,7 +426,8 @@ void DesktopSessionAgent::Stop() {
// Stop the video capturer.
video_capture_task_runner_->PostTask(
- FROM_HERE, base::Bind(&DesktopSessionAgent::StopVideoCapturer, this));
+ FROM_HERE, base::Bind(
+ &DesktopSessionAgent::StopVideoCapturerAndMouseMonitor, this));
}
}
@@ -429,6 +439,8 @@ void DesktopSessionAgent::OnCaptureFrame() {
return;
}
+ mouse_cursor_monitor_->Capture();
+
// webrtc::ScreenCapturer supports a very few (currently 2) outstanding
// capture requests. The requests are serialized on
// |video_capture_task_runner()| task runner. If the client issues more
@@ -545,20 +557,24 @@ void DesktopSessionAgent::StopAudioCapturer() {
audio_capturer_.reset();
}
-void DesktopSessionAgent::StartVideoCapturer() {
+void DesktopSessionAgent::StartVideoCapturerAndMouseMonitor() {
DCHECK(video_capture_task_runner_->BelongsToCurrentThread());
if (video_capturer_) {
- video_capturer_->SetMouseShapeObserver(this);
video_capturer_->Start(this);
}
+
+ if (mouse_cursor_monitor_) {
+ mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY);
+ }
}
-void DesktopSessionAgent::StopVideoCapturer() {
+void DesktopSessionAgent::StopVideoCapturerAndMouseMonitor() {
DCHECK(video_capture_task_runner_->BelongsToCurrentThread());
video_capturer_.reset();
last_frame_.reset();
+ mouse_cursor_monitor_.reset();
// Video capturer must delete all buffers.
DCHECK_EQ(shared_buffers_, 0);
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698