#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
+#include "ui/gfx/native_widget_types.h"
namespace content {
class BrowserMediaPlayerManager;
+class PowerSaveBlocker;
// Native mirror of ContentVideoView.java. This class is responsible for
// creating the Java video view and pass all the player status change to
public:
// Construct a ContentVideoView object. The |manager| will handle all the
// playback controls from the Java class.
- ContentVideoView(
- const base::android::ScopedJavaLocalRef<jobject>& context,
- const base::android::ScopedJavaLocalRef<jobject>& client,
- BrowserMediaPlayerManager* manager);
-
explicit ContentVideoView(BrowserMediaPlayerManager* manager);
~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);
// Creates the corresponding ContentVideoView Java object.
JavaObjectWeakGlobalRef CreateJavaObject();
+ // Returns the associated NativeView
+ gfx::NativeView GetNativeView();
+
+ void CreatePowerSaveBlocker();
+
// Object that manages the fullscreen media player. It is responsible for
// handling all the playback controls.
BrowserMediaPlayerManager* manager_;
+ // PowerSaveBlock to keep screen on for fullscreen video.
+ // There is already blocker when inline video started, and it requires the
+ // ContentView's container displayed to take effect; but in WebView, apps
+ // could use another container to hold ContentVideoView, and the blocker in
+ // ContentView's container can not keep screen on; so we need another blocker
+ // here, it is no harm, just an additonal blocker.
+ scoped_ptr<PowerSaveBlocker> power_save_blocker_;
+
// Weak reference of corresponding Java object.
JavaObjectWeakGlobalRef j_content_video_view_;
- enum FullscreenState {
- ENTERED,
- SUSPENDED,
- RESUME
- } fullscreen_state_;
-
// Weak pointer for posting tasks.
base::WeakPtrFactory<ContentVideoView> weak_factory_;