| 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/simple_data_source.h" | 5 #include "webkit/glue/media/simple_data_source.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
| 10 #include "net/base/data_url.h" | 10 #include "net/base/data_url.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 WebKit::WebURLLoader* loader, | 112 WebKit::WebURLLoader* loader, |
| 113 WebKit::WebURLRequest& newRequest, | 113 WebKit::WebURLRequest& newRequest, |
| 114 const WebKit::WebURLResponse& redirectResponse) { | 114 const WebKit::WebURLResponse& redirectResponse) { |
| 115 DCHECK(MessageLoop::current() == render_loop_); | 115 DCHECK(MessageLoop::current() == render_loop_); |
| 116 base::AutoLock auto_lock(lock_); | 116 base::AutoLock auto_lock(lock_); |
| 117 | 117 |
| 118 // Only allow |single_origin_| if we haven't seen a different origin yet. | 118 // Only allow |single_origin_| if we haven't seen a different origin yet. |
| 119 if (single_origin_) | 119 if (single_origin_) |
| 120 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); | 120 single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); |
| 121 | 121 |
| 122 // Enforce same-origin policy and cause redirects to other origins to | |
| 123 // look like network errors. | |
| 124 // http://dev.w3.org/html5/spec/Overview.html#concept-media-load-resource | |
| 125 // http://dev.w3.org/html5/spec/Overview.html#fetch | |
| 126 if (!single_origin_) { | |
| 127 DoneInitialization_Locked(false); | |
| 128 return; | |
| 129 } | |
| 130 | |
| 131 url_ = newRequest.url(); | 122 url_ = newRequest.url(); |
| 132 } | 123 } |
| 133 | 124 |
| 134 void SimpleDataSource::didSendData( | 125 void SimpleDataSource::didSendData( |
| 135 WebKit::WebURLLoader* loader, | 126 WebKit::WebURLLoader* loader, |
| 136 unsigned long long bytesSent, | 127 unsigned long long bytesSent, |
| 137 unsigned long long totalBytesToBeSent) { | 128 unsigned long long totalBytesToBeSent) { |
| 138 NOTIMPLEMENTED(); | 129 NOTIMPLEMENTED(); |
| 139 } | 130 } |
| 140 | 131 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // If scheme is file or data, say we are loaded. | 276 // If scheme is file or data, say we are loaded. |
| 286 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); | 277 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); |
| 287 } else { | 278 } else { |
| 288 host()->SetError(media::PIPELINE_ERROR_NETWORK); | 279 host()->SetError(media::PIPELINE_ERROR_NETWORK); |
| 289 } | 280 } |
| 290 initialize_callback_->Run(); | 281 initialize_callback_->Run(); |
| 291 initialize_callback_.reset(); | 282 initialize_callback_.reset(); |
| 292 } | 283 } |
| 293 | 284 |
| 294 } // namespace webkit_glue | 285 } // namespace webkit_glue |
| OLD | NEW |