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 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 class HeadlessBrowserContextOptions; | 28 class HeadlessBrowserContextOptions; |
29 | 29 |
30 class HeadlessURLRequestContextGetter : public net::URLRequestContextGetter { | 30 class HeadlessURLRequestContextGetter : public net::URLRequestContextGetter { |
31 public: | 31 public: |
32 HeadlessURLRequestContextGetter( | 32 HeadlessURLRequestContextGetter( |
33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
34 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 34 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
35 content::ProtocolHandlerMap* protocol_handlers, | 35 content::ProtocolHandlerMap* protocol_handlers, |
36 ProtocolHandlerMap context_protocol_handlers, | 36 ProtocolHandlerMap context_protocol_handlers, |
37 content::URLRequestInterceptorScopedVector request_interceptors, | 37 content::URLRequestInterceptorScopedVector request_interceptors, |
38 HeadlessBrowserContextOptions* options, | 38 HeadlessBrowserContextOptions* options); |
39 net::NetLog* net_log); | |
40 | 39 |
41 // net::URLRequestContextGetter implementation: | 40 // net::URLRequestContextGetter implementation: |
42 net::URLRequestContext* GetURLRequestContext() override; | 41 net::URLRequestContext* GetURLRequestContext() override; |
43 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 42 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
44 const override; | 43 const override; |
45 | 44 |
46 net::HostResolver* host_resolver() const; | 45 net::HostResolver* host_resolver() const; |
47 | 46 |
48 protected: | 47 protected: |
49 ~HeadlessURLRequestContextGetter() override; | 48 ~HeadlessURLRequestContextGetter() override; |
50 | 49 |
51 private: | 50 private: |
52 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 51 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
53 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 52 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
54 | 53 |
55 // The |options| object given to the constructor is not guaranteed to outlive | 54 // The |options| object given to the constructor is not guaranteed to outlive |
56 // this class, so we make copies of the parts we need to access on the IO | 55 // this class, so we make copies of the parts we need to access on the IO |
57 // thread. | 56 // thread. |
58 std::string user_agent_; | 57 std::string user_agent_; |
59 std::string host_resolver_rules_; | 58 std::string host_resolver_rules_; |
60 net::HostPortPair proxy_server_; | 59 net::HostPortPair proxy_server_; |
61 | 60 |
62 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | 61 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
63 std::unique_ptr<net::URLRequestContext> url_request_context_; | 62 std::unique_ptr<net::URLRequestContext> url_request_context_; |
64 content::ProtocolHandlerMap protocol_handlers_; | 63 content::ProtocolHandlerMap protocol_handlers_; |
65 content::URLRequestInterceptorScopedVector request_interceptors_; | 64 content::URLRequestInterceptorScopedVector request_interceptors_; |
66 net::NetLog* net_log_; // Not owned. | |
67 | 65 |
68 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); | 66 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); |
69 }; | 67 }; |
70 | 68 |
71 } // namespace headless | 69 } // namespace headless |
72 | 70 |
73 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ | 71 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |