empty_cursor_filter.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2015 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_EMPTY_CURSOR_FILTER_H_
  5. #define REMOTING_CLIENT_EMPTY_CURSOR_FILTER_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "remoting/protocol/cursor_shape_stub.h"
  8. namespace remoting {
  9. // Returns an empty cursor.
  10. protocol::CursorShapeInfo EmptyCursorShape();
  11. // Returns true of the supplied cursor is empty, i.e. width and/or height <= 0.
  12. bool IsCursorShapeEmpty(const protocol::CursorShapeInfo& cursor_shape);
  13. // Helper that checks whether a cursor has any visible pixels, and resizes
  14. // it down to (0x0) if not.
  15. // TODO(wez): Turn this into a general-purpose cropping filter that both
  16. // client and host can use.
  17. class EmptyCursorFilter : public protocol::CursorShapeStub {
  18. public:
  19. explicit EmptyCursorFilter(protocol::CursorShapeStub* cursor_stub);
  20. EmptyCursorFilter(const EmptyCursorFilter&) = delete;
  21. EmptyCursorFilter& operator=(const EmptyCursorFilter&) = delete;
  22. ~EmptyCursorFilter() override;
  23. // protocol::CursorShapeStub interface.
  24. void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
  25. // Replaces the stub to which cursor shapes will be passed-on.
  26. void set_cursor_stub(protocol::CursorShapeStub* cursor_stub) {
  27. cursor_stub_ = cursor_stub;
  28. }
  29. private:
  30. raw_ptr<protocol::CursorShapeStub> cursor_stub_;
  31. };
  32. } // namespace remoting
  33. #endif // REMOTING_CLIENT_EMPTY_CURSOR_FILTER_H_