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..4013c77121e7aac0b28dbf221f98a2c59fa014e9 |
--- /dev/null |
+++ b/media/base/android/dialog_surface_manager.h |
@@ -0,0 +1,70 @@ |
+// 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_holder.h" |
+#include "media/base/media_export.h" |
+#include "ui/gfx/geometry/point.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace base { |
+class UnguessableToken; |
+} |
+ |
+namespace media { |
+ |
+// This class implements the C++ wrapper around the java DialogSurfaceManager. |
+// Typical usage is: |
+// |
+// callback = something that is a DialogSurface::Callback; |
+// unique_ptr<DialogSurfaceHolder> holder = DialogSurfaceManager::GetPointer()-> |
+// CreateSurface(callback); |
+// (wait for callback) |
+// holder->GetSurface() |
+// if (i_want_to_change_the_layout_) |
+// holder->ScheduleLayout(new_position_and_size); |
+class MEDIA_EXPORT DialogSurfaceManager { |
+ public: |
+ // Return singleton manager instance. |
+ static DialogSurfaceManager* Get(); |
+ |
+ using Config = DialogSurfaceHolder::Config; |
+ |
+ // Create a surface for renderer frame owned by renderer |pid|, and id |
+ // |render_frame_id|. May return null. |
+ std::unique_ptr<DialogSurfaceHolder> CreateSurface( |
+ const base::UnguessableToken& frame_token, |
+ const Config& config, |
+ const DialogSurfaceHolder::Callback& cb); |
+ |
+ 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_ |