| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 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 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "media/base/video_frame.h" |
| 13 #include "ui/gfx/native_widget_types.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // CursorRenderer is an interface that can be implememented to do cursor |
| 18 // rendering on a video frame. |
| 19 // |
| 20 // In order to track the cursor, the platform-specific implementation |
| 21 // will listen to mouse events. |
| 22 class CONTENT_EXPORT CursorRenderer { |
| 23 public: |
| 24 virtual ~CursorRenderer() {} |
| 25 |
| 26 // Clears the cursor state being tracked. Called when there is a need to |
| 27 // reset the state. |
| 28 virtual void Clear() = 0; |
| 29 |
| 30 // Takes a snapshot of the current cursor state and determines whether |
| 31 // the cursor will be rendered, which cursor image to render, and at what |
| 32 // location within |region_in_frame| to render it. Returns true if cursor |
| 33 // needs to be rendered. |
| 34 virtual bool SnapshotCursorState(const gfx::Rect& region_in_frame) = 0; |
| 35 |
| 36 // Renders cursor on the |target| video frame. |
| 37 virtual void RenderOnVideoFrame( |
| 38 const scoped_refptr<media::VideoFrame>& target) const = 0; |
| 39 |
| 40 // Returns a weak pointer. |
| 41 virtual base::WeakPtr<CursorRenderer> GetWeakPtr() = 0; |
| 42 |
| 43 protected: |
| 44 enum { |
| 45 // Minium movement before cursor is rendered on frame. |
| 46 MIN_MOVEMENT_PIXELS = 15, |
| 47 // Maximum idle time allowed before we stop rendering the cursor |
| 48 // on frame. |
| 49 MAX_IDLE_TIME_SECONDS = 2 |
| 50 }; |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_ |
| OLD | NEW |