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_DIALOG_SURFACE_MANAGER_H_ |
| 6 #define MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_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/dialog_surface_holder.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 base { |
| 26 class UnguessableToken; |
| 27 } |
| 28 |
| 29 namespace media { |
| 30 |
| 31 // This class implements the C++ wrapper around the java DialogSurfaceManager. |
| 32 // Typical usage is: |
| 33 // |
| 34 // callback = something that is a DialogSurface::Callback; |
| 35 // unique_ptr<DialogSurfaceHolder> holder = DialogSurfaceManager::GetPointer()-> |
| 36 // CreateSurface(callback); |
| 37 // (wait for callback) |
| 38 // holder->GetSurface() |
| 39 // if (i_want_to_change_the_layout_) |
| 40 // holder->ScheduleLayout(new_position_and_size); |
| 41 class MEDIA_EXPORT DialogSurfaceManager { |
| 42 public: |
| 43 // Return singleton manager instance. |
| 44 static DialogSurfaceManager* Get(); |
| 45 |
| 46 using Config = DialogSurfaceHolder::Config; |
| 47 |
| 48 // Create a surface for renderer frame owned by renderer |pid|, and id |
| 49 // |render_frame_id|. May return null. |
| 50 std::unique_ptr<DialogSurfaceHolder> CreateSurface( |
| 51 const base::UnguessableToken& frame_token, |
| 52 const Config& config, |
| 53 const DialogSurfaceHolder::Callback& cb); |
| 54 |
| 55 protected: |
| 56 DialogSurfaceManager(); |
| 57 ~DialogSurfaceManager(); |
| 58 |
| 59 private: |
| 60 friend struct base::DefaultLazyInstanceTraits<DialogSurfaceManager>; |
| 61 |
| 62 // Java DialogSurfaceManagerWrapper instance. |
| 63 base::android::ScopedJavaGlobalRef<jobject> j_wrapped_manager_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(DialogSurfaceManager); |
| 66 }; |
| 67 |
| 68 } // namespace media |
| 69 |
| 70 #endif // MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ |
OLD | NEW |