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

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

Issue 405663002: Support basic authentication for html5 media (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updating crbug 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
« no previous file with comments | « media/base/android/media_player_bridge.h ('k') | media/base/android/media_resource_getter.h » ('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 #include "media/base/android/media_player_bridge.h" 5 #include "media/base/android/media_player_bridge.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return; 202 return;
203 } 203 }
204 204
205 request_media_resources_cb_.Run(player_id()); 205 request_media_resources_cb_.Run(player_id());
206 if (!Java_MediaPlayerBridge_prepareAsync(env, j_media_player_bridge_.obj())) 206 if (!Java_MediaPlayerBridge_prepareAsync(env, j_media_player_bridge_.obj()))
207 OnMediaError(MEDIA_ERROR_FORMAT); 207 OnMediaError(MEDIA_ERROR_FORMAT);
208 } 208 }
209 209
210 void MediaPlayerBridge::OnCookiesRetrieved(const std::string& cookies) { 210 void MediaPlayerBridge::OnCookiesRetrieved(const std::string& cookies) {
211 cookies_ = cookies; 211 cookies_ = cookies;
212 manager()->GetMediaResourceGetter()->GetAuthCredentials(
213 url_,
214 base::Bind(&MediaPlayerBridge::OnAuthCredentialsRetrieved,
215 weak_factory_.GetWeakPtr()));
216 }
217
218 void MediaPlayerBridge::OnAuthCredentialsRetrieved(
219 const base::string16& username, const base::string16& password) {
220 GURL::ReplacementsW replacements;
221 if (!username.empty()) {
222 replacements.SetUsernameStr(username);
223 if (!password.empty())
224 replacements.SetPasswordStr(password);
225 url_ = url_.ReplaceComponents(replacements);
226 }
212 ExtractMediaMetadata(url_.spec()); 227 ExtractMediaMetadata(url_.spec());
213 } 228 }
214 229
215 void MediaPlayerBridge::ExtractMediaMetadata(const std::string& url) { 230 void MediaPlayerBridge::ExtractMediaMetadata(const std::string& url) {
216 manager()->GetMediaResourceGetter()->ExtractMediaMetadata( 231 manager()->GetMediaResourceGetter()->ExtractMediaMetadata(
217 url, 232 url,
218 cookies_, 233 cookies_,
219 user_agent_, 234 user_agent_,
220 base::Bind(&MediaPlayerBridge::OnMediaMetadataExtracted, 235 base::Bind(&MediaPlayerBridge::OnMediaMetadataExtracted,
221 weak_factory_.GetWeakPtr())); 236 weak_factory_.GetWeakPtr()));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 496
482 GURL MediaPlayerBridge::GetFirstPartyForCookies() { 497 GURL MediaPlayerBridge::GetFirstPartyForCookies() {
483 return first_party_for_cookies_; 498 return first_party_for_cookies_;
484 } 499 }
485 500
486 bool MediaPlayerBridge::IsSurfaceInUse() const { 501 bool MediaPlayerBridge::IsSurfaceInUse() const {
487 return is_surface_in_use_; 502 return is_surface_in_use_;
488 } 503 }
489 504
490 } // namespace media 505 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_player_bridge.h ('k') | media/base/android/media_resource_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698