| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 public: | 99 public: |
| 100 // |io_thread_delegate| is used to perform actual job creation work. | 100 // |io_thread_delegate| is used to perform actual job creation work. |
| 101 explicit JobInterceptorFactory(IOThreadDelegate* io_thread_delegate); | 101 explicit JobInterceptorFactory(IOThreadDelegate* io_thread_delegate); |
| 102 virtual ~JobInterceptorFactory(); | 102 virtual ~JobInterceptorFactory(); |
| 103 | 103 |
| 104 // |job_factory| is set as the URLRequestJobFactory where requests are | 104 // |job_factory| is set as the URLRequestJobFactory where requests are |
| 105 // forwarded if JobInterceptorFactory decides to pass on them. | 105 // forwarded if JobInterceptorFactory decides to pass on them. |
| 106 void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory); | 106 void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory); |
| 107 | 107 |
| 108 // URLRequestJobFactory implementation. | 108 // URLRequestJobFactory implementation. |
| 109 virtual bool SetProtocolHandler(const std::string& scheme, | |
| 110 ProtocolHandler* protocol_handler) OVERRIDE; | |
| 111 virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE; | |
| 112 virtual net::URLRequestJob* MaybeCreateJobWithInterceptor( | |
| 113 net::URLRequest* request, | |
| 114 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
| 115 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( | 109 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 116 const std::string& scheme, | 110 const std::string& scheme, |
| 117 net::URLRequest* request, | 111 net::URLRequest* request, |
| 118 net::NetworkDelegate* network_delegate) const OVERRIDE; | 112 net::NetworkDelegate* network_delegate) const OVERRIDE; |
| 119 virtual net::URLRequestJob* MaybeInterceptRedirect( | |
| 120 const GURL& location, | |
| 121 net::URLRequest* request, | |
| 122 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
| 123 virtual net::URLRequestJob* MaybeInterceptResponse( | |
| 124 net::URLRequest* request, | |
| 125 net::NetworkDelegate* network_delegate) const OVERRIDE; | |
| 126 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 113 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; |
| 127 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 114 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; |
| 128 | 115 |
| 129 private: | 116 private: |
| 130 // When JobInterceptorFactory decides to pass on particular requests, | 117 // When JobInterceptorFactory decides to pass on particular requests, |
| 131 // they're forwarded to the chained URLRequestJobFactory, |job_factory_|. | 118 // they're forwarded to the chained URLRequestJobFactory, |job_factory_|. |
| 132 scoped_ptr<URLRequestJobFactory> job_factory_; | 119 scoped_ptr<URLRequestJobFactory> job_factory_; |
| 133 // |io_thread_delegate_| performs the actual job creation decisions by | 120 // |io_thread_delegate_| performs the actual job creation decisions by |
| 134 // mirroring the ProtocolHandlerRegistry on the IO thread. | 121 // mirroring the ProtocolHandlerRegistry on the IO thread. |
| 135 scoped_refptr<IOThreadDelegate> io_thread_delegate_; | 122 scoped_refptr<IOThreadDelegate> io_thread_delegate_; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 322 |
| 336 // Copy of registry data for use on the IO thread. Changes to the registry | 323 // Copy of registry data for use on the IO thread. Changes to the registry |
| 337 // are posted to the IO thread where updates are applied to this object. | 324 // are posted to the IO thread where updates are applied to this object. |
| 338 scoped_refptr<IOThreadDelegate> io_thread_delegate_; | 325 scoped_refptr<IOThreadDelegate> io_thread_delegate_; |
| 339 | 326 |
| 340 DefaultClientObserverList default_client_observers_; | 327 DefaultClientObserverList default_client_observers_; |
| 341 | 328 |
| 342 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 329 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
| 343 }; | 330 }; |
| 344 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 331 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| OLD | NEW |