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

Side by Side Diff: media/base/android/media_player_bridge.h

Issue 408873004: Fix for cross-origin video check for webgl on android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pass allow_credentials to android mediaplayer Created 6 years, 5 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 | Annotate | Revision Log
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 MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // decoding. MediaPlayerBridge also forwards Android MediaPlayer callbacks to 43 // decoding. MediaPlayerBridge also forwards Android MediaPlayer callbacks to
44 // the |manager| when needed. 44 // the |manager| when needed.
45 MediaPlayerBridge(int player_id, 45 MediaPlayerBridge(int player_id,
46 const GURL& url, 46 const GURL& url,
47 const GURL& first_party_for_cookies, 47 const GURL& first_party_for_cookies,
48 const std::string& user_agent, 48 const std::string& user_agent,
49 bool hide_url_log, 49 bool hide_url_log,
50 MediaPlayerManager* manager, 50 MediaPlayerManager* manager,
51 const RequestMediaResourcesCB& request_media_resources_cb, 51 const RequestMediaResourcesCB& request_media_resources_cb,
52 const ReleaseMediaResourcesCB& release_media_resources_cb, 52 const ReleaseMediaResourcesCB& release_media_resources_cb,
53 const GURL& frame_url); 53 const GURL& frame_url,
54 bool has_single_security_origin,
55 bool allow_credentials);
54 virtual ~MediaPlayerBridge(); 56 virtual ~MediaPlayerBridge();
55 57
56 // Initialize this object and extract the metadata from the media. 58 // Initialize this object and extract the metadata from the media.
57 virtual void Initialize(); 59 virtual void Initialize();
58 60
59 // MediaPlayerAndroid implementation. 61 // MediaPlayerAndroid implementation.
60 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE; 62 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE;
61 virtual void Start() OVERRIDE; 63 virtual void Start() OVERRIDE;
62 virtual void Pause(bool is_media_related_action ALLOW_UNUSED) OVERRIDE; 64 virtual void Pause(bool is_media_related_action ALLOW_UNUSED) OVERRIDE;
63 virtual void SeekTo(base::TimeDelta timestamp) OVERRIDE; 65 virtual void SeekTo(base::TimeDelta timestamp) OVERRIDE;
(...skipping 14 matching lines...) Expand all
78 80
79 // MediaPlayerListener callbacks. 81 // MediaPlayerListener callbacks.
80 void OnVideoSizeChanged(int width, int height); 82 void OnVideoSizeChanged(int width, int height);
81 void OnMediaError(int error_type); 83 void OnMediaError(int error_type);
82 void OnBufferingUpdate(int percent); 84 void OnBufferingUpdate(int percent);
83 void OnPlaybackComplete(); 85 void OnPlaybackComplete();
84 void OnMediaInterrupted(); 86 void OnMediaInterrupted();
85 void OnSeekComplete(); 87 void OnSeekComplete();
86 void OnDidSetDataUriDataSource(JNIEnv* env, jobject obj, jboolean success); 88 void OnDidSetDataUriDataSource(JNIEnv* env, jobject obj, jboolean success);
87 89
90 virtual bool has_single_security_origin() const OVERRIDE {
91 return has_single_security_origin_;
92 }
93 virtual bool allow_credentials() const OVERRIDE { return allow_credentials_; }
94
88 protected: 95 protected:
89 void SetJavaMediaPlayerBridge(jobject j_media_player_bridge); 96 void SetJavaMediaPlayerBridge(jobject j_media_player_bridge);
90 base::android::ScopedJavaLocalRef<jobject> GetJavaMediaPlayerBridge(); 97 base::android::ScopedJavaLocalRef<jobject> GetJavaMediaPlayerBridge();
91 void SetMediaPlayerListener(); 98 void SetMediaPlayerListener();
92 void SetDuration(base::TimeDelta time); 99 void SetDuration(base::TimeDelta time);
93 100
94 virtual void PendingSeekInternal(const base::TimeDelta& time); 101 virtual void PendingSeekInternal(const base::TimeDelta& time);
95 102
96 // Prepare the player for playback, asynchronously. When succeeds, 103 // Prepare the player for playback, asynchronously. When succeeds,
97 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will 104 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 180
174 // Listener object that listens to all the media player events. 181 // Listener object that listens to all the media player events.
175 scoped_ptr<MediaPlayerListener> listener_; 182 scoped_ptr<MediaPlayerListener> listener_;
176 183
177 // Whether player is currently using a surface. 184 // Whether player is currently using a surface.
178 bool is_surface_in_use_; 185 bool is_surface_in_use_;
179 186
180 // Volume of playback. 187 // Volume of playback.
181 double volume_; 188 double volume_;
182 189
190 // Whether the player should have a single security origin.
191 bool has_single_security_origin_;
192
193 // Whether user credentials are allowed to be passed.
194 bool allow_credentials_;
195
183 // Weak pointer passed to |listener_| for callbacks. 196 // Weak pointer passed to |listener_| for callbacks.
184 // NOTE: Weak pointers must be invalidated before all other member variables. 197 // NOTE: Weak pointers must be invalidated before all other member variables.
185 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_; 198 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_;
186 199
187 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); 200 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge);
188 }; 201 };
189 202
190 } // namespace media 203 } // namespace media
191 204
192 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 205 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698