| OLD | NEW |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return; | 159 return; |
| 160 active_loader_->SetDeferred(deferred); | 160 active_loader_->SetDeferred(deferred); |
| 161 } | 161 } |
| 162 | 162 |
| 163 ///////////////////////////////////////////////////////////////////////////// | 163 ///////////////////////////////////////////////////////////////////////////// |
| 164 // WebURLLoaderClient implementation. | 164 // WebURLLoaderClient implementation. |
| 165 | 165 |
| 166 void ResourceMultiBufferDataProvider::willFollowRedirect( | 166 void ResourceMultiBufferDataProvider::willFollowRedirect( |
| 167 WebURLLoader* loader, | 167 WebURLLoader* loader, |
| 168 WebURLRequest& newRequest, | 168 WebURLRequest& newRequest, |
| 169 const WebURLResponse& redirectResponse, | 169 const WebURLResponse& redirectResponse) { |
| 170 int64_t encodedDataLength) { | |
| 171 redirects_to_ = newRequest.url(); | 170 redirects_to_ = newRequest.url(); |
| 172 url_data_->set_valid_until(base::Time::Now() + | 171 url_data_->set_valid_until(base::Time::Now() + |
| 173 GetCacheValidUntil(redirectResponse)); | 172 GetCacheValidUntil(redirectResponse)); |
| 174 | 173 |
| 175 // This test is vital for security! | 174 // This test is vital for security! |
| 176 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { | 175 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { |
| 177 // We allow the redirect if the origin is the same. | 176 // We allow the redirect if the origin is the same. |
| 178 if (origin_ != redirects_to_.GetOrigin()) { | 177 if (origin_ != redirects_to_.GetOrigin()) { |
| 179 // We also allow the redirect if we don't have any data in the | 178 // We also allow the redirect if we don't have any data in the |
| 180 // cache, as that means that no dangerous data mixing can occur. | 179 // cache, as that means that no dangerous data mixing can occur. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 538 } |
| 540 | 539 |
| 541 if (byte_pos() != first_byte_position) { | 540 if (byte_pos() != first_byte_position) { |
| 542 return false; | 541 return false; |
| 543 } | 542 } |
| 544 | 543 |
| 545 return true; | 544 return true; |
| 546 } | 545 } |
| 547 | 546 |
| 548 } // namespace media | 547 } // namespace media |
| OLD | NEW |