OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ | 5 #ifndef MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ |
6 #define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ | 6 #define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/unguessable_token.h" | |
12 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
13 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gl/android/scoped_java_surface.h" | 13 #include "ui/gl/android/scoped_java_surface.h" |
15 | 14 |
16 namespace media { | 15 namespace media { |
17 | 16 |
18 // Client interface to an AndroidOverlay. Once constructed, you can expect to | 17 // Client interface to an AndroidOverlay. Once constructed, you can expect to |
19 // receive either a call to ReadyCB or a call to FailedCB to indicate whether | 18 // receive either a call to ReadyCB or a call to FailedCB to indicate whether |
20 // the overlay is ready, or isn't going to be ready. If one does get ReadyCB, | 19 // the overlay is ready, or isn't going to be ready. If one does get ReadyCB, |
21 // then one may GetJavaSurface() to retrieve the java Surface object. One | 20 // then one may GetJavaSurface() to retrieve the java Surface object. One |
(...skipping 26 matching lines...) Expand all Loading... |
48 // ReadyCB has been called. It will be the last callback for the overlay. | 47 // ReadyCB has been called. It will be the last callback for the overlay. |
49 using DestroyedCB = base::Callback<void()>; | 48 using DestroyedCB = base::Callback<void()>; |
50 | 49 |
51 // Configuration used to create an overlay. | 50 // Configuration used to create an overlay. |
52 struct Config { | 51 struct Config { |
53 public: | 52 public: |
54 Config(); | 53 Config(); |
55 Config(const Config&); | 54 Config(const Config&); |
56 ~Config(); | 55 ~Config(); |
57 | 56 |
58 // Implementation-specific token. | |
59 base::UnguessableToken routing_token; | |
60 | |
61 gfx::Rect rect; | 57 gfx::Rect rect; |
62 | 58 |
63 ReadyCB ready_cb; | 59 ReadyCB ready_cb; |
64 FailedCB failed_cb; | 60 FailedCB failed_cb; |
65 DestroyedCB destroyed_cb; | 61 DestroyedCB destroyed_cb; |
66 }; | 62 }; |
67 | 63 |
68 virtual ~AndroidOverlay() {} | 64 virtual ~AndroidOverlay() {} |
69 | 65 |
70 // Schedules a relayout of this overlay. If called before the client is | 66 // Schedules a relayout of this overlay. If called before the client is |
71 // notified that the surface is created, then the call will be ignored. | 67 // notified that the surface is created, then the call will be ignored. |
72 virtual void ScheduleLayout(const gfx::Rect& rect) = 0; | 68 virtual void ScheduleLayout(const gfx::Rect& rect) = 0; |
73 | 69 |
74 // May be called during / after ReadyCB and before DestroyedCB. | 70 // May be called during / after ReadyCB and before DestroyedCB. |
75 virtual const base::android::JavaRef<jobject>& GetJavaSurface() const = 0; | 71 virtual const base::android::JavaRef<jobject>& GetJavaSurface() const = 0; |
76 | 72 |
77 protected: | 73 protected: |
78 AndroidOverlay() {} | 74 AndroidOverlay() {} |
79 | 75 |
80 DISALLOW_COPY_AND_ASSIGN(AndroidOverlay); | 76 DISALLOW_COPY_AND_ASSIGN(AndroidOverlay); |
81 }; | 77 }; |
82 | 78 |
83 } // namespace media | 79 } // namespace media |
84 | 80 |
85 #endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ | 81 #endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_ |
OLD | NEW |