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

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: Removed obsolete #include. Created 6 years, 11 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
Index: remoting/host/desktop_session_agent.cc
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 159776550c619c3017dab1c56bab9cce30dad23b..3fd1299d80b7032ceba3ba921860d5c03e678a7c 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 {
@@ -292,10 +293,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) {
@@ -321,14 +324,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(
@@ -404,7 +413,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));
}
}
@@ -416,6 +426,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
@@ -512,20 +524,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);

Powered by Google App Engine
This is Rietveld 408576698