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

Side by Side Diff: content/browser/android/content_video_view.h

Issue 157783004: Partial revert of "Restart fullscreen video playback when switching back from background" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 10 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
« no previous file with comments | « no previous file | content/browser/android/content_video_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 11 matching lines...) Expand all
22 class PowerSaveBlocker; 22 class PowerSaveBlocker;
23 23
24 // Native mirror of ContentVideoView.java. This class is responsible for 24 // Native mirror of ContentVideoView.java. This class is responsible for
25 // creating the Java video view and pass all the player status change to 25 // creating the Java video view and pass all the player status change to
26 // it. It accepts media control from Java class, and forwards it to 26 // it. It accepts media control from Java class, and forwards it to
27 // MediaPlayerManagerImpl. 27 // MediaPlayerManagerImpl.
28 class ContentVideoView { 28 class ContentVideoView {
29 public: 29 public:
30 // Construct a ContentVideoView object. The |manager| will handle all the 30 // Construct a ContentVideoView object. The |manager| will handle all the
31 // playback controls from the Java class. 31 // playback controls from the Java class.
32 ContentVideoView(
33 const base::android::ScopedJavaLocalRef<jobject>& context,
34 const base::android::ScopedJavaLocalRef<jobject>& client,
35 BrowserMediaPlayerManager* manager);
36
37 explicit ContentVideoView(BrowserMediaPlayerManager* manager); 32 explicit ContentVideoView(BrowserMediaPlayerManager* manager);
38 33
39 ~ContentVideoView(); 34 ~ContentVideoView();
40 35
41 // To open another video on existing ContentVideoView. 36 // To open another video on existing ContentVideoView.
42 void OpenVideo(); 37 void OpenVideo();
43 38
44 static bool RegisterContentVideoView(JNIEnv* env); 39 static bool RegisterContentVideoView(JNIEnv* env);
45 static void KeepScreenOn(bool screen_on); 40 static void KeepScreenOn(bool screen_on);
46 41
47 // Return the singleton object or NULL. 42 // Return the singleton object or NULL.
48 static ContentVideoView* GetInstance(); 43 static ContentVideoView* GetInstance();
49 44
50 // Getter method called by the Java class to get the media information. 45 // Getter method called by the Java class to get the media information.
51 int GetVideoWidth(JNIEnv*, jobject obj) const; 46 int GetVideoWidth(JNIEnv*, jobject obj) const;
52 int GetVideoHeight(JNIEnv*, jobject obj) const; 47 int GetVideoHeight(JNIEnv*, jobject obj) const;
53 int GetDurationInMilliSeconds(JNIEnv*, jobject obj) const; 48 int GetDurationInMilliSeconds(JNIEnv*, jobject obj) const;
54 int GetCurrentPosition(JNIEnv*, jobject obj) const; 49 int GetCurrentPosition(JNIEnv*, jobject obj) const;
55 bool IsPlaying(JNIEnv*, jobject obj); 50 bool IsPlaying(JNIEnv*, jobject obj);
56 void RequestMediaMetadata(JNIEnv*, jobject obj); 51 void RequestMediaMetadata(JNIEnv*, jobject obj);
57 52
58 // Called when the Java fullscreen view is destroyed. If 53 // Called when the Java fullscreen view is destroyed. If
59 // |release_media_player| is true, |manager_| needs to release the player 54 // |release_media_player| is true, |manager_| needs to release the player
60 // as we are quitting the app. 55 // as we are quitting the app.
61 void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player); 56 void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player);
62 57
63 // Supposed to be called when the application paused or stopped.
64 // Destroys the fullscreen view in a way that it can be recreated
65 // via ResumeFullscreenIfSuspended.
66 void SuspendFullscreen();
67
68 // Supposed to be called when the application switches back to foreground.
69 // Recreates the fullscreen view if it was suspended via SuspendFullscreen.
70 void ResumeFullscreenIfSuspended();
71
72 // Media control method called by the Java class. 58 // Media control method called by the Java class.
73 void SeekTo(JNIEnv*, jobject obj, jint msec); 59 void SeekTo(JNIEnv*, jobject obj, jint msec);
74 void Play(JNIEnv*, jobject obj); 60 void Play(JNIEnv*, jobject obj);
75 void Pause(JNIEnv*, jobject obj); 61 void Pause(JNIEnv*, jobject obj);
76 62
77 // Called by the Java class to pass the surface object to the player. 63 // Called by the Java class to pass the surface object to the player.
78 void SetSurface(JNIEnv*, jobject obj, jobject surface); 64 void SetSurface(JNIEnv*, jobject obj, jobject surface);
79 65
80 // Method called by |manager_| to inform the Java class about player status 66 // Method called by |manager_| to inform the Java class about player status
81 // change. 67 // change.
(...skipping 28 matching lines...) Expand all
110 // There is already blocker when inline video started, and it requires the 96 // There is already blocker when inline video started, and it requires the
111 // ContentView's container displayed to take effect; but in WebView, apps 97 // ContentView's container displayed to take effect; but in WebView, apps
112 // could use another container to hold ContentVideoView, and the blocker in 98 // could use another container to hold ContentVideoView, and the blocker in
113 // ContentView's container can not keep screen on; so we need another blocker 99 // ContentView's container can not keep screen on; so we need another blocker
114 // here, it is no harm, just an additonal blocker. 100 // here, it is no harm, just an additonal blocker.
115 scoped_ptr<PowerSaveBlocker> power_save_blocker_; 101 scoped_ptr<PowerSaveBlocker> power_save_blocker_;
116 102
117 // Weak reference of corresponding Java object. 103 // Weak reference of corresponding Java object.
118 JavaObjectWeakGlobalRef j_content_video_view_; 104 JavaObjectWeakGlobalRef j_content_video_view_;
119 105
120 enum FullscreenState {
121 ENTERED,
122 SUSPENDED,
123 RESUME
124 } fullscreen_state_;
125
126 // Weak pointer for posting tasks. 106 // Weak pointer for posting tasks.
127 base::WeakPtrFactory<ContentVideoView> weak_factory_; 107 base::WeakPtrFactory<ContentVideoView> weak_factory_;
128 108
129 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); 109 DISALLOW_COPY_AND_ASSIGN(ContentVideoView);
130 }; 110 };
131 111
132 } // namespace content 112 } // namespace content
133 113
134 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ 114 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/content_video_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698