| OLD | NEW |
| (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_OVERLAY_CONFIG_H_ |
| 6 #define MEDIA_BASE_ANDROID_OVERLAY_CONFIG_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 |
| 13 namespace media { |
| 14 |
| 15 class AndroidOverlay; |
| 16 |
| 17 // Configuration used to create an overlay. |
| 18 struct MEDIA_EXPORT AndroidOverlayConfig { |
| 19 public: |
| 20 // Called when the overlay is ready for use, via |GetJavaSurface()|. |
| 21 using ReadyCB = base::OnceCallback<void(AndroidOverlay*)>; |
| 22 |
| 23 // Called when overlay has failed before |ReadyCB| is called. Will not be |
| 24 // called after ReadyCB. It will be the last callback for the overlay. |
| 25 using FailedCB = base::OnceCallback<void(AndroidOverlay*)>; |
| 26 |
| 27 // Called when the overlay has been destroyed. This will not be called unless |
| 28 // ReadyCB has been called. It will be the last callback for the overlay. |
| 29 using DestroyedCB = base::OnceCallback<void(AndroidOverlay*)>; |
| 30 |
| 31 // Configuration used to create an overlay. |
| 32 AndroidOverlayConfig(); |
| 33 AndroidOverlayConfig(AndroidOverlayConfig&&); |
| 34 ~AndroidOverlayConfig(); |
| 35 |
| 36 // Initial rectangle for the overlay. May be changed via ScheduleLayout(). |
| 37 gfx::Rect rect; |
| 38 |
| 39 // Require a secure overlay? |
| 40 bool secure = false; |
| 41 |
| 42 // Convenient helpers since the syntax is weird. |
| 43 void is_ready(AndroidOverlay* overlay) { std::move(ready_cb).Run(overlay); } |
| 44 void is_failed(AndroidOverlay* overlay) { std::move(failed_cb).Run(overlay); } |
| 45 void is_destroyed(AndroidOverlay* overlay) { |
| 46 std::move(destroyed_cb).Run(overlay); |
| 47 } |
| 48 |
| 49 ReadyCB ready_cb; |
| 50 FailedCB failed_cb; |
| 51 DestroyedCB destroyed_cb; |
| 52 |
| 53 DISALLOW_COPY(AndroidOverlayConfig); |
| 54 }; |
| 55 |
| 56 // Common factory type. |
| 57 using AndroidOverlayFactoryCB = |
| 58 base::RepeatingCallback<std::unique_ptr<AndroidOverlay>( |
| 59 AndroidOverlayConfig)>; |
| 60 |
| 61 } // namespace media |
| 62 |
| 63 #endif // MEDIA_BASE_ANDROID_OVERLAY_CONFIG_H_ |
| OLD | NEW |