cursor_shape_stub_proxy.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_CLIENT_CURSOR_SHAPE_STUB_PROXY_H_
  5. #define REMOTING_CLIENT_CURSOR_SHAPE_STUB_PROXY_H_
  6. #include "base/memory/weak_ptr.h"
  7. #include "base/task/single_thread_task_runner.h"
  8. #include "remoting/protocol/cursor_shape_stub.h"
  9. namespace remoting {
  10. // A helper class to forward CursorShapeStub function calls from one thread to
  11. // another.
  12. class CursorShapeStubProxy : public protocol::CursorShapeStub {
  13. public:
  14. // Function calls will be forwarded to |stub| on the thread of |task_runner|.
  15. CursorShapeStubProxy(
  16. base::WeakPtr<protocol::CursorShapeStub> stub,
  17. scoped_refptr<base::SingleThreadTaskRunner> task_runner);
  18. CursorShapeStubProxy(const CursorShapeStubProxy&) = delete;
  19. CursorShapeStubProxy& operator=(const CursorShapeStubProxy&) = delete;
  20. ~CursorShapeStubProxy() override;
  21. // CursorShapeStub override.
  22. void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
  23. private:
  24. base::WeakPtr<protocol::CursorShapeStub> stub_;
  25. scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
  26. };
  27. } // namespace remoting
  28. #endif // REMOTING_CLIENT_CURSOR_SHAPE_STUB_PROXY_H_