Chromium Code Reviews| Index: webkit/glue/media/simple_data_source.cc |
| diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc |
| index 97a9c3915fe59982eeb8ffa31c58b0fc6969ab11..bc0d0ffa7211d02f6f911046d9764a4853875ab4 100644 |
| --- a/webkit/glue/media/simple_data_source.cc |
| +++ b/webkit/glue/media/simple_data_source.cc |
| @@ -7,25 +7,13 @@ |
| #include "media/base/filter_host.h" |
| #include "net/base/load_flags.h" |
|
scherkus (not reviewing)
2010/12/14 18:48:19
nit: alphabetize includes
annacc
2010/12/14 21:10:17
Done.
|
| #include "net/base/data_url.h" |
| +#include "net/http/http_util.h" |
| #include "net/url_request/url_request_status.h" |
| #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" |
| #include "webkit/glue/media/simple_data_source.h" |
| #include "webkit/glue/webkit_glue.h" |
| -namespace { |
| - |
| -const char kHttpScheme[] = "http"; |
| -const char kHttpsScheme[] = "https"; |
| -const char kDataScheme[] = "data"; |
| - |
| -// A helper method that accepts only HTTP, HTTPS and FILE protocol. |
| -bool IsDataProtocol(const GURL& url) { |
| - return url.SchemeIs(kDataScheme); |
| -} |
| - |
| -} // namespace |
| - |
| namespace webkit_glue { |
| SimpleDataSource::SimpleDataSource( |
| @@ -233,7 +221,7 @@ void SimpleDataSource::StartTask() { |
| DCHECK_EQ(state_, INITIALIZING); |
| - if (IsDataProtocol(url_)) { |
| + if (net::HttpUtil::IsDataProtocol(url_)) { |
| // If this using data protocol, we just need to decode it. |
| std::string mime_type, charset; |
| bool success = net::DataURL::Parse(url_, &mime_type, &charset, &data_); |
| @@ -246,12 +234,10 @@ void SimpleDataSource::StartTask() { |
| WebKit::WebURLRequest request(url_); |
| frame_->setReferrerForRequest(request, WebKit::WebURL()); |
| - // TODO(annacc): we should be using createAssociatedURLLoader() instead? |
| - frame_->dispatchWillSendRequest(request); |
| // This flag is for unittests as we don't want to reset |url_loader| |
| if (!keep_test_loader_) |
| - url_loader_.reset(WebKit::webKitClient()->createURLLoader()); |
| + url_loader_.reset(frame_->createAssociatedURLLoader()); |
| // Start the resource loading. |
| url_loader_->loadAsynchronously(request, this); |
| @@ -277,7 +263,7 @@ void SimpleDataSource::DoneInitialization_Locked(bool success) { |
| host()->SetTotalBytes(size_); |
| host()->SetBufferedBytes(size_); |
| // If scheme is file or data, say we are loaded. |
| - host()->SetLoaded(url_.SchemeIsFile() || IsDataProtocol(url_)); |
| + host()->SetLoaded(url_.SchemeIsFile() || net::HttpUtil::IsDataProtocol(url_)); |
|
scherkus (not reviewing)
2010/12/14 18:48:19
>80 chars
annacc
2010/12/14 21:10:17
Done.
|
| } else { |
| host()->SetError(media::PIPELINE_ERROR_NETWORK); |
| } |