Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: media/base/android/dialog_surface_manager.h

Issue 2178973004: DialogSurfaceManager implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed IDialogSurfaceActivityMapper from common.aidl Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..730fa16188e6a80bc68e3910951dd6901b9763ef
--- /dev/null
+++ b/media/base/android/dialog_surface_manager.h
@@ -0,0 +1,67 @@
+// 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;
+// unique_ptr<DialogSurface> 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:
+ // 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);
+
+ 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.
+ 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_

Powered by Google App Engine
This is Rietveld 408576698