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

Unified Diff: media/base/android/android_overlay.h

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: BUILD.gn fixes Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/android_overlay.h
diff --git a/media/base/android/android_overlay.h b/media/base/android/android_overlay.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f5f3f36e8c67427f355cde46e6ab8f9a5189593
--- /dev/null
+++ b/media/base/android/android_overlay.h
@@ -0,0 +1,62 @@
+// Copyright 2017 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 MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
+#define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "media/base/media_export.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gl/android/scoped_java_surface.h"
+
+namespace media {
+
+// Client interface to an AndroidOverlay. To construct one, you'll probably
+// want to use an AndroidOverlayFactory. Once constructed, you can expect to
+// receive zero or one SurfaceCreatedCallbacks, and one SurfaceDestroyed.
+// Upon receiving SurfaceCreated, you will have Android Surface that you may
+// use until SurfaceDestroyed. You may also move the surface (ScheduleLayout).
+// When SurfaceDestroyed arrives, you should stop using the Android Surface and
+// delete the AndroidOverlay instance. Note that these calls are synchronous
+// in Android, so you should delete the AndroidOverlay surface as soon as
+// possible. Other overlays might be blocked waiting.
+class MEDIA_EXPORT AndroidOverlay {
+ public:
+ // Called when the overlay is ready for use. You should take ownership of
+ // the surface.
+ using ReadyCallback = base::Callback<void(gl::ScopedJavaSurface)>;
+
+ // Called when the overlay has been destroyed. This may be called before
+ // ReadyCallback. It will be the last callback for the overlay.
+ using DestroyedCallback = base::Callback<void()>;
+
+ // Configuration used to create an overlay.
+ struct Config {
+ public:
+ Config();
+ Config(const Config&);
+ ~Config();
+
+ gfx::Rect rect;
+ // TODO(liberato): add format, etc. here.
+
+ ReadyCallback ready_cb;
+ DestroyedCallback destroyed_cb;
+ };
+
+ virtual ~AndroidOverlay() {}
+
+ // Schedule a relayout of this overlay. If called before the client is
+ // notified that the surface is created, then the call will be ignored.
+ virtual void ScheduleLayout(const gfx::Rect& rect) = 0;
+
+ protected:
+ AndroidOverlay() {}
+ DISALLOW_COPY_AND_ASSIGN(AndroidOverlay);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_

Powered by Google App Engine
This is Rietveld 408576698