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

Unified Diff: content/browser/android/content_video_view.h

Issue 103583005: Restart fullscreen video playback when switching back from background (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle everything at browser side Created 7 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: content/browser/android/content_video_view.h
diff --git a/content/browser/android/content_video_view.h b/content/browser/android/content_video_view.h
index 2a86830def3b16ce053d09ae46b8506c7e188e13..a9b0a2e90fa761192d6582c19dadea9e05afdf09 100644
--- a/content/browser/android/content_video_view.h
+++ b/content/browser/android/content_video_view.h
@@ -17,6 +17,7 @@
namespace content {
class BrowserMediaPlayerManager;
+class ContentViewCoreImpl;
// Native mirror of ContentVideoView.java. This class is responsible for
// creating the Java video view and pass all the player status change to
@@ -31,6 +32,8 @@ class ContentVideoView {
const base::android::ScopedJavaLocalRef<jobject>& client,
BrowserMediaPlayerManager* manager);
+ ContentVideoView(BrowserMediaPlayerManager* manager);
+
~ContentVideoView();
// To open another video on existing ContentVideoView.
@@ -39,8 +42,8 @@ class ContentVideoView {
static bool RegisterContentVideoView(JNIEnv* env);
static void KeepScreenOn(bool screen_on);
- // Return true if there is existing ContentVideoView object.
- static bool HasContentVideoView();
+ // Return the singleton object or NULL.
+ static ContentVideoView* GetInstance();
// Getter method called by the Java class to get the media information.
int GetVideoWidth(JNIEnv*, jobject obj) const;
@@ -55,6 +58,15 @@ class ContentVideoView {
// as we are quitting the app.
void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player);
+ // Supposed to be called when the application paused or stopped.
+ // Destroys the fullscreen view in a way that it can be recreated
+ // via ResumeFullscreenIfSuspended.
+ void SuspendFullscreen();
+
+ // Supposed to be called when the application switches back to foreground.
+ // Recreates the fullscreen view if it was suspended via SuspendFullscreen.
+ void ResumeFullscreenIfSuspended();
+
// Media control method called by the Java class.
void SeekTo(JNIEnv*, jobject obj, jint msec);
void Play(JNIEnv*, jobject obj);
@@ -75,6 +87,10 @@ class ContentVideoView {
// Return the corresponing ContentVideoView Java object if any.
base::android::ScopedJavaLocalRef<jobject> GetJavaObject(JNIEnv* env);
+ // Creates the corresponding ContentVideoView Java object.
+ JavaObjectWeakGlobalRef CreateJavaObject(
+ ContentViewCoreImpl* content_view_core);
qinmin 2013/12/18 02:09:46 no need for the input param, you can get that from
+
private:
// Destroy the |j_content_video_view_|. If |native_view_destroyed| is true,
// no further calls to the native object is allowed.
@@ -87,6 +103,12 @@ class ContentVideoView {
// Weak reference of corresponding Java object.
JavaObjectWeakGlobalRef j_content_video_view_;
+ enum FullscreenState {
+ Entered,
+ Suspend,
+ Resume
+ } fullscreen_state_;
+
DISALLOW_COPY_AND_ASSIGN(ContentVideoView);
};
« no previous file with comments | « no previous file | content/browser/android/content_video_view.cc » ('j') | content/browser/android/content_video_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698