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

Side by Side Diff: components/external_video_surface/browser/android/external_video_surface_container_impl.h

Issue 1123993002: Componentizes external_video_surface to reduce webview/Cast duplication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: java DEPS, round 2 Created 5 years, 7 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ 5 #ifndef COMPONENTS_EXTERNAL_VIDEO_SURFACE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_ H_
6 #define ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ 6 #define COMPONENTS_EXTERNAL_VIDEO_SURFACE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_ H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h"
13 #include "content/public/browser/android/external_video_surface_container.h" 14 #include "content/public/browser/android/external_video_surface_container.h"
14 15
15 namespace android_webview { 16 namespace external_video_surface {
16 17
17 class ExternalVideoSurfaceContainerImpl 18 class ExternalVideoSurfaceContainerImpl
18 : public content::ExternalVideoSurfaceContainer { 19 : public content::ExternalVideoSurfaceContainer {
19 public: 20 public:
21 static bool RegisterJni(JNIEnv* env);
22
20 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; 23 typedef base::Callback<void(int, jobject)> SurfaceCreatedCB;
21 typedef base::Callback<void(int)> SurfaceDestroyedCB; 24 typedef base::Callback<void(int)> SurfaceDestroyedCB;
22 25
23 static ExternalVideoSurfaceContainerImpl* Create( 26 static ExternalVideoSurfaceContainerImpl* Create(
24 content::WebContents* web_contents); 27 content::WebContents* web_contents);
25 28
26 // ExternalVideoSurfaceContainer implementation. 29 // content::ExternalVideoSurfaceContainer implementation.
27 void RequestExternalVideoSurface( 30 void RequestExternalVideoSurface(
28 int player_id, 31 int player_id,
29 const SurfaceCreatedCB& surface_created_cb, 32 const SurfaceCreatedCB& surface_created_cb,
30 const SurfaceDestroyedCB& surface_destroyed_cb) override; 33 const SurfaceDestroyedCB& surface_destroyed_cb) override;
31 int GetCurrentPlayerId() override; 34 int GetCurrentPlayerId() override;
32 void ReleaseExternalVideoSurface(int player_id) override; 35 void ReleaseExternalVideoSurface(int player_id) override;
33 void OnFrameInfoUpdated() override; 36 void OnFrameInfoUpdated() override;
34 void OnExternalVideoSurfacePositionChanged(int player_id, 37 void OnExternalVideoSurfacePositionChanged(int player_id,
35 const gfx::RectF& rect) override; 38 const gfx::RectF& rect) override;
36 39
37 // Methods called from Java. 40 // Methods called from Java.
38 void SurfaceCreated( 41 void SurfaceCreated(
39 JNIEnv* env, jobject obj, jint player_id, jobject jsurface); 42 JNIEnv* env, jobject obj, jint player_id, jobject jsurface);
40 void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id); 43 void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id);
41 44
42 private: 45 private:
43 explicit ExternalVideoSurfaceContainerImpl( 46 explicit ExternalVideoSurfaceContainerImpl(
44 base::android::ScopedJavaLocalRef<jobject> java_content_view_core); 47 base::android::ScopedJavaLocalRef<jobject> java_content_view_core);
45 ~ExternalVideoSurfaceContainerImpl() override; 48 ~ExternalVideoSurfaceContainerImpl() override;
46 49
47 base::android::ScopedJavaGlobalRef<jobject> jobject_; 50 base::android::ScopedJavaGlobalRef<jobject> jobject_;
48 51
49 SurfaceCreatedCB surface_created_cb_; 52 SurfaceCreatedCB surface_created_cb_;
50 SurfaceDestroyedCB surface_destroyed_cb_; 53 SurfaceDestroyedCB surface_destroyed_cb_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl); 55 DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl);
53 }; 56 };
54 57
55 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env); 58 } // namespace external_video_surface
56 59
57 } // namespace android_webview 60 #endif // COMPONENTS_EXTERNAL_VIDEO_SURFACE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IM PL_H_
58
59 #endif // ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698