Index: remoting/client/callback_cursor_shape_stub.h |
diff --git a/remoting/client/callback_cursor_shape_stub.h b/remoting/client/callback_cursor_shape_stub.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0fa218e9a4cc6500620a57b625e2c377b1576401 |
--- /dev/null |
+++ b/remoting/client/callback_cursor_shape_stub.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_CLIENT_CALLBACK_CURSOR_SHAPE_STUB_H_ |
+#define REMOTING_CLIENT_CALLBACK_CURSOR_SHAPE_STUB_H_ |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "base/single_thread_task_runner.h" |
+#include "remoting/protocol/cursor_shape_stub.h" |
+ |
+namespace remoting { |
+ |
+// A helper class for wrapping a cursor updating callback into a |
+// CursorShapeStub. The callback will be run when SetCursorShape is called. |
Sergey Ulanov
2016/07/27 18:26:09
The comment doesn't mention that the callback is c
Yuwei
2016/07/27 19:22:28
Added comment.
|
+class CallbackCursorShapeStub : public protocol::CursorShapeStub { |
Sergey Ulanov
2016/07/27 18:26:09
In other places we call classes like this that mov
Yuwei
2016/07/27 18:37:20
The class being proxied will need to implement the
Sergey Ulanov
2016/07/27 18:47:51
There is no requirement that CursorShapeStub _inte
Yuwei
2016/07/27 19:22:28
Done.
Yuwei
2016/07/27 19:22:28
Acknowledged.
|
+ public: |
+ // If |task_runner| is null, |callback| will be run upon the current call |
+ // stack of SetCursorShape on the network thread. Otherwise it will be run |
+ // on the thread of |task_runner|. |
+ CallbackCursorShapeStub( |
+ base::Callback<void(const protocol::CursorShapeInfo&)> callback, |
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
+ ~CallbackCursorShapeStub() override; |
+ |
+ // CursorShapeStub override. |
+ void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; |
+ |
+ private: |
+ base::Callback<void(const protocol::CursorShapeInfo&)> callback_; |
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CallbackCursorShapeStub); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_CLIENT_CALLBACK_CURSOR_SHAPE_STUB_H_ |