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

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry.h

Issue 11669012: Convert ProtocolHandlerRegistry::Interceptor to a net::URLRequestJobFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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: chrome/browser/custom_handlers/protocol_handler_registry.h
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h
index e8ae9137b9a29e9ca8f90b36f4626aebff609cf7..3acf5b9753217b16ccf15f2acd2a01b0ade355a1 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.h
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.h
@@ -84,6 +84,46 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
ProtocolHandlerRegistry* registry);
};
+ // Forward declaration of the internal implementation class.
+ class Core;
+
+ class JobFactory : public net::URLRequestJobFactory {
+ public:
+ explicit JobFactory(Core* core);
+ virtual ~JobFactory();
+
+ // Set the URLRequestJobFactory where requests are passed if JobFactory
+ // decides to pass on them.
+ void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory);
+
+ // URLRequestJobFactory implementation
+ virtual bool SetProtocolHandler(const std::string& scheme,
+ ProtocolHandler* protocol_handler) OVERRIDE;
+ virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE;
+ virtual net::URLRequestJob* MaybeCreateJobWithInterceptor(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeInterceptRedirect(
+ const GURL& location,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeInterceptResponse(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE;
+ virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
+
+ private:
+ scoped_ptr<URLRequestJobFactory> job_factory_;
+ scoped_refptr<Core> core_;
+
+ DISALLOW_COPY_AND_ASSIGN(JobFactory);
+ };
+
typedef std::map<std::string, ProtocolHandler> ProtocolHandlerMap;
typedef std::vector<ProtocolHandler> ProtocolHandlerList;
typedef std::map<std::string, ProtocolHandlerList> ProtocolHandlerMultiMap;
@@ -93,10 +133,10 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
ProtocolHandlerRegistry(Profile* profile, Delegate* delegate);
virtual ~ProtocolHandlerRegistry();
- // Returns a net::URLRequestJobFactory::Interceptor suitable
- // for use on the IO thread, but is initialized on the UI thread.
- // Callers assume responsibility for deleting this object.
- net::URLRequestJobFactory::Interceptor* CreateURLInterceptor();
+ // Returns a net::URLRequestJobFactory suitable for use on the IO thread, but
+ // is initialized on the UI thread. Callers assume responsibility for deleting
erikwright (departed) 2013/01/02 16:29:36 The switch to returning a scoped_ptr makes the "Ca
+ // this object.
+ scoped_ptr<JobFactory> CreateURLRequestJobFactory();
// Called when a site tries to register as a protocol handler. If the request
// can be handled silently by the registry - either to ignore the request
@@ -212,10 +252,6 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
friend class ProtocolHandlerRegistryTest;
friend class RegisterProtocolHandlerBrowserTest;
- // Forward declaration of the internal implementation classes.
- class Core;
- class URLInterceptor;
-
// Puts the given handler at the top of the list of handlers for its
// protocol.
void PromoteHandler(const ProtocolHandler& handler);

Powered by Google App Engine
This is Rietveld 408576698