| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/url_request/url_request_job_factory.h" | 15 #include "net/url_request/url_request_job_factory.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class URLRequestInterceptor; | 19 class URLRequestInterceptor; |
| 20 | 20 |
| 21 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { | 21 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { |
| 22 public: | 22 public: |
| 23 URLRequestJobFactoryImpl(); | 23 URLRequestJobFactoryImpl(); |
| 24 ~URLRequestJobFactoryImpl() override; | 24 ~URLRequestJobFactoryImpl() override; |
| 25 | 25 |
| 26 // Creates a URLRequestJobFactoryImpl and adds an HttpProtocolHandler for each |
| 27 // scheme it can handle: http and https on all platforms, ws and wss for |
| 28 // platforms other than iOS |
| 29 static std::unique_ptr<URLRequestJobFactoryImpl> |
| 30 CreateWithHttpProtocolHandlers(); |
| 31 |
| 26 // Sets the ProtocolHandler for a scheme. Returns true on success, false on | 32 // Sets the ProtocolHandler for a scheme. Returns true on success, false on |
| 27 // failure (a ProtocolHandler already exists for |scheme|). | 33 // failure (a ProtocolHandler already exists for |scheme|). |
| 28 bool SetProtocolHandler(const std::string& scheme, | 34 bool SetProtocolHandler(const std::string& scheme, |
| 29 std::unique_ptr<ProtocolHandler> protocol_handler); | 35 std::unique_ptr<ProtocolHandler> protocol_handler); |
| 30 | 36 |
| 31 // URLRequestJobFactory implementation | 37 // URLRequestJobFactory implementation |
| 32 URLRequestJob* MaybeCreateJobWithProtocolHandler( | 38 URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 33 const std::string& scheme, | 39 const std::string& scheme, |
| 34 URLRequest* request, | 40 URLRequest* request, |
| 35 NetworkDelegate* network_delegate) const override; | 41 NetworkDelegate* network_delegate) const override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 63 static void SetInterceptorForTesting(URLRequestInterceptor* interceptor); | 69 static void SetInterceptorForTesting(URLRequestInterceptor* interceptor); |
| 64 | 70 |
| 65 ProtocolHandlerMap protocol_handler_map_; | 71 ProtocolHandlerMap protocol_handler_map_; |
| 66 | 72 |
| 67 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); | 73 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace net | 76 } // namespace net |
| 71 | 77 |
| 72 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 78 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| OLD | NEW |