| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class ProxyConfigService; | 30 class ProxyConfigService; |
| 31 class ProxyService; | 31 class ProxyService; |
| 32 class URLRequestContextStorage; | 32 class URLRequestContextStorage; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace headless { | 35 namespace headless { |
| 36 | 36 |
| 37 class HeadlessURLRequestContextGetter : public net::URLRequestContextGetter { | 37 class HeadlessURLRequestContextGetter : public net::URLRequestContextGetter { |
| 38 public: | 38 public: |
| 39 HeadlessURLRequestContextGetter( | 39 HeadlessURLRequestContextGetter( |
| 40 bool ignore_certificate_errors, | |
| 41 const base::FilePath& base_path, | |
| 42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 43 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 41 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
| 44 content::ProtocolHandlerMap* protocol_handlers, | 42 content::ProtocolHandlerMap* protocol_handlers, |
| 45 content::URLRequestInterceptorScopedVector request_interceptors, | 43 content::URLRequestInterceptorScopedVector request_interceptors, |
| 46 net::NetLog* net_log, | |
| 47 HeadlessBrowser::Options* options); | 44 HeadlessBrowser::Options* options); |
| 48 | 45 |
| 49 // net::URLRequestContextGetter implementation: | 46 // net::URLRequestContextGetter implementation: |
| 50 net::URLRequestContext* GetURLRequestContext() override; | 47 net::URLRequestContext* GetURLRequestContext() override; |
| 51 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 48 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
| 52 const override; | 49 const override; |
| 53 | 50 |
| 54 net::HostResolver* host_resolver() const; | 51 net::HostResolver* host_resolver() const; |
| 55 | 52 |
| 56 protected: | 53 protected: |
| 57 ~HeadlessURLRequestContextGetter() override; | 54 ~HeadlessURLRequestContextGetter() override; |
| 58 | 55 |
| 59 std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate(); | |
| 60 std::unique_ptr<net::ProxyConfigService> GetProxyConfigService(); | |
| 61 std::unique_ptr<net::ProxyService> GetProxyService(); | |
| 62 | |
| 63 private: | 56 private: |
| 64 bool ignore_certificate_errors_; | |
| 65 base::FilePath base_path_; | |
| 66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 57 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 67 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 58 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 68 net::NetLog* net_log_; | |
| 69 | 59 |
| 70 // The |options| object given to the constructor is not guaranteed to outlive | 60 // The |options| object given to the constructor is not guaranteed to outlive |
| 71 // this class, so we make copies of the parts we need to access on the IO | 61 // this class, so we make copies of the parts we need to access on the IO |
| 72 // thread. | 62 // thread. |
| 73 std::string user_agent_; | 63 std::string user_agent_; |
| 74 std::string host_resolver_rules_; | 64 std::string host_resolver_rules_; |
| 75 net::HostPortPair proxy_server_; | 65 net::HostPortPair proxy_server_; |
| 76 | 66 |
| 77 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | 67 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
| 78 std::unique_ptr<net::NetworkDelegate> network_delegate_; | |
| 79 std::unique_ptr<net::URLRequestContextStorage> storage_; | |
| 80 std::unique_ptr<net::URLRequestContext> url_request_context_; | 68 std::unique_ptr<net::URLRequestContext> url_request_context_; |
| 81 content::ProtocolHandlerMap protocol_handlers_; | 69 content::ProtocolHandlerMap protocol_handlers_; |
| 82 content::URLRequestInterceptorScopedVector request_interceptors_; | 70 content::URLRequestInterceptorScopedVector request_interceptors_; |
| 83 | 71 |
| 84 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); | 72 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); |
| 85 }; | 73 }; |
| 86 | 74 |
| 87 } // namespace headless | 75 } // namespace headless |
| 88 | 76 |
| 89 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ | 77 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |