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

Unified 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: Disable cursor rendering on windows until resources are available 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/capture/cursor_renderer_aura.h
diff --git a/content/browser/media/capture/cursor_renderer_aura.h b/content/browser/media/capture/cursor_renderer_aura.h
new file mode 100644
index 0000000000000000000000000000000000000000..42dffa6b392a60f1bd66bc3e644c03a1f8bbed91
--- /dev/null
+++ b/content/browser/media/capture/cursor_renderer_aura.h
@@ -0,0 +1,78 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
+#define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/time/default_tick_clock.h"
+#include "base/time/tick_clock.h"
+#include "content/browser/media/capture/cursor_renderer.h"
+#include "content/common/content_export.h"
+#include "media/base/video_frame.h"
+#include "skia/ext/image_operations.h"
+#include "ui/aura/window.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/events/event_handler.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace content {
+
+// Tracks state for making decisions on cursor display on a captured video
+// frame.
+class CONTENT_EXPORT CursorRendererAura : public CursorRenderer,
+ public ui::EventHandler,
+ public aura::WindowObserver {
+ public:
+ explicit CursorRendererAura(aura::Window* window);
+ ~CursorRendererAura() final;
+
+ // CursorRender implementation.
+ void Clear() final;
+ bool SnapshotCursorState(const gfx::Rect& region_in_frame) final;
+ void RenderOnVideoFrame(
+ const scoped_refptr<media::VideoFrame>& target) const final;
+ base::WeakPtr<CursorRenderer> GetWeakPtr() final;
+
+ // ui::EventHandler overrides.
+ void OnMouseEvent(ui::MouseEvent* event) final;
+
+ // aura::WindowObserver overrides.
+ void OnWindowDestroying(aura::Window* window) final;
+
+ private:
+ friend class CursorRendererAuraTest;
+
+ aura::Window* window_;
+
+ // Snapshot of cursor, source size, position, and cursor bitmap; as of the
+ // last call to SnapshotCursorState.
+ ui::Cursor last_cursor_;
+ gfx::Size window_size_when_cursor_last_updated_;
+ gfx::Point cursor_position_in_frame_;
+ SkBitmap scaled_cursor_bitmap_;
+
+ // Updated in mouse event listener and used to make a decision on
+ // when the cursor is rendered.
+ base::TimeDelta last_mouse_movement_timestamp_;
+ float last_mouse_position_x_;
+ float last_mouse_position_y_;
+ bool cursor_displayed_;
+
+ // Allows tests to replace the clock.
+ base::DefaultTickClock default_tick_clock_;
+ base::TickClock* tick_clock_;
+
+ base::WeakPtrFactory<CursorRendererAura> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CursorRendererAura);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_
« no previous file with comments | « content/browser/media/capture/cursor_renderer.h ('k') | content/browser/media/capture/cursor_renderer_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698