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..cbcc4395143d5a8cdd04c11c9e883f5a752af84e |
--- /dev/null |
+++ b/media/base/android/dialog_surface_manager.h |
@@ -0,0 +1,65 @@ |
+// 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/time/time.h" |
+#include "media/base/android/dialog_surface_controller.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 DialogSurfaceController::Callback; |
+ * controller = DialogSurfaceManager::GetPointer()->CreateSurface(callback); |
+ * (wait for callback) |
+ * controller->GetSurface() |
+ * if (i_want_to_change_the_layout_) |
+ * controller->ScheduleLayout(new_position_and_size); |
+ * |
+ */ |
+class MEDIA_EXPORT DialogSurfaceManager { |
+ public: |
+ static DialogSurfaceManager* GetPointer(); |
+ |
+ using Config = DialogSurfaceController::Config; |
+ |
+ std::unique_ptr<DialogSurfaceController> CreateSurface( |
+ const Config&, |
+ const DialogSurfaceController::Callback&); |
+ |
+ 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_ |