OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_ANDROID_OVERLAY_PROVIDER_PROXY_H_ |
| 6 #define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_PROVIDER_PROXY_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <stddef.h> |
| 10 #include <stdint.h> |
| 11 |
| 12 #include <set> |
| 13 #include <string> |
| 14 |
| 15 #include "base/android/scoped_java_ref.h" |
| 16 #include "base/lazy_instance.h" |
| 17 #include "base/macros.h" |
| 18 #include "base/process/process_handle.h" |
| 19 #include "base/time/time.h" |
| 20 #include "media/base/android/android_overlay_proxy.h" |
| 21 #include "media/base/media_export.h" |
| 22 #include "ui/gfx/geometry/point.h" |
| 23 #include "ui/gfx/geometry/size.h" |
| 24 |
| 25 namespace media { |
| 26 |
| 27 // This class implements the C++ wrapper around the java |
| 28 // AndroidOverlayProviderProxy. |
| 29 // Typical usage is: |
| 30 // |
| 31 // callback = something that is a AndroidOverlayProvider::Callback; |
| 32 // unique_ptr<AndroidOverlay> surface = |
| 33 // AndroidOverlayProviderProxy::GetPointer()->CreateSurface(callback); |
| 34 // (wait for callback) |
| 35 // surface->GetSurface() |
| 36 // if (i_want_to_change_the_layout_) |
| 37 // surface->ScheduleLayout(new_position_and_size); |
| 38 class MEDIA_EXPORT AndroidOverlayProviderProxy { |
| 39 public: |
| 40 // Return singleton manager instance. |
| 41 static AndroidOverlayProviderProxy* Get(); |
| 42 |
| 43 using Config = AndroidOverlayProxy::Config; |
| 44 |
| 45 // Create an overlay for renderer frame owned by renderer |pid|, and id |
| 46 // |render_frame_id|. May return null. |
| 47 std::unique_ptr<AndroidOverlayProxy> CreateOverlay( |
| 48 base::ProcessHandle pid, |
| 49 int render_frame_id, |
| 50 const Config& config, |
| 51 const AndroidOverlayProxy::Callback& cb); |
| 52 |
| 53 private: |
| 54 AndroidOverlayProviderProxy(); |
| 55 ~AndroidOverlayProviderProxy(); |
| 56 |
| 57 friend struct base::DefaultLazyInstanceTraits<AndroidOverlayProviderProxy>; |
| 58 |
| 59 // Java AndroidOverlayProviderProxy instance. |
| 60 base::android::ScopedJavaGlobalRef<jobject> j_wrapped_provider_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(AndroidOverlayProviderProxy); |
| 63 }; |
| 64 |
| 65 } // namespace media |
| 66 |
| 67 #endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_PROVIDER_PROXY_H_ |
OLD | NEW |