Chromium Code Reviews| 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..2f32e20b1e44ab5d28bfe086a6cedf76dd8f65e0 |
| --- /dev/null |
| +++ b/media/base/android/dialog_surface_manager.h |
| @@ -0,0 +1,71 @@ |
| +// 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 { |
| + |
| +/** |
|
DaleCurtis
2016/07/27 18:14:20
Prefer //
liberato (no reviews please)
2016/07/28 15:33:30
Done.
|
| + * 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); |
| + * (wait for callback) |
| + * surface->GetSurface() |
| + * if (i_want_to_change_the_layout_) |
| + * surface->ScheduleLayout(new_position_and_size); |
| + * |
| + */ |
| +class MEDIA_EXPORT DialogSurfaceManager { |
| + public: |
| + static DialogSurfaceManager* GetPointer(); |
|
DaleCurtis
2016/07/27 18:14:20
Generally GetInstance or just Get().
liberato (no reviews please)
2016/07/28 15:33:30
LazyInstance uses Pointer() for T*, Get for T&. D
|
| + |
| + using Config = DialogSurface::Config; |
| + |
| + /** |
|
DaleCurtis
2016/07/27 18:14:20
Ditto. @param I don't think is used either in Chro
liberato (no reviews please)
2016/07/28 15:33:30
Done.
|
| + * @param pid pid of the renderer that this DialogSurface goes with |
| + * @param frame_id render_frame_id of the render frame that this goes with. |
| + */ |
| + std::unique_ptr<DialogSurface> CreateSurface(base::ProcessHandle pid, |
|
DaleCurtis
2016/07/27 18:14:20
Chromium doesn't typically elide parameter names,
liberato (no reviews please)
2016/07/28 15:33:30
Done.
|
| + int frame_id, |
| + const Config&, |
| + const DialogSurface::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_ |