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

Unified Diff: remoting/host/screen_recorder.cc

Issue 10382184: [Chromoting] Initial plumbing for cursor shape. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused vars. Fix Mac Capturer Unittest. Created 8 years, 7 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/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index ab96a53708cf35a6c6db14f1e7d1fea6ef8635ff..e7b414c9afbe0d909bfd7806ad10bb00fbdb1bc3 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -16,6 +16,7 @@
#include "base/time.h"
#include "remoting/base/capture_data.h"
#include "remoting/proto/control.pb.h"
+#include "remoting/proto/internal.pb.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/connection_to_client.h"
@@ -142,7 +143,9 @@ void ScreenRecorder::DoStart() {
return;
}
- capturer()->Start();
+ capturer()->Start(
+ base::Bind(&ScreenRecorder::CursorShapeChangedCallback, this));
+
capture_timer_.reset(new base::OneShotTimer<ScreenRecorder>());
// Capture first frame immedately.
@@ -214,6 +217,18 @@ void ScreenRecorder::CaptureDoneCallback(
FROM_HERE, base::Bind(&ScreenRecorder::DoEncode, this, capture_data));
}
+void ScreenRecorder::CursorShapeChangedCallback(
+ scoped_ptr<protocol::CursorShapeInfo> cursor_shape) {
+ DCHECK_EQ(capture_loop_, MessageLoop::current());
+
+ if (!is_recording())
+ return;
+
+ network_loop_->PostTask(
+ FROM_HERE, base::Bind(&ScreenRecorder::DoSendCursorShape, this,
+ base::Passed(cursor_shape.Pass())));
+}
+
void ScreenRecorder::DoFinishOneRecording() {
DCHECK_EQ(capture_loop_, MessageLoop::current());
@@ -281,6 +296,18 @@ void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) {
this, done_task));
}
+void ScreenRecorder::DoSendCursorShape(
+ scoped_ptr<protocol::CursorShapeInfo> cursor_shape) {
+ DCHECK(network_loop_->BelongsToCurrentThread());
+
+ if (network_stopped_ || connections_.empty())
+ return;
+
+ // TODO(sergeyu): Currently we send the data only to the first
+ // connection. Send it to all connections if necessary.
+ connections_.front()->client_stub()->SetCursorShape(*cursor_shape);
+}
+
// Encoder thread --------------------------------------------------------------
void ScreenRecorder::DoEncode(
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698