diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 23:37:34 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 23:37:34 +0000 |
commit | beeb77607384ebb1ee652c97fa2fa47445b5ce8a (patch) | |
tree | 83fde4d985f3e23c2bfd72664d37d85470b53e65 /chrome/browser/net/metadata_url_request.cc | |
parent | 77feb46ee8d7e7b2a174714fa17e830573f01476 (diff) | |
download | chromium_src-beeb77607384ebb1ee652c97fa2fa47445b5ce8a.zip chromium_src-beeb77607384ebb1ee652c97fa2fa47445b5ce8a.tar.gz chromium_src-beeb77607384ebb1ee652c97fa2fa47445b5ce8a.tar.bz2 |
Convert more ProtocolFactories to ProtocolHandlers.
BUG=81979
TEST=none
Review URL: http://codereview.chromium.org/7034006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/metadata_url_request.cc')
-rw-r--r-- | chrome/browser/net/metadata_url_request.cc | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/chrome/browser/net/metadata_url_request.cc b/chrome/browser/net/metadata_url_request.cc index 2dcbed7..43c1edd 100644 --- a/chrome/browser/net/metadata_url_request.cc +++ b/chrome/browser/net/metadata_url_request.cc @@ -16,6 +16,7 @@ #include "net/base/net_util.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" +#include "net/url_request/url_request_job_factory.h" namespace { @@ -23,9 +24,6 @@ class MetadataRequestHandler : public net::URLRequestJob { public: explicit MetadataRequestHandler(net::URLRequest* request); - static net::URLRequestJob* Factory(net::URLRequest* request, - const std::string& scheme); - // net::URLRequestJob implementation. virtual void Start(); virtual void Kill(); @@ -53,11 +51,6 @@ MetadataRequestHandler::MetadataRequestHandler(net::URLRequest* request) MetadataRequestHandler::~MetadataRequestHandler() { } -net::URLRequestJob* MetadataRequestHandler::Factory(net::URLRequest* request, - const std::string& scheme) { - return new MetadataRequestHandler(request); -} - void MetadataRequestHandler::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. @@ -127,11 +120,30 @@ void MetadataRequestHandler::StartAsync() { NotifyHeadersComplete(); } +class MetadataProtocolHandler + : public net::URLRequestJobFactory::ProtocolHandler { + public: + MetadataProtocolHandler(); + virtual ~MetadataProtocolHandler(); + + virtual net::URLRequestJob* MaybeCreateJob( + net::URLRequest* request) const OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(MetadataProtocolHandler); +}; + +MetadataProtocolHandler::MetadataProtocolHandler() {} + +MetadataProtocolHandler::~MetadataProtocolHandler() {} + +net::URLRequestJob* MetadataProtocolHandler::MaybeCreateJob( + net::URLRequest* request) const { + return new MetadataRequestHandler(request); +} + } // namespace -void RegisterMetadataURLRequestHandler() { -#if defined(OS_CHROMEOS) - net::URLRequest::RegisterProtocolFactory(chrome::kMetadataScheme, - &MetadataRequestHandler::Factory); -#endif +net::URLRequestJobFactory::ProtocolHandler* CreateMetadataProtocolHandler() { + return new MetadataProtocolHandler; } |