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

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: Add missing cursor renderer files in repo Created 5 years, 2 months 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 "content/browser/media/capture/cursor_renderer.h"
12 #include "content/common/content_export.h"
13 #include "media/base/video_frame.h"
14 #include "skia/ext/image_operations.h"
15 #include "ui/aura/window.h"
16 #include "ui/base/cursor/cursor.h"
17 #include "ui/events/event_handler.h"
18 #include "ui/gfx/geometry/point.h"
19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/native_widget_types.h"
22
23 namespace content {
24
25 // Tracks state for making decisions on cursor display on a captured video
26 // frame
27 class CONTENT_EXPORT CursorRendererAura :
28 public CursorRenderer,
29 public ui::EventHandler,
30 public aura::WindowObserver {
31 public:
32 explicit CursorRendererAura(gfx::NativeWindow window);
33 ~CursorRendererAura() override;
miu 2015/10/23 01:55:12 For all these methods, try to use 'final' instead
Irfan 2015/10/26 23:10:31 Done.
34 void Clear() override;
miu 2015/10/23 01:55:12 style: These three methods should be headed by a c
Irfan 2015/10/26 23:10:31 Done.
35 bool Update(const gfx::Rect& region_in_frame) override;
36 void RenderOnVideoFrame(
37 const scoped_refptr<media::VideoFrame>& target) const override;
38
39 // Overridden from ui::EventHandler to make decision on when
miu 2015/10/23 01:55:12 style: No need to document overridden interface me
Irfan 2015/10/26 23:10:31 Done.
40 // cursor gets rendered on a captured video frame
41 void OnMouseEvent(ui::MouseEvent* event) override;
42
43 // Overridden from aura::WindowObserver to clean up before window is destroyed
44 void OnWindowDestroying(aura::Window* window) override;
45
46 base::WeakPtr<CursorRenderer> GetWeakPtr() override;
miu 2015/10/23 01:55:12 This should be next to the other three methods bei
Irfan 2015/10/26 23:10:31 Done.
47 private:
48 ui::Cursor last_cursor_;
miu 2015/10/23 01:55:12 Please add a comment for these four members. Like
Irfan 2015/10/26 23:10:31 Done.
49 gfx::Size window_size_when_cursor_last_updated_;
50 gfx::Point cursor_position_in_frame_;
51 SkBitmap scaled_cursor_bitmap_;
52 gfx::NativeView window_;
miu 2015/10/23 01:55:12 nit: |window_| should go first since it's injected
Irfan 2015/10/26 23:10:31 Done.
53
54 enum {
miu 2015/10/23 01:55:12 Consider moving these values to the CursorRenderer
Irfan 2015/10/26 23:10:31 Done.
55 // Minium movement before cursor is rendered on frame
miu 2015/10/23 01:55:12 style nit: In Chromium code, all comments must be
Irfan 2015/10/26 23:10:31 Done.
56 MIN_MOVEMENT_PIXELS = 15,
57 // Maximum idle time allowed before we stop rendering the cursor
58 // on frame
59 MAX_IDLE_TIME_SECONDS = 2
60 };
61
62 base::TimeDelta last_mouse_movement_timestamp_;
miu 2015/10/23 01:55:12 Short comment needed here too about when these are
Irfan 2015/10/26 23:10:31 Done.
63 float last_mouse_position_x_;
64 float last_mouse_position_y_;
65 bool cursor_displayed_;
66
67 base::WeakPtrFactory<CursorRendererAura> weak_factory_;
68 DISALLOW_COPY_AND_ASSIGN(CursorRendererAura);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698