Chromium Code Reviews| Index: media/base/android_overlay_config.h |
| diff --git a/media/base/android_overlay_config.h b/media/base/android_overlay_config.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..086cc1046640badb7a8759066a3d1920d704a7ac |
| --- /dev/null |
| +++ b/media/base/android_overlay_config.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_ANDROID_OVERLAY_CONFIG_H_ |
| +#define MEDIA_BASE_ANDROID_OVERLAY_CONFIG_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "media/base/media_export.h" |
| +#include "ui/gfx/geometry/rect.h" |
| + |
| +namespace media { |
| + |
| +class AndroidOverlay; |
| + |
| +// Configuration used to create an overlay. |
| +struct MEDIA_EXPORT AndroidOverlayConfig { |
| + public: |
| + // Called when the overlay is ready for use, via |GetJavaSurface()|. |
| + using ReadyCB = base::OnceCallback<void(AndroidOverlay*)>; |
| + |
| + // Called when overlay has failed before |ReadyCB| is called. Will not be |
| + // called after ReadyCB. It will be the last callback for the overlay. |
| + using FailedCB = base::OnceCallback<void(AndroidOverlay*)>; |
| + |
| + // Called when the overlay has been destroyed. This will not be called unless |
| + // ReadyCB has been called. It will be the last callback for the overlay. |
| + using DestroyedCB = base::OnceCallback<void(AndroidOverlay*)>; |
| + |
| + // Configuration used to create an overlay. |
| + AndroidOverlayConfig(); |
| + AndroidOverlayConfig(AndroidOverlayConfig&&); |
| + ~AndroidOverlayConfig(); |
| + |
| + 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.
|
| + |
| + // Require a secure overlay? |
| + bool secure = false; |
| + |
| + // Convenient helpers since the syntax is weird. |
| + void is_ready(AndroidOverlay* overlay) { std::move(ready_cb).Run(overlay); } |
| + void is_failed(AndroidOverlay* overlay) { std::move(failed_cb).Run(overlay); } |
| + void is_destroyed(AndroidOverlay* overlay) { |
| + std::move(destroyed_cb).Run(overlay); |
| + } |
| + |
| + ReadyCB ready_cb; |
| + FailedCB failed_cb; |
| + DestroyedCB destroyed_cb; |
| + |
| + DISALLOW_COPY(AndroidOverlayConfig); |
| +}; |
| + |
| +// Common factory type. |
| +using AndroidOverlayFactoryCB = |
| + base::RepeatingCallback<std::unique_ptr<AndroidOverlay>( |
| + AndroidOverlayConfig)>; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ANDROID_OVERLAY_CONFIG_H_ |