| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/media/buffered_resource_loader.h" | 5 #include "webkit/glue/media/buffered_resource_loader.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (!start_callback_.get()) { | 245 if (!start_callback_.get()) { |
| 246 // Set the url in the request to an invalid value (empty url). | 246 // Set the url in the request to an invalid value (empty url). |
| 247 newRequest.setURL(WebKit::WebURL()); | 247 newRequest.setURL(WebKit::WebURL()); |
| 248 return; | 248 return; |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Only allow |single_origin_| if we haven't seen a different origin yet. | 251 // Only allow |single_origin_| if we haven't seen a different origin yet. |
| 252 if (single_origin_) | 252 if (single_origin_) |
| 253 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); | 253 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); |
| 254 | 254 |
| 255 // Enforce same-origin policy and cause redirects to other origins to | 255 if (!IsProtocolSupportedForMedia(newRequest.url())) { |
| 256 // look like network errors. | |
| 257 // http://dev.w3.org/html5/spec/Overview.html#concept-media-load-resource | |
| 258 // http://dev.w3.org/html5/spec/Overview.html#fetch | |
| 259 if (!single_origin_ || !IsProtocolSupportedForMedia(newRequest.url())) { | |
| 260 // Set the url in the request to an invalid value (empty url). | 256 // Set the url in the request to an invalid value (empty url). |
| 261 newRequest.setURL(WebKit::WebURL()); | 257 newRequest.setURL(WebKit::WebURL()); |
| 262 DoneStart(net::ERR_ADDRESS_INVALID); | 258 DoneStart(net::ERR_ADDRESS_INVALID); |
| 263 return; | 259 return; |
| 264 } | 260 } |
| 265 | 261 |
| 266 url_ = newRequest.url(); | 262 url_ = newRequest.url(); |
| 267 } | 263 } |
| 268 | 264 |
| 269 void BufferedResourceLoader::didSendData( | 265 void BufferedResourceLoader::didSendData( |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 start_callback_->RunWithParams(Tuple1<int>(error)); | 577 start_callback_->RunWithParams(Tuple1<int>(error)); |
| 582 start_callback_.reset(); | 578 start_callback_.reset(); |
| 583 } | 579 } |
| 584 | 580 |
| 585 void BufferedResourceLoader::NotifyNetworkEvent() { | 581 void BufferedResourceLoader::NotifyNetworkEvent() { |
| 586 if (event_callback_.get()) | 582 if (event_callback_.get()) |
| 587 event_callback_->Run(); | 583 event_callback_->Run(); |
| 588 } | 584 } |
| 589 | 585 |
| 590 } // namespace webkit_glue | 586 } // namespace webkit_glue |
| OLD | NEW |