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..bd8949d6da6ca4fda920a73398885c837acd2c4e 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 { |
mmenke
2013/01/03 15:45:11
I think we could do a little better on the class n
|
+ 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,9 @@ 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. |
+ 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 +251,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); |