Chromium Code Reviews| 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_helper.h" | 10 #include "base/android/jni_helper.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | |
| 15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class BrowserMediaPlayerManager; | 20 class BrowserMediaPlayerManager; |
| 20 | 21 |
| 21 // Native mirror of ContentVideoView.java. This class is responsible for | 22 // Native mirror of ContentVideoView.java. This class is responsible for |
| 22 // creating the Java video view and pass all the player status change to | 23 // creating the Java video view and pass all the player status change to |
| 23 // it. It accepts media control from Java class, and forwards it to | 24 // it. It accepts media control from Java class, and forwards it to |
| 24 // MediaPlayerManagerImpl. | 25 // MediaPlayerManagerImpl. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 43 | 44 |
| 44 // Return the singleton object or NULL. | 45 // Return the singleton object or NULL. |
| 45 static ContentVideoView* GetInstance(); | 46 static ContentVideoView* GetInstance(); |
| 46 | 47 |
| 47 // Getter method called by the Java class to get the media information. | 48 // Getter method called by the Java class to get the media information. |
| 48 int GetVideoWidth(JNIEnv*, jobject obj) const; | 49 int GetVideoWidth(JNIEnv*, jobject obj) const; |
| 49 int GetVideoHeight(JNIEnv*, jobject obj) const; | 50 int GetVideoHeight(JNIEnv*, jobject obj) const; |
| 50 int GetDurationInMilliSeconds(JNIEnv*, jobject obj) const; | 51 int GetDurationInMilliSeconds(JNIEnv*, jobject obj) const; |
| 51 int GetCurrentPosition(JNIEnv*, jobject obj) const; | 52 int GetCurrentPosition(JNIEnv*, jobject obj) const; |
| 52 bool IsPlaying(JNIEnv*, jobject obj); | 53 bool IsPlaying(JNIEnv*, jobject obj); |
| 53 void UpdateMediaMetadata(JNIEnv*, jobject obj); | 54 void RequestMediaMetadata(JNIEnv*, jobject obj); |
| 54 | 55 |
| 55 // Called when the Java fullscreen view is destroyed. If | 56 // Called when the Java fullscreen view is destroyed. If |
| 56 // |release_media_player| is true, |manager_| needs to release the player | 57 // |release_media_player| is true, |manager_| needs to release the player |
| 57 // as we are quitting the app. | 58 // as we are quitting the app. |
| 58 void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player); | 59 void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player); |
| 59 | 60 |
| 60 // Supposed to be called when the application paused or stopped. | 61 // Supposed to be called when the application paused or stopped. |
| 61 // Destroys the fullscreen view in a way that it can be recreated | 62 // Destroys the fullscreen view in a way that it can be recreated |
| 62 // via ResumeFullscreenIfSuspended. | 63 // via ResumeFullscreenIfSuspended. |
| 63 void SuspendFullscreen(); | 64 void SuspendFullscreen(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 101 |
| 101 // Weak reference of corresponding Java object. | 102 // Weak reference of corresponding Java object. |
| 102 JavaObjectWeakGlobalRef j_content_video_view_; | 103 JavaObjectWeakGlobalRef j_content_video_view_; |
| 103 | 104 |
| 104 enum FullscreenState { | 105 enum FullscreenState { |
| 105 ENTERED, | 106 ENTERED, |
| 106 SUSPENDED, | 107 SUSPENDED, |
| 107 RESUME | 108 RESUME |
| 108 } fullscreen_state_; | 109 } fullscreen_state_; |
| 109 | 110 |
| 111 // Weak pointer for posting tasks. | |
| 112 base::WeakPtrFactory<ContentVideoView> weak_this_; | |
|
Ted C
2014/01/16 21:45:08
weak_factory_ is much more common (~452 occurrence
| |
| 113 | |
| 110 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); | 114 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 } // namespace content | 117 } // namespace content |
| 114 | 118 |
| 115 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ | 119 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ |
| OLD | NEW |