Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / android_webview / native / external_video_surface_container_impl.h
blob4d34f83e44bb3f27b67b4702fbbb13cfde2d5756
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
6 #define ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "content/public/browser/android/external_video_surface_container.h"
15 namespace android_webview {
17 class ExternalVideoSurfaceContainerImpl
18 : public content::ExternalVideoSurfaceContainer {
19 public:
20 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB;
21 typedef base::Callback<void(int)> SurfaceDestroyedCB;
23 ExternalVideoSurfaceContainerImpl(content::WebContents* contents);
25 // ExternalVideoSurfaceContainer implementation.
26 virtual void RequestExternalVideoSurface(
27 int player_id,
28 const SurfaceCreatedCB& surface_created_cb,
29 const SurfaceDestroyedCB& surface_destroyed_cb) OVERRIDE;
30 virtual void ReleaseExternalVideoSurface(int player_id) OVERRIDE;
31 virtual void OnFrameInfoUpdated() OVERRIDE;
32 virtual void OnExternalVideoSurfacePositionChanged(
33 int player_id, const gfx::RectF& rect) OVERRIDE;
35 // Methods called from Java.
36 void SurfaceCreated(
37 JNIEnv* env, jobject obj, jint player_id, jobject jsurface);
38 void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id);
40 private:
41 virtual ~ExternalVideoSurfaceContainerImpl();
43 base::android::ScopedJavaGlobalRef<jobject> jobject_;
45 SurfaceCreatedCB surface_created_cb_;
46 SurfaceDestroyedCB surface_destroyed_cb_;
48 DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl);
51 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env);
53 } // namespace android_webview
55 #endif // ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_