Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: webkit/glue/media/simple_data_source.cc

Issue 5756004: Separate BufferedDataSource and BufferedResourceLoader into two files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: inlining + removing Is...Protocol methods and getting rid of GetBufferedFirstBytePosition Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1dd806c4463ebb5e34b5b4261c7267b48dd6602e 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -2,28 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "webkit/glue/media/simple_data_source.h"
+
#include "base/message_loop.h"
#include "base/process_util.h"
#include "media/base/filter_host.h"
-#include "net/base/load_flags.h"
#include "net/base/data_url.h"
+#include "net/base/load_flags.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 {
@@ -233,7 +227,7 @@ void SimpleDataSource::StartTask() {
DCHECK_EQ(state_, INITIALIZING);
- if (IsDataProtocol(url_)) {
+ if (url_.SchemeIs(kDataScheme)) {
// 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 +240,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 +269,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() || url_.SchemeIs(kDataScheme));
} else {
host()->SetError(media::PIPELINE_ERROR_NETWORK);
}

Powered by Google App Engine
This is Rietveld 408576698