OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_CRNET_CRNET_ENVIRONMENT_H_ | 5 #ifndef IOS_CRNET_CRNET_ENVIRONMENT_H_ |
6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ | 6 #define IOS_CRNET_CRNET_ENVIRONMENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class CrNetHttpProtocolHandlerDelegate; | 33 class CrNetHttpProtocolHandlerDelegate; |
34 | 34 |
35 // CrNetEnvironment contains all the network stack configuration | 35 // CrNetEnvironment contains all the network stack configuration |
36 // and initialization. | 36 // and initialization. |
37 class CrNetEnvironment { | 37 class CrNetEnvironment { |
38 public: | 38 public: |
39 // Must be called on the main thread. | 39 // Must be called on the main thread. |
40 static void Initialize(); | 40 static void Initialize(); |
41 | 41 |
42 // |user_agent_product_name| will be used to generate the user-agent. | 42 // If |user_agent_partial| is true, then |user_agent| will be used to |
43 CrNetEnvironment(const std::string& user_agent_product_name); | 43 // generate the user-agent, otherwise it will be used directly. |
| 44 CrNetEnvironment(const std::string& user_agent, bool user_agent_partial); |
44 ~CrNetEnvironment(); | 45 ~CrNetEnvironment(); |
45 | 46 |
46 // Installs this CrNet environment so requests are intercepted. | 47 // Installs this CrNet environment so requests are intercepted. |
47 // Can only be called once; to enable/disable CrNet at runtime, use | 48 // Can only be called once; to enable/disable CrNet at runtime, use |
48 // SetHTTPProtocolHandlerRegistered. | 49 // SetHTTPProtocolHandlerRegistered. |
49 void Install(); | 50 void Install(); |
50 | 51 |
51 // Installs this CrNet environment into the supplied | 52 // Installs this CrNet environment into the supplied |
52 // NSURLSessionConfiguration. Settings are inherited from the shared | 53 // NSURLSessionConfiguration. Settings are inherited from the shared |
53 // NSURLSessionConfiguration, which Install() affects. | 54 // NSURLSessionConfiguration, which Install() affects. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; | 150 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; |
150 scoped_refptr<JsonPrefStore> net_pref_store_; | 151 scoped_refptr<JsonPrefStore> net_pref_store_; |
151 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 152 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
152 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | 153 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
153 std::unique_ptr<net::HttpServerProperties> http_server_properties_; | 154 std::unique_ptr<net::HttpServerProperties> http_server_properties_; |
154 std::unique_ptr<net::CookieStore> cookie_store_; | 155 std::unique_ptr<net::CookieStore> cookie_store_; |
155 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; | 156 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; |
156 std::unique_ptr<net::URLRequestContext> main_context_; | 157 std::unique_ptr<net::URLRequestContext> main_context_; |
157 std::unique_ptr<CrNetHttpProtocolHandlerDelegate> | 158 std::unique_ptr<CrNetHttpProtocolHandlerDelegate> |
158 http_protocol_handler_delegate_; | 159 http_protocol_handler_delegate_; |
159 std::string user_agent_product_name_; | 160 std::string user_agent_; |
| 161 bool user_agent_partial_; |
160 std::unique_ptr<net::NetLog> net_log_; | 162 std::unique_ptr<net::NetLog> net_log_; |
161 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 163 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
162 | 164 |
163 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); | 165 DISALLOW_COPY_AND_ASSIGN(CrNetEnvironment); |
164 }; | 166 }; |
165 | 167 |
166 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ | 168 #endif // IOS_CRNET_CRNET_ENVIRONMENT_H_ |
OLD | NEW |