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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 #include "media/base/filter_host.h" | 7 #include "media/base/filter_host.h" |
8 #include "net/base/load_flags.h" | 8 #include "net/base/load_flags.h" |
9 #include "net/base/data_url.h" | 9 #include "net/base/data_url.h" |
10 #include "net/url_request/url_request_status.h" | 10 #include "net/url_request/url_request_status.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // If this using data protocol, we just need to decode it. | 237 // If this using data protocol, we just need to decode it. |
238 std::string mime_type, charset; | 238 std::string mime_type, charset; |
239 bool success = net::DataURL::Parse(url_, &mime_type, &charset, &data_); | 239 bool success = net::DataURL::Parse(url_, &mime_type, &charset, &data_); |
240 | 240 |
241 // Don't care about the mime-type just proceed if decoding was successful. | 241 // Don't care about the mime-type just proceed if decoding was successful. |
242 size_ = data_.length(); | 242 size_ = data_.length(); |
243 DoneInitialization_Locked(success); | 243 DoneInitialization_Locked(success); |
244 } else { | 244 } else { |
245 // Prepare the request. | 245 // Prepare the request. |
246 WebKit::WebURLRequest request(url_); | 246 WebKit::WebURLRequest request(url_); |
| 247 request.setTargetType(WebKit::WebURLRequest::TargetIsMedia); |
247 | 248 |
248 frame_->setReferrerForRequest(request, WebKit::WebURL()); | 249 frame_->setReferrerForRequest(request, WebKit::WebURL()); |
249 // TODO(annacc): we should be using createAssociatedURLLoader() instead? | |
250 frame_->dispatchWillSendRequest(request); | |
251 | 250 |
252 // This flag is for unittests as we don't want to reset |url_loader| | 251 // This flag is for unittests as we don't want to reset |url_loader| |
253 if (!keep_test_loader_) | 252 if (!keep_test_loader_) |
254 url_loader_.reset(WebKit::webKitClient()->createURLLoader()); | 253 url_loader_.reset(frame_->createAssociatedURLLoader()); |
255 | 254 |
256 // Start the resource loading. | 255 // Start the resource loading. |
257 url_loader_->loadAsynchronously(request, this); | 256 url_loader_->loadAsynchronously(request, this); |
258 } | 257 } |
259 } | 258 } |
260 | 259 |
261 void SimpleDataSource::CancelTask() { | 260 void SimpleDataSource::CancelTask() { |
262 DCHECK(MessageLoop::current() == render_loop_); | 261 DCHECK(MessageLoop::current() == render_loop_); |
263 AutoLock auto_lock(lock_); | 262 AutoLock auto_lock(lock_); |
264 DCHECK_EQ(state_, STOPPED); | 263 DCHECK_EQ(state_, STOPPED); |
(...skipping 14 matching lines...) Expand all Loading... |
279 // If scheme is file or data, say we are loaded. | 278 // If scheme is file or data, say we are loaded. |
280 host()->SetLoaded(url_.SchemeIsFile() || IsDataProtocol(url_)); | 279 host()->SetLoaded(url_.SchemeIsFile() || IsDataProtocol(url_)); |
281 } else { | 280 } else { |
282 host()->SetError(media::PIPELINE_ERROR_NETWORK); | 281 host()->SetError(media::PIPELINE_ERROR_NETWORK); |
283 } | 282 } |
284 initialize_callback_->Run(); | 283 initialize_callback_->Run(); |
285 initialize_callback_.reset(); | 284 initialize_callback_.reset(); |
286 } | 285 } |
287 | 286 |
288 } // namespace webkit_glue | 287 } // namespace webkit_glue |
OLD | NEW |