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

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

Issue 1489453003: jni: Pass method parameters as JavaParamRef in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
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_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
(...skipping 23 matching lines...) Expand all
34 // To open another video on existing ContentVideoView. 34 // To open another video on existing ContentVideoView.
35 void OpenVideo(); 35 void OpenVideo();
36 36
37 static bool RegisterContentVideoView(JNIEnv* env); 37 static bool RegisterContentVideoView(JNIEnv* env);
38 static void KeepScreenOn(bool screen_on); 38 static void KeepScreenOn(bool screen_on);
39 39
40 // Return the singleton object or NULL. 40 // Return the singleton object or NULL.
41 static ContentVideoView* GetInstance(); 41 static ContentVideoView* GetInstance();
42 42
43 // Getter method called by the Java class to get the media information. 43 // Getter method called by the Java class to get the media information.
44 bool IsPlaying(JNIEnv*, jobject obj); 44 bool IsPlaying(JNIEnv*, const base::android::JavaParamRef<jobject>& obj);
45 void RequestMediaMetadata(JNIEnv*, jobject obj); 45 void RequestMediaMetadata(JNIEnv*,
46 const base::android::JavaParamRef<jobject>& obj);
46 47
47 // Called when the Java fullscreen view is destroyed. If 48 // Called when the Java fullscreen view is destroyed. If
48 // |release_media_player| is true, |manager_| needs to release the player 49 // |release_media_player| is true, |manager_| needs to release the player
49 // as we are quitting the app. 50 // as we are quitting the app.
50 void ExitFullscreen(JNIEnv*, jobject, jboolean release_media_player); 51 void ExitFullscreen(JNIEnv*,
52 const base::android::JavaParamRef<jobject>&,
53 jboolean release_media_player);
51 54
52 // Called by the Java class to pass the surface object to the player. 55 // Called by the Java class to pass the surface object to the player.
53 void SetSurface(JNIEnv*, jobject obj, jobject surface); 56 void SetSurface(JNIEnv*,
57 const base::android::JavaParamRef<jobject>& obj,
58 const base::android::JavaParamRef<jobject>& surface);
54 59
55 // Method called by |manager_| to inform the Java class about player status 60 // Method called by |manager_| to inform the Java class about player status
56 // change. 61 // change.
57 void UpdateMediaMetadata(); 62 void UpdateMediaMetadata();
58 void OnMediaPlayerError(int errorType); 63 void OnMediaPlayerError(int errorType);
59 void OnVideoSizeChanged(int width, int height); 64 void OnVideoSizeChanged(int width, int height);
60 void OnBufferingUpdate(int percent); 65 void OnBufferingUpdate(int percent);
61 void OnPlaybackComplete(); 66 void OnPlaybackComplete();
62 void OnExitFullscreen(); 67 void OnExitFullscreen();
63 68
64 // Functions called to record fullscreen playback UMA metrics. 69 // Functions called to record fullscreen playback UMA metrics.
65 void RecordFullscreenPlayback( 70 void RecordFullscreenPlayback(JNIEnv*,
66 JNIEnv*, jobject, bool is_portrait_video, bool is_orientation_portrait); 71 const base::android::JavaParamRef<jobject>&,
72 bool is_portrait_video,
73 bool is_orientation_portrait);
67 void RecordExitFullscreenPlayback( 74 void RecordExitFullscreenPlayback(
68 JNIEnv*, jobject, bool is_portrait_video, 75 JNIEnv*,
76 const base::android::JavaParamRef<jobject>&,
77 bool is_portrait_video,
69 long playback_duration_in_milliseconds_before_orientation_change, 78 long playback_duration_in_milliseconds_before_orientation_change,
70 long playback_duration_in_milliseconds_after_orientation_change); 79 long playback_duration_in_milliseconds_after_orientation_change);
71 80
72 // Return the corresponing ContentVideoView Java object if any. 81 // Return the corresponing ContentVideoView Java object if any.
73 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(JNIEnv* env); 82 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(JNIEnv* env);
74 83
75 private: 84 private:
76 // Creates the corresponding ContentVideoView Java object. 85 // Creates the corresponding ContentVideoView Java object.
77 JavaObjectWeakGlobalRef CreateJavaObject(); 86 JavaObjectWeakGlobalRef CreateJavaObject();
78 87
79 // Object that manages the fullscreen media player. It is responsible for 88 // Object that manages the fullscreen media player. It is responsible for
80 // handling all the playback controls. 89 // handling all the playback controls.
81 BrowserMediaPlayerManager* manager_; 90 BrowserMediaPlayerManager* manager_;
82 91
83 // Weak reference of corresponding Java object. 92 // Weak reference of corresponding Java object.
84 JavaObjectWeakGlobalRef j_content_video_view_; 93 JavaObjectWeakGlobalRef j_content_video_view_;
85 94
86 // Weak pointer for posting tasks. 95 // Weak pointer for posting tasks.
87 base::WeakPtrFactory<ContentVideoView> weak_factory_; 96 base::WeakPtrFactory<ContentVideoView> weak_factory_;
88 97
89 DISALLOW_COPY_AND_ASSIGN(ContentVideoView); 98 DISALLOW_COPY_AND_ASSIGN(ContentVideoView);
90 }; 99 };
91 100
92 } // namespace content 101 } // namespace content
93 102
94 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_ 103 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIDEO_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698