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 // unique_ptr<DialogSurface> surface = DialogSurfaceManager::GetPointer()-> | |
32 // CreateSurface(callback); | |
33 // (wait for callback) | |
34 // surface->GetSurface() | |
35 // if (i_want_to_change_the_layout_) | |
36 // surface->ScheduleLayout(new_position_and_size); | |
37 class MEDIA_EXPORT DialogSurfaceManager { | |
38 public: | |
39 // Return singleton manager instance. | |
40 static DialogSurfaceManager& Get(); | |
DaleCurtis
2016/08/04 00:20:36
I think it's fine to have this named Get() but ret
liberato (no reviews please)
2016/08/04 01:06:20
Done.
| |
41 | |
42 using Config = DialogSurface::Config; | |
43 | |
44 // Create a surface for renderer frame owned by renderer |pid|, and id | |
45 // |render_frame_id|. May return null. | |
46 std::unique_ptr<DialogSurface> CreateSurface( | |
47 base::ProcessHandle pid, | |
48 int render_frame_id, | |
49 const Config& config, | |
50 const DialogSurface::Callback& cb); | |
51 | |
52 static bool RegisterDialogSurfaceManager(JNIEnv* env); | |
DaleCurtis
2016/08/04 00:20:36
sievers@ removed a lot of these recently, are they
liberato (no reviews please)
2016/08/04 01:06:20
thanks! i didn't realize that. they're now only
| |
53 | |
54 protected: | |
55 DialogSurfaceManager(); | |
56 ~DialogSurfaceManager(); | |
57 | |
58 private: | |
59 friend struct base::DefaultLazyInstanceTraits<DialogSurfaceManager>; | |
60 | |
61 // Java DialogSurfaceManagerWrapper instance. | |
62 base::android::ScopedJavaGlobalRef<jobject> j_wrapped_manager_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(DialogSurfaceManager); | |
65 }; | |
66 | |
67 } // namespace media | |
68 | |
69 #endif // MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ | |
OLD | NEW |