| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  106 void SimpleDataSource::SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader) { |  106 void SimpleDataSource::SetURLLoaderForTest(WebKit::WebURLLoader* mock_loader) { | 
|  107   url_loader_.reset(mock_loader); |  107   url_loader_.reset(mock_loader); | 
|  108   keep_test_loader_ = true; |  108   keep_test_loader_ = true; | 
|  109 } |  109 } | 
|  110  |  110  | 
|  111 void SimpleDataSource::willSendRequest( |  111 void SimpleDataSource::willSendRequest( | 
|  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  |  117  | 
|  117   // 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. | 
|  118   if (single_origin_) |  119   if (single_origin_) | 
|  119     single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); |  120     single_origin_ = url_.GetOrigin() == GURL(newRequest.url()).GetOrigin(); | 
|  120  |  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  | 
|  121   url_ = newRequest.url(); |  131   url_ = newRequest.url(); | 
|  122 } |  132 } | 
|  123  |  133  | 
|  124 void SimpleDataSource::didSendData( |  134 void SimpleDataSource::didSendData( | 
|  125     WebKit::WebURLLoader* loader, |  135     WebKit::WebURLLoader* loader, | 
|  126     unsigned long long bytesSent, |  136     unsigned long long bytesSent, | 
|  127     unsigned long long totalBytesToBeSent) { |  137     unsigned long long totalBytesToBeSent) { | 
|  128   NOTIMPLEMENTED(); |  138   NOTIMPLEMENTED(); | 
|  129 } |  139 } | 
|  130  |  140  | 
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  275     // If scheme is file or data, say we are loaded. |  285     // If scheme is file or data, say we are loaded. | 
|  276     host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); |  286     host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); | 
|  277   } else { |  287   } else { | 
|  278     host()->SetError(media::PIPELINE_ERROR_NETWORK); |  288     host()->SetError(media::PIPELINE_ERROR_NETWORK); | 
|  279   } |  289   } | 
|  280   initialize_callback_->Run(); |  290   initialize_callback_->Run(); | 
|  281   initialize_callback_.reset(); |  291   initialize_callback_.reset(); | 
|  282 } |  292 } | 
|  283  |  293  | 
|  284 }  // namespace webkit_glue |  294 }  // namespace webkit_glue | 
| OLD | NEW |