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