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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void ResourceMultiBufferDataProvider::willFollowRedirect( |
172 WebURLLoader* loader, | 172 WebURLLoader* loader, |
173 WebURLRequest& newRequest, | 173 WebURLRequest& newRequest, |
174 const WebURLResponse& redirectResponse, | 174 const WebURLResponse& redirectResponse) { |
175 int64_t encodedDataLength) { | |
176 redirects_to_ = newRequest.url(); | 175 redirects_to_ = newRequest.url(); |
177 url_data_->set_valid_until(base::Time::Now() + | 176 url_data_->set_valid_until(base::Time::Now() + |
178 GetCacheValidUntil(redirectResponse)); | 177 GetCacheValidUntil(redirectResponse)); |
179 | 178 |
180 // This test is vital for security! | 179 // This test is vital for security! |
181 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { | 180 if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { |
182 // We allow the redirect if the origin is the same. | 181 // We allow the redirect if the origin is the same. |
183 if (origin_ != redirects_to_.GetOrigin()) { | 182 if (origin_ != redirects_to_.GetOrigin()) { |
184 // 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 |
185 // cache, as that means that no dangerous data mixing can occur. | 184 // cache, as that means that no dangerous data mixing can occur. |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 } | 546 } |
548 | 547 |
549 if (byte_pos() != first_byte_position) { | 548 if (byte_pos() != first_byte_position) { |
550 return false; | 549 return false; |
551 } | 550 } |
552 | 551 |
553 return true; | 552 return true; |
554 } | 553 } |
555 | 554 |
556 } // namespace media | 555 } // namespace media |
OLD | NEW |