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(); | |
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 protected: | |
boliu
2017/01/04 01:48:44
why protected? is there a subclass? (in which case
liberato (no reviews please)
2017/01/11 22:17:57
no subclass. private, done.
| |
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 |