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

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

Powered by Google App Engine
This is Rietveld 408576698