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

Side by Side Diff: content/renderer/media/android/media_info_loader.cc

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/android/media_info_loader.h" 5 #include "content/renderer/media/android/media_info_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bits.h" 9 #include "base/bits.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 loader.reset(frame->createAssociatedURLLoader(options)); 83 loader.reset(frame->createAssociatedURLLoader(options));
84 } 84 }
85 85
86 // Start the resource loading. 86 // Start the resource loading.
87 loader->loadAsynchronously(request, this); 87 loader->loadAsynchronously(request, this);
88 active_loader_.reset(new media::ActiveLoader(std::move(loader))); 88 active_loader_.reset(new media::ActiveLoader(std::move(loader)));
89 } 89 }
90 90
91 ///////////////////////////////////////////////////////////////////////////// 91 /////////////////////////////////////////////////////////////////////////////
92 // blink::WebURLLoaderClient implementation. 92 // blink::WebURLLoaderClient implementation.
93 void MediaInfoLoader::willFollowRedirect( 93 bool MediaInfoLoader::willFollowRedirect(
94 WebURLLoader* loader, 94 WebURLLoader* loader,
95 WebURLRequest& newRequest, 95 WebURLRequest& newRequest,
96 const WebURLResponse& redirectResponse) { 96 const WebURLResponse& redirectResponse) {
97 // The load may have been stopped and |ready_cb| is destroyed. 97 // The load may have been stopped and |ready_cb| is destroyed.
98 // In this case we shouldn't do anything. 98 // In this case we shouldn't do anything.
99 if (ready_cb_.is_null()) { 99 if (ready_cb_.is_null())
100 // Set the url in the request to an invalid value (empty url). 100 return false;
101 newRequest.setURL(blink::WebURL());
102 return;
103 }
104 101
105 // Only allow |single_origin_| if we haven't seen a different origin yet. 102 // Only allow |single_origin_| if we haven't seen a different origin yet.
106 if (single_origin_) 103 if (single_origin_)
107 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); 104 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin();
108 105
109 url_ = newRequest.url(); 106 url_ = newRequest.url();
110 first_party_url_ = newRequest.firstPartyForCookies(); 107 first_party_url_ = newRequest.firstPartyForCookies();
111 allow_stored_credentials_ = newRequest.allowStoredCredentials(); 108 allow_stored_credentials_ = newRequest.allowStoredCredentials();
109
110 return true;
112 } 111 }
113 112
114 void MediaInfoLoader::didSendData( 113 void MediaInfoLoader::didSendData(
115 WebURLLoader* loader, 114 WebURLLoader* loader,
116 unsigned long long bytes_sent, 115 unsigned long long bytes_sent,
117 unsigned long long total_bytes_to_be_sent) { 116 unsigned long long total_bytes_to_be_sent) {
118 NOTIMPLEMENTED(); 117 NOTIMPLEMENTED();
119 } 118 }
120 119
121 void MediaInfoLoader::didReceiveResponse( 120 void MediaInfoLoader::didReceiveResponse(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void MediaInfoLoader::DidBecomeReady(Status status) { 206 void MediaInfoLoader::DidBecomeReady(Status status) {
208 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", 207 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay",
209 base::TimeTicks::Now() - start_time_); 208 base::TimeTicks::Now() - start_time_);
210 active_loader_.reset(); 209 active_loader_.reset();
211 if (!ready_cb_.is_null()) 210 if (!ready_cb_.is_null())
212 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_, 211 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_,
213 allow_stored_credentials_); 212 allow_stored_credentials_);
214 } 213 }
215 214
216 } // namespace content 215 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/media_info_loader.h ('k') | content/renderer/pepper/pepper_url_loader_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698