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

Side by Side Diff: media/blink/resource_multibuffer_data_provider.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/blink/resource_multibuffer_data_provider.h" 5 #include "media/blink/resource_multibuffer_data_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 void ResourceMultiBufferDataProvider::SetDeferred(bool deferred) { 162 void ResourceMultiBufferDataProvider::SetDeferred(bool deferred) {
163 if (!active_loader_ || active_loader_->deferred() == deferred) 163 if (!active_loader_ || active_loader_->deferred() == deferred)
164 return; 164 return;
165 active_loader_->SetDeferred(deferred); 165 active_loader_->SetDeferred(deferred);
166 } 166 }
167 167
168 ///////////////////////////////////////////////////////////////////////////// 168 /////////////////////////////////////////////////////////////////////////////
169 // WebURLLoaderClient implementation. 169 // WebURLLoaderClient implementation.
170 170
171 void ResourceMultiBufferDataProvider::willFollowRedirect( 171 bool ResourceMultiBufferDataProvider::willFollowRedirect(
172 WebURLLoader* loader, 172 WebURLLoader* loader,
173 WebURLRequest& newRequest, 173 WebURLRequest& newRequest,
174 const WebURLResponse& redirectResponse) { 174 const WebURLResponse& redirectResponse) {
175 redirects_to_ = newRequest.url(); 175 redirects_to_ = newRequest.url();
176 url_data_->set_valid_until(base::Time::Now() + 176 url_data_->set_valid_until(base::Time::Now() +
177 GetCacheValidUntil(redirectResponse)); 177 GetCacheValidUntil(redirectResponse));
178 178
179 // This test is vital for security! 179 // This test is vital for security!
180 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { 180 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) {
181 // We allow the redirect if the origin is the same. 181 // We allow the redirect if the origin is the same.
182 if (origin_ != redirects_to_.GetOrigin()) { 182 if (origin_ != redirects_to_.GetOrigin()) {
183 // We also allow the redirect if we don't have any data in the 183 // We also allow the redirect if we don't have any data in the
184 // cache, as that means that no dangerous data mixing can occur. 184 // cache, as that means that no dangerous data mixing can occur.
185 if (url_data_->multibuffer()->map().empty() && fifo_.empty()) 185 if (url_data_->multibuffer()->map().empty() && fifo_.empty())
186 return; 186 return true;
187 187
188 active_loader_ = nullptr; 188 active_loader_ = nullptr;
189 url_data_->Fail(); 189 url_data_->Fail();
190 return; // "this" may be deleted now. 190 return false; // "this" may be deleted now.
191 } 191 }
192 } 192 }
193 return true;
193 } 194 }
194 195
195 void ResourceMultiBufferDataProvider::didSendData( 196 void ResourceMultiBufferDataProvider::didSendData(
196 WebURLLoader* loader, 197 WebURLLoader* loader,
197 unsigned long long bytes_sent, 198 unsigned long long bytes_sent,
198 unsigned long long total_bytes_to_be_sent) { 199 unsigned long long total_bytes_to_be_sent) {
199 NOTIMPLEMENTED(); 200 NOTIMPLEMENTED();
200 } 201 }
201 202
202 void ResourceMultiBufferDataProvider::didReceiveResponse( 203 void ResourceMultiBufferDataProvider::didReceiveResponse(
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 547 }
547 548
548 if (byte_pos() != first_byte_position) { 549 if (byte_pos() != first_byte_position) {
549 return false; 550 return false;
550 } 551 }
551 552
552 return true; 553 return true;
553 } 554 }
554 555
555 } // namespace media 556 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/resource_multibuffer_data_provider.h ('k') | third_party/WebKit/Source/core/fetch/RawResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698