OLD | NEW |
1 // Copyright 2013 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 CONTENT_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
6 #define CONTENT_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
13 #include "net/proxy/proxy_config_service.h" | 13 #include "net/proxy/proxy_config_service.h" |
14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.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 base { | 17 namespace base { |
18 class MessageLoop; | 18 class MessageLoop; |
19 } | 19 } |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class HostResolver; | 22 class HostResolver; |
23 class MappedHostResolver; | 23 class MappedHostResolver; |
24 class NetworkDelegate; | 24 class NetworkDelegate; |
25 class NetLog; | 25 class NetLog; |
26 class ProxyConfigService; | 26 class ProxyConfigService; |
27 class ProxyService; | 27 class ProxyService; |
28 class URLRequestContextStorage; | 28 class URLRequestContextStorage; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace headless { |
32 | 32 |
33 class ShellURLRequestContextGetter : public net::URLRequestContextGetter { | 33 class HeadlessURLRequestContextGetter : public net::URLRequestContextGetter { |
34 public: | 34 public: |
35 ShellURLRequestContextGetter( | 35 HeadlessURLRequestContextGetter( |
36 bool ignore_certificate_errors, | 36 bool ignore_certificate_errors, |
37 const base::FilePath& base_path, | 37 const base::FilePath& base_path, |
38 base::MessageLoop* io_loop, | 38 base::MessageLoop* io_loop, |
39 base::MessageLoop* file_loop, | 39 base::MessageLoop* file_loop, |
40 ProtocolHandlerMap* protocol_handlers, | 40 content::ProtocolHandlerMap* protocol_handlers, |
41 URLRequestInterceptorScopedVector request_interceptors, | 41 content::URLRequestInterceptorScopedVector request_interceptors, |
42 net::NetLog* net_log); | 42 net::NetLog* net_log); |
43 | 43 |
44 // net::URLRequestContextGetter implementation. | 44 // net::URLRequestContextGetter implementation. |
45 net::URLRequestContext* GetURLRequestContext() override; | 45 net::URLRequestContext* GetURLRequestContext() override; |
46 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 46 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
47 const override; | 47 const override; |
48 | 48 |
49 net::HostResolver* host_resolver(); | 49 net::HostResolver* host_resolver(); |
50 | 50 |
51 protected: | 51 protected: |
52 ~ShellURLRequestContextGetter() override; | 52 ~HeadlessURLRequestContextGetter() override; |
53 | 53 |
54 // Used by subclasses to create their own implementation of NetworkDelegate | 54 // Used by subclasses to create their own implementation of NetworkDelegate |
55 // and net::ProxyService. | 55 // and net::ProxyService. |
56 virtual scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate(); | 56 virtual scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate(); |
57 virtual scoped_ptr<net::ProxyConfigService> GetProxyConfigService(); | 57 virtual scoped_ptr<net::ProxyConfigService> GetProxyConfigService(); |
58 virtual scoped_ptr<net::ProxyService> GetProxyService(); | 58 virtual scoped_ptr<net::ProxyService> GetProxyService(); |
59 | 59 |
60 private: | 60 private: |
61 bool ignore_certificate_errors_; | 61 bool ignore_certificate_errors_; |
62 base::FilePath base_path_; | 62 base::FilePath base_path_; |
63 base::MessageLoop* io_loop_; | 63 base::MessageLoop* io_loop_; |
64 base::MessageLoop* file_loop_; | 64 base::MessageLoop* file_loop_; |
65 net::NetLog* net_log_; | 65 net::NetLog* net_log_; |
66 | 66 |
67 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 67 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
68 scoped_ptr<net::NetworkDelegate> network_delegate_; | 68 scoped_ptr<net::NetworkDelegate> network_delegate_; |
69 scoped_ptr<net::URLRequestContextStorage> storage_; | 69 scoped_ptr<net::URLRequestContextStorage> storage_; |
70 scoped_ptr<net::URLRequestContext> url_request_context_; | 70 scoped_ptr<net::URLRequestContext> url_request_context_; |
71 ProtocolHandlerMap protocol_handlers_; | 71 content::ProtocolHandlerMap protocol_handlers_; |
72 URLRequestInterceptorScopedVector request_interceptors_; | 72 content::URLRequestInterceptorScopedVector request_interceptors_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(ShellURLRequestContextGetter); | 74 DISALLOW_COPY_AND_ASSIGN(HeadlessURLRequestContextGetter); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace content | 77 } // namespace headless |
78 | 78 |
79 #endif // CONTENT_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_ | 79 #endif // HEADLESS_LIB_BROWSER_HEADLESS_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |