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 COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 5 #ifndef COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
6 #define COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 6 #define COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/optional.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "net/base/hash_value.h" | 17 #include "net/base/hash_value.h" |
17 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
| 19 #include "net/nqe/effective_connection_type.h" |
18 | 20 |
19 namespace base { | 21 namespace base { |
20 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
21 } // namespace base | 23 } // namespace base |
22 | 24 |
23 namespace net { | 25 namespace net { |
24 class CertVerifier; | 26 class CertVerifier; |
25 class NetLog; | 27 class NetLog; |
26 class URLRequestContextBuilder; | 28 class URLRequestContextBuilder; |
27 } // namespace net | 29 } // namespace net |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const HttpCacheType http_cache; | 136 const HttpCacheType http_cache; |
135 // Max size of http cache in bytes. | 137 // Max size of http cache in bytes. |
136 const int http_cache_max_size; | 138 const int http_cache_max_size; |
137 // Disable caching for HTTP responses. Other information may be stored in | 139 // Disable caching for HTTP responses. Other information may be stored in |
138 // the cache. | 140 // the cache. |
139 const bool load_disable_cache; | 141 const bool load_disable_cache; |
140 // Storage path for http cache and cookie storage. | 142 // Storage path for http cache and cookie storage. |
141 const std::string storage_path; | 143 const std::string storage_path; |
142 // User-Agent request header field. | 144 // User-Agent request header field. |
143 const std::string user_agent; | 145 const std::string user_agent; |
144 // Experimental options encoded as a string in a JSON format containing | |
145 // experiments and their corresponding configuration options. The format | |
146 // is a JSON object with the name of the experiment as the key, and the | |
147 // configuration options as the value. An example: | |
148 // {"experiment1": {"option1": "option_value1", "option2": "option_value2", | |
149 // ...}, "experiment2: {"option3", "option_value3", ...}, ...} | |
150 const std::string experimental_options; | |
151 | 146 |
152 // Certificate verifier for testing. | 147 // Certificate verifier for testing. |
153 std::unique_ptr<net::CertVerifier> mock_cert_verifier; | 148 std::unique_ptr<net::CertVerifier> mock_cert_verifier; |
154 | 149 |
155 // Enable network quality estimator. | 150 // Enable Network Quality Estimator (NQE). |
156 const bool enable_network_quality_estimator; | 151 const bool enable_network_quality_estimator; |
157 | 152 |
158 // Enable public key pinning bypass for local trust anchors. | 153 // Enable public key pinning bypass for local trust anchors. |
159 const bool bypass_public_key_pinning_for_local_trust_anchors; | 154 const bool bypass_public_key_pinning_for_local_trust_anchors; |
160 | 155 |
161 // Data to populte CertVerifierCache. | 156 // Data to populte CertVerifierCache. |
162 const std::string cert_verifier_data; | 157 const std::string cert_verifier_data; |
163 | 158 |
164 // App-provided list of servers that support QUIC. | 159 // App-provided list of servers that support QUIC. |
165 std::vector<std::unique_ptr<QuicHint>> quic_hints; | 160 std::vector<std::unique_ptr<QuicHint>> quic_hints; |
166 | 161 |
167 // The list of public key pins. | 162 // The list of public key pins. |
168 std::vector<std::unique_ptr<Pkp>> pkp_list; | 163 std::vector<std::unique_ptr<Pkp>> pkp_list; |
169 | 164 |
170 // Enable DNS cache persistence. | 165 // Enable DNS cache persistence. |
171 bool enable_host_cache_persistence = false; | 166 bool enable_host_cache_persistence = false; |
172 | 167 |
173 // Minimum time in milliseconds between writing the HostCache contents to | 168 // Minimum time in milliseconds between writing the HostCache contents to |
174 // prefs. Only relevant when |enable_host_cache_persistence| is true. | 169 // prefs. Only relevant when |enable_host_cache_persistence| is true. |
175 int host_cache_persistence_delay_ms = 60000; | 170 int host_cache_persistence_delay_ms = 60000; |
176 | 171 |
177 // Experimental options that are recognized by the config parser. | 172 // Experimental options that are recognized by the config parser. |
178 std::unique_ptr<base::DictionaryValue> effective_experimental_options = | 173 std::unique_ptr<base::DictionaryValue> effective_experimental_options = |
179 nullptr; | 174 nullptr; |
180 | 175 |
| 176 // Enable reading of the network quality from the prefs. |
| 177 bool nqe_persistent_caching_enabled; |
| 178 |
| 179 // If set, forces NQE to return the set value as the effective connection |
| 180 // type. |
| 181 base::Optional<net::EffectiveConnectionType> |
| 182 nqe_forced_effective_connection_type; |
| 183 |
181 private: | 184 private: |
182 // Parses experimental options and makes appropriate changes to settings in | 185 // Parses experimental options and makes appropriate changes to settings in |
183 // the URLRequestContextConfig and URLRequestContextBuilder. | 186 // the URLRequestContextConfig and URLRequestContextBuilder. |
184 void ParseAndSetExperimentalOptions( | 187 void ParseAndSetExperimentalOptions( |
185 net::URLRequestContextBuilder* context_builder, | 188 net::URLRequestContextBuilder* context_builder, |
186 net::NetLog* net_log, | 189 net::NetLog* net_log, |
187 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); | 190 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); |
188 | 191 |
| 192 // Experimental options encoded as a string in a JSON format containing |
| 193 // experiments and their corresponding configuration options. The format |
| 194 // is a JSON object with the name of the experiment as the key, and the |
| 195 // configuration options as the value. An example: |
| 196 // {"experiment1": {"option1": "option_value1", "option2": "option_value2", |
| 197 // ...}, "experiment2: {"option3", "option_value3", ...}, ...} |
| 198 const std::string experimental_options; |
| 199 |
189 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | 200 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); |
190 }; | 201 }; |
191 | 202 |
192 // Stores intermediate state for URLRequestContextConfig. Initializes with | 203 // Stores intermediate state for URLRequestContextConfig. Initializes with |
193 // (mostly) sane defaults, then the appropriate member variables can be | 204 // (mostly) sane defaults, then the appropriate member variables can be |
194 // modified, and it can be finalized with Build(). | 205 // modified, and it can be finalized with Build(). |
195 struct URLRequestContextConfigBuilder { | 206 struct URLRequestContextConfigBuilder { |
196 URLRequestContextConfigBuilder(); | 207 URLRequestContextConfigBuilder(); |
197 ~URLRequestContextConfigBuilder(); | 208 ~URLRequestContextConfigBuilder(); |
198 | 209 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Data to populate CertVerifierCache. | 254 // Data to populate CertVerifierCache. |
244 std::string cert_verifier_data = ""; | 255 std::string cert_verifier_data = ""; |
245 | 256 |
246 private: | 257 private: |
247 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); | 258 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); |
248 }; | 259 }; |
249 | 260 |
250 } // namespace cronet | 261 } // namespace cronet |
251 | 262 |
252 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 263 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
OLD | NEW |