Chromium Code Reviews| 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 gfx::Rect rect; | |
|
tguilbert
2017/05/04 21:52:04
NIT: can you add a small comment describing what |
liberato (no reviews please)
2017/05/05 16:50:23
Done.
| |
| 37 | |
| 38 // Require a secure overlay? | |
| 39 bool secure = false; | |
| 40 | |
| 41 // Convenient helpers since the syntax is weird. | |
| 42 void is_ready(AndroidOverlay* overlay) { std::move(ready_cb).Run(overlay); } | |
| 43 void is_failed(AndroidOverlay* overlay) { std::move(failed_cb).Run(overlay); } | |
| 44 void is_destroyed(AndroidOverlay* overlay) { | |
| 45 std::move(destroyed_cb).Run(overlay); | |
| 46 } | |
| 47 | |
| 48 ReadyCB ready_cb; | |
| 49 FailedCB failed_cb; | |
| 50 DestroyedCB destroyed_cb; | |
| 51 | |
| 52 DISALLOW_COPY(AndroidOverlayConfig); | |
| 53 }; | |
| 54 | |
| 55 // Common factory type. | |
| 56 using AndroidOverlayFactoryCB = | |
| 57 base::RepeatingCallback<std::unique_ptr<AndroidOverlay>( | |
| 58 AndroidOverlayConfig)>; | |
| 59 | |
| 60 } // namespace media | |
| 61 | |
| 62 #endif // MEDIA_BASE_ANDROID_OVERLAY_CONFIG_H_ | |
| OLD | NEW |