Commit e8786824 authored by shalev@chromium.org's avatar shalev@chromium.org

Replaced static URLRequestDataJob factory with protocol handler for Data jobs.

BUG=None
TEST=browser_tests --single_process --gtest_filter=DownloadExtensionTest.DownloadExtensionTest_Download_DataURL

Review URL: https://chromiumcodereview.appspot.com/10703089

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148927 0039d316-1c4b-4281-b951-d872f2087c98
parent 62c28b9b
......@@ -60,6 +60,7 @@
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/url_request.h"
#if defined(OS_CHROMEOS)
......@@ -548,6 +549,9 @@ void ProfileIOData::SetUpJobFactoryDefaults(
chrome::kChromeDevToolsScheme,
CreateDevToolsProtocolHandler(chrome_url_data_manager_backend_.get()));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
chrome::kDataScheme, new net::DataProtocolHandler());
DCHECK(set_protocol);
#if defined(OS_CHROMEOS)
if (!is_incognito()) {
set_protocol = job_factory->SetProtocolHandler(
......
......@@ -722,6 +722,8 @@
'udp/udp_socket_libevent.h',
'udp/udp_socket_win.cc',
'udp/udp_socket_win.h',
'url_request/data_protocol_handler.cc',
'url_request/data_protocol_handler.h',
'url_request/fraudulent_certificate_reporter.h',
'url_request/ftp_protocol_handler.cc',
'url_request/ftp_protocol_handler.h',
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/url_request_data_job.h"
namespace net {
DataProtocolHandler::DataProtocolHandler() {
}
URLRequestJob* DataProtocolHandler::MaybeCreateJob(
URLRequest* request) const {
return new URLRequestDataJob(request);
}
} // namespace net
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_URL_REQUEST_DATA_PROTOCOL_HANDLER_H_
#define NET_URL_REQUEST_DATA_PROTOCOL_HANDLER_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "net/url_request/url_request_job_factory.h"
namespace net {
class URLRequestJob;
// Implements a ProtocolHandler for Data jobs.
class NET_EXPORT DataProtocolHandler
: public URLRequestJobFactory::ProtocolHandler {
public:
DataProtocolHandler();
virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(DataProtocolHandler);
};
} // namespace net
#endif // NET_URL_REQUEST_DATA_PROTOCOL_HANDLER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment