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

Side by Side Diff: content/browser/media/capture/cursor_renderer_aura.h

Issue 1412173003: cast: support cursor rendering for tab capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit tests Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(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_AURA_H_
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/time/default_tick_clock.h"
12 #include "base/time/tick_clock.h"
13 #include "content/browser/media/capture/cursor_renderer.h"
14 #include "content/common/content_export.h"
15 #include "media/base/video_frame.h"
16 #include "skia/ext/image_operations.h"
17 #include "ui/aura/window.h"
18 #include "ui/base/cursor/cursor.h"
19 #include "ui/events/event_handler.h"
20 #include "ui/gfx/geometry/point.h"
21 #include "ui/gfx/geometry/rect.h"
22 #include "ui/gfx/geometry/size.h"
23 #include "ui/gfx/native_widget_types.h"
24
25 namespace content {
26
27 // Tracks state for making decisions on cursor display on a captured video
28 // frame.
29 class CONTENT_EXPORT CursorRendererAura : public CursorRenderer,
30 public ui::EventHandler,
31 public aura::WindowObserver {
32 public:
33 explicit CursorRendererAura(gfx::NativeWindow window);
miu 2015/10/29 01:44:49 nit: Since this is Aura-specific code, let's use a
Irfan 2015/10/29 15:34:19 Done.
34 ~CursorRendererAura() final;
35
36 // CursorRender implementation.
37 void Clear() final;
38 bool SnapshotCursorState(const gfx::Rect& region_in_frame) final;
39 void RenderOnVideoFrame(
40 const scoped_refptr<media::VideoFrame>& target) const final;
41 base::WeakPtr<CursorRenderer> GetWeakPtr() final;
42
43 // ui::EventHandler overrides.
44 void OnMouseEvent(ui::MouseEvent* event) final;
45
46 // aura::WindowObserver overrides.
47 void OnWindowDestroying(aura::Window* window) final;
48
49 private:
50 friend class CursorRendererAuraTest;
51
52 gfx::NativeView window_;
53
54 // Snapshot of cursor, source size, position, and cursor bitmap; as of the
55 // last call to SnapshotCursorState.
56 ui::Cursor last_cursor_;
57 gfx::Size window_size_when_cursor_last_updated_;
58 gfx::Point cursor_position_in_frame_;
59 SkBitmap scaled_cursor_bitmap_;
60
61 // Updated in mouse event listener and used to make a decision on
62 // when the cursor is rendered.
63 base::TimeDelta last_mouse_movement_timestamp_;
64 float last_mouse_position_x_;
65 float last_mouse_position_y_;
66 bool cursor_displayed_;
67
68 // Allows tests to replace the clock.
69 base::DefaultTickClock default_tick_clock_;
70 base::TickClock* tick_clock_;
71
72 base::WeakPtrFactory<CursorRendererAura> weak_factory_;
73 DISALLOW_COPY_AND_ASSIGN(CursorRendererAura);
miu 2015/10/29 01:44:49 nit: Add a blank line above this one.
Irfan 2015/10/29 15:34:19 Done.
74 };
75
76 } // namespace content
77
78 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698