| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_ | |
| 6 #define CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "net/url_request/url_request_job_factory.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 class URLRequest; | |
| 17 class URLRequestJob; | |
| 18 | |
| 19 // This class acts as a wrapper for URLRequestJobFactory. It handles HTTP and | |
| 20 // HTTPS jobs using |protocol_handler_|, but forwards all other schemes to the | |
| 21 // old job factory to be handled there. | |
| 22 class HttpInterceptJobFactory : public URLRequestJobFactory { | |
| 23 public: | |
| 24 HttpInterceptJobFactory(const URLRequestJobFactory* job_factory, | |
| 25 ProtocolHandler* protocol_handler); | |
| 26 virtual ~HttpInterceptJobFactory(); | |
| 27 | |
| 28 // URLRequestJobFactory implementation | |
| 29 virtual bool SetProtocolHandler(const std::string& scheme, | |
| 30 ProtocolHandler* protocol_handler) OVERRIDE; | |
| 31 virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE; | |
| 32 virtual URLRequestJob* MaybeCreateJobWithInterceptor( | |
| 33 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | |
| 34 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( | |
| 35 const std::string& scheme, | |
| 36 URLRequest* request, | |
| 37 NetworkDelegate* network_delegate) const OVERRIDE; | |
| 38 virtual URLRequestJob* MaybeInterceptRedirect( | |
| 39 const GURL& location, | |
| 40 URLRequest* request, | |
| 41 NetworkDelegate* network_delegate) const OVERRIDE; | |
| 42 virtual URLRequestJob* MaybeInterceptResponse( | |
| 43 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | |
| 44 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | |
| 45 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 const URLRequestJobFactory* job_factory_; | |
| 49 ProtocolHandler* protocol_handler_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(HttpInterceptJobFactory); | |
| 52 }; | |
| 53 | |
| 54 } // namespace net | |
| 55 | |
| 56 #endif // CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_ | |
| OLD | NEW |