| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Called after the ContentVideoView has been hidden because we're exiting | 37 // Called after the ContentVideoView has been hidden because we're exiting |
| 38 // fullscreen. | 38 // fullscreen. |
| 39 virtual void DidExitFullscreen(bool release_media_player) = 0; | 39 virtual void DidExitFullscreen(bool release_media_player) = 0; |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 ~Client() {} | 42 ~Client() {} |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(Client); | 44 DISALLOW_COPY_AND_ASSIGN(Client); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 explicit ContentVideoView(Client* client, ContentViewCore* content_view_core); | 47 explicit ContentVideoView(Client* client, |
| 48 ContentViewCore* content_view_core, |
| 49 const gfx::Size& video_natural_size); |
| 48 ~ContentVideoView(); | 50 ~ContentVideoView(); |
| 49 | 51 |
| 50 // To open another video on existing ContentVideoView. | 52 // To open another video on existing ContentVideoView. |
| 51 void OpenVideo(); | 53 void OpenVideo(); |
| 52 | 54 |
| 53 // Display an error dialog to the user. | 55 // Display an error dialog to the user. |
| 54 void OnMediaPlayerError(int error_type); | 56 void OnMediaPlayerError(int error_type); |
| 55 | 57 |
| 56 // Update the video size. The video will not be visible until this is called. | 58 // Update the video size. |
| 57 void OnVideoSizeChanged(int width, int height); | 59 void OnVideoSizeChanged(int width, int height); |
| 58 | 60 |
| 59 // Exit fullscreen and notify |client_| with |DidExitFullscreen|. | 61 // Exit fullscreen and notify |client_| with |DidExitFullscreen|. |
| 60 void ExitFullscreen(); | 62 void ExitFullscreen(); |
| 61 | 63 |
| 62 // Returns the corresponding ContentVideoView Java object if any. | 64 // Returns the corresponding ContentVideoView Java object if any. |
| 63 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(JNIEnv* env); | 65 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(JNIEnv* env); |
| 64 | 66 |
| 65 // Called by the Java class when the surface changes. | 67 // Called by the Java class when the surface changes. |
| 66 void SetSurface(JNIEnv* env, | 68 void SetSurface(JNIEnv* env, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 81 bool is_orientation_portrait); | 83 bool is_orientation_portrait); |
| 82 void RecordExitFullscreenPlayback( | 84 void RecordExitFullscreenPlayback( |
| 83 JNIEnv*, | 85 JNIEnv*, |
| 84 const base::android::JavaParamRef<jobject>&, | 86 const base::android::JavaParamRef<jobject>&, |
| 85 bool is_portrait_video, | 87 bool is_portrait_video, |
| 86 long playback_duration_in_milliseconds_before_orientation_change, | 88 long playback_duration_in_milliseconds_before_orientation_change, |
| 87 long playback_duration_in_milliseconds_after_orientation_change); | 89 long playback_duration_in_milliseconds_after_orientation_change); |
| 88 | 90 |
| 89 private: | 91 private: |
| 90 // Creates the corresponding ContentVideoView Java object. | 92 // Creates the corresponding ContentVideoView Java object. |
| 91 JavaObjectWeakGlobalRef CreateJavaObject(ContentViewCore* content_view_core); | 93 JavaObjectWeakGlobalRef CreateJavaObject(ContentViewCore* content_view_core, |
| 94 const gfx::Size& video_natural_size); |
| 92 | 95 |
| 93 Client* client_; | 96 Client* client_; |
| 94 | 97 |
| 95 // Weak reference to corresponding Java object. | 98 // Weak reference to corresponding Java object. |
| 96 JavaObjectWeakGlobalRef j_content_video_view_; | 99 JavaObjectWeakGlobalRef j_content_video_view_; |
| 97 | 100 |
| 98 // Weak pointer for posting tasks. | 101 // Weak pointer for posting tasks. |
| 99 base::WeakPtrFactory<ContentVideoView> weak_factory_; | 102 base::WeakPtrFactory<ContentVideoView> weak_factory_; |
| 100 | 103 |
| 101 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); | 104 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 } // namespace content | 107 } // namespace content |
| 105 | 108 |
| 106 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ | 109 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ |
| OLD | NEW |