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 26 matching lines...) Expand all Loading... |
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, | 40 bool ignore_certificate_errors, |
41 const base::FilePath& base_path, | 41 const base::FilePath& base_path, |
42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
43 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 43 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
44 content::ProtocolHandlerMap* protocol_handlers, | 44 content::ProtocolHandlerMap* protocol_handlers, |
45 content::URLRequestInterceptorScopedVector request_interceptors, | 45 content::URLRequestInterceptorScopedVector request_interceptors, |
46 net::NetLog* net_log, | 46 net::NetLog* net_log, |
47 const HeadlessBrowser::Options& options); | 47 HeadlessBrowser::Options* options); |
48 | 48 |
49 // net::URLRequestContextGetter implementation: | 49 // net::URLRequestContextGetter implementation: |
50 net::URLRequestContext* GetURLRequestContext() override; | 50 net::URLRequestContext* GetURLRequestContext() override; |
51 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 51 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
52 const override; | 52 const override; |
53 | 53 |
54 net::HostResolver* host_resolver() const; | 54 net::HostResolver* host_resolver() const; |
55 | 55 |
56 protected: | 56 protected: |
57 ~HeadlessURLRequestContextGetter() override; | 57 ~HeadlessURLRequestContextGetter() override; |
58 | 58 |
59 std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate(); | 59 std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate(); |
60 std::unique_ptr<net::ProxyConfigService> GetProxyConfigService(); | 60 std::unique_ptr<net::ProxyConfigService> GetProxyConfigService(); |
61 std::unique_ptr<net::ProxyService> GetProxyService(); | 61 std::unique_ptr<net::ProxyService> GetProxyService(); |
62 | 62 |
63 private: | 63 private: |
64 bool ignore_certificate_errors_; | 64 bool ignore_certificate_errors_; |
65 base::FilePath base_path_; | 65 base::FilePath base_path_; |
66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
67 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
68 net::NetLog* net_log_; | 68 net::NetLog* net_log_; |
69 HeadlessBrowser::Options options_; | 69 |
| 70 // 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 |
| 72 // thread. |
| 73 std::string user_agent_; |
| 74 std::string host_resolver_rules_; |
| 75 net::HostPortPair proxy_server_; |
70 | 76 |
71 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | 77 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
72 std::unique_ptr<net::NetworkDelegate> network_delegate_; | 78 std::unique_ptr<net::NetworkDelegate> network_delegate_; |
73 std::unique_ptr<net::URLRequestContextStorage> storage_; | 79 std::unique_ptr<net::URLRequestContextStorage> storage_; |
74 std::unique_ptr<net::URLRequestContext> url_request_context_; | 80 std::unique_ptr<net::URLRequestContext> url_request_context_; |
75 content::ProtocolHandlerMap protocol_handlers_; | 81 content::ProtocolHandlerMap protocol_handlers_; |
76 content::URLRequestInterceptorScopedVector request_interceptors_; | 82 content::URLRequestInterceptorScopedVector request_interceptors_; |
77 | 83 |
78 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); | 84 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); |
79 }; | 85 }; |
80 | 86 |
81 } // namespace headless | 87 } // namespace headless |
82 | 88 |
83 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ | 89 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |