Index: media/base/android/dialog_surface_manager.h |
diff --git a/media/base/android/dialog_surface_manager.h b/media/base/android/dialog_surface_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5b1501c9bd9cbce8beb0c2b02ccf1ed6b68edcda |
--- /dev/null |
+++ b/media/base/android/dialog_surface_manager.h |
@@ -0,0 +1,68 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ |
+#define MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ |
+ |
+#include <jni.h> |
+#include <stddef.h> |
+#include <stdint.h> |
+ |
+#include <set> |
+#include <string> |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "base/lazy_instance.h" |
+#include "base/macros.h" |
+#include "base/process/process_handle.h" |
+#include "base/time/time.h" |
+#include "media/base/android/dialog_surface.h" |
+#include "media/base/media_export.h" |
+#include "ui/gfx/geometry/point.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace media { |
+ |
+// This class implements the C++ wrapper around the java DialogSurfaceManager. |
+// Typical usage is: |
+// |
+// callback = something that is a DialogSurface::Callback; |
+// 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.
|
+// (wait for callback) |
+// 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
|
+// if (i_want_to_change_the_layout_) |
+// surface->ScheduleLayout(new_position_and_size); |
+class MEDIA_EXPORT DialogSurfaceManager { |
+ public: |
+ // Return singleton manager instance. |
+ static DialogSurfaceManager& Get(); |
+ |
+ using Config = DialogSurface::Config; |
+ |
+ // Create a surface for renderer frame owned by renderer |pid|, and id |
+ // |render_frame_id|. May return null. |
+ std::unique_ptr<DialogSurface> CreateSurface( |
+ base::ProcessHandle pid, |
+ int render_frame_id, |
+ const Config& config, |
+ const DialogSurface::Callback& cb); |
+ |
+ static bool RegisterDialogSurfaceManager(JNIEnv* env); |
+ |
+ protected: |
+ DialogSurfaceManager(); |
+ ~DialogSurfaceManager(); |
+ |
+ private: |
+ friend struct base::DefaultLazyInstanceTraits<DialogSurfaceManager>; |
+ |
+ // Java DialogSurfaceManagerWrapper instance. |
+ base::android::ScopedJavaGlobalRef<jobject> j_wrapped_manager_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DialogSurfaceManager); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_ANDROID_DIALOG_SURFACE_MANAGER_H_ |