Chromium Code Reviews| 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 // This class implements the C++ wrapper around the java DialogSurfaceManager. | |
| 28 // Typical usage is: | |
| 29 // | |
| 30 // callback = something that is a DialogSurface::Callback; | |
| 31 // surface = DialogSurfaceManager::GetPointer()->CreateSurface(callback); | |
|
Tima Vaisburd
2016/08/03 18:05:13
What is the type of |surface|? DialogSurface?
liberato (no reviews please)
2016/08/03 23:11:55
DialogSurface*, updated comment.
| |
| 32 // (wait for callback) | |
| 33 // surface->GetSurface() | |
|
Tima Vaisburd
2016/08/03 18:05:13
void Surface::GetSurface() on the surface object t
Tima Vaisburd
2016/08/03 18:28:22
After rereading the doc: I think in the doc Create
liberato (no reviews please)
2016/08/03 23:11:55
it returns the android surface. probably clearer
liberato (no reviews please)
2016/08/03 23:11:55
not sure what you mean -- it's async here too. in
Tima Vaisburd
2016/08/04 00:21:09
Ah, the DialogSurface is not a Surface...
So, as f
| |
| 34 // if (i_want_to_change_the_layout_) | |
| 35 // surface->ScheduleLayout(new_position_and_size); | |
| 36 class MEDIA_EXPORT DialogSurfaceManager { | |
| 37 public: | |
| 38 // Return singleton manager instance. | |
| 39 static DialogSurfaceManager& Get(); | |
| 40 | |
| 41 using Config = DialogSurface::Config; | |
| 42 | |
| 43 // Create a surface for renderer frame owned by renderer |pid|, and id | |
| 44 // |render_frame_id|. May return null. | |
| 45 std::unique_ptr<DialogSurface> CreateSurface( | |
| 46 base::ProcessHandle pid, | |
| 47 int render_frame_id, | |
| 48 const Config& config, | |
| 49 const DialogSurface::Callback& cb); | |
| 50 | |
| 51 static bool RegisterDialogSurfaceManager(JNIEnv* env); | |
| 52 | |
| 53 protected: | |
| 54 DialogSurfaceManager(); | |
| 55 ~DialogSurfaceManager(); | |
| 56 | |
| 57 private: | |
| 58 friend struct base::DefaultLazyInstanceTraits<DialogSurfaceManager>; | |
| 59 | |
| 60 // Java DialogSurfaceManagerWrapper instance. | |
| 61 base::android::ScopedJavaGlobalRef<jobject> j_wrapped_manager_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(DialogSurfaceManager); | |
| 64 }; | |
| 65 | |
| 66 } // namespace media | |
| 67 | |
| 68 #endif // MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ | |
| OLD | NEW |