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.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 /** |
| 28 * This class implements the C++ wrapper around the java DialogSurfaceManager. |
| 29 * Typical usage is: |
| 30 * |
| 31 * callback = something that is a DialogSurface::Callback; |
| 32 * controller = DialogSurfaceManager::GetPointer()->CreateSurface(callback); |
| 33 * (wait for callback) |
| 34 * controller->GetSurface() |
| 35 * if (i_want_to_change_the_layout_) |
| 36 * controller->ScheduleLayout(new_position_and_size); |
| 37 * |
| 38 */ |
| 39 class MEDIA_EXPORT DialogSurfaceManager { |
| 40 public: |
| 41 static DialogSurfaceManager* GetPointer(); |
| 42 |
| 43 using Config = DialogSurface::Config; |
| 44 |
| 45 std::unique_ptr<DialogSurface> CreateSurface(base::ProcessHandle pid, |
| 46 int frame_id, |
| 47 const Config&, |
| 48 const DialogSurface::Callback&); |
| 49 |
| 50 static bool RegisterDialogSurfaceManager(JNIEnv* env); |
| 51 |
| 52 protected: |
| 53 DialogSurfaceManager(); |
| 54 ~DialogSurfaceManager(); |
| 55 |
| 56 private: |
| 57 friend struct base::DefaultLazyInstanceTraits<DialogSurfaceManager>; |
| 58 |
| 59 // Java DialogSurfaceManagerWrapper instance. |
| 60 base::android::ScopedJavaGlobalRef<jobject> j_wrapped_manager_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(DialogSurfaceManager); |
| 63 }; |
| 64 |
| 65 } // namespace media |
| 66 |
| 67 #endif // MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ |
OLD | NEW |