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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
6 #define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "media/base/media_export.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gl/android/scoped_java_surface.h"
13
14 namespace media {
15
16 // Client interface to an AndroidOverlay. To construct one, you'll probably
17 // want to use an AndroidOverlayFactory. Once constructed, you can expect to
18 // receive zero or one SurfaceCreatedCallbacks, and one SurfaceDestroyed.
19 // Upon receiving SurfaceCreated, you will have Android Surface that you may
20 // use until SurfaceDestroyed. You may also move the surface (ScheduleLayout).
21 // When SurfaceDestroyed arrives, you should stop using the Android Surface and
22 // delete the AndroidOverlay instance. Note that these calls are synchronous
23 // in Android, so you should delete the AndroidOverlay surface as soon as
24 // possible. Other overlays might be blocked waiting.
25 class MEDIA_EXPORT AndroidOverlay {
26 public:
27 // Called when the overlay is ready for use. You should take ownership of
28 // the surface.
29 using ReadyCallback = base::Callback<void(gl::ScopedJavaSurface)>;
30
31 // Called when the overlay has been destroyed. This may be called before
32 // ReadyCallback. It will be the last callback for the overlay.
33 using DestroyedCallback = base::Callback<void()>;
34
35 // Configuration used to create an overlay.
36 struct Config {
37 public:
38 Config();
39 Config(const Config&);
40 ~Config();
41
42 gfx::Rect rect;
43 // TODO(liberato): add format, etc. here.
44
45 ReadyCallback ready_cb;
46 DestroyedCallback destroyed_cb;
47 };
48
49 virtual ~AndroidOverlay() {}
50
51 // Schedule a relayout of this overlay. If called before the client is
52 // notified that the surface is created, then the call will be ignored.
53 virtual void ScheduleLayout(const gfx::Rect& rect) = 0;
54
55 protected:
56 AndroidOverlay() {}
57 DISALLOW_COPY_AND_ASSIGN(AndroidOverlay);
58 };
59
60 } // namespace media
61
62 #endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698