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 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "net/base/hash_value.h" | 15 #include "net/base/hash_value.h" |
| 16 #include "net/cert/cert_verifier.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
19 } // namespace base | 20 } // namespace base |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 class CertVerifier; | 23 class CertVerifier; |
23 class NetLog; | 24 class NetLog; |
24 class URLRequestContextBuilder; | 25 class URLRequestContextBuilder; |
25 } // namespace net | 26 } // namespace net |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // App-provided list of servers that support QUIC. | 170 // App-provided list of servers that support QUIC. |
170 ScopedVector<QuicHint> quic_hints; | 171 ScopedVector<QuicHint> quic_hints; |
171 | 172 |
172 // The list of public key pins. | 173 // The list of public key pins. |
173 ScopedVector<Pkp> pkp_list; | 174 ScopedVector<Pkp> pkp_list; |
174 | 175 |
175 private: | 176 private: |
176 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | 177 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); |
177 }; | 178 }; |
178 | 179 |
| 180 // Stores intermediate state for URLRequestContextConfig. Initializes with |
| 181 // (mostly) sane defaults, then the appropriate member variables can be |
| 182 // modified, and it can be finalized with Build(). |
| 183 struct URLRequestContextConfigBuilder { |
| 184 URLRequestContextConfigBuilder(); |
| 185 ~URLRequestContextConfigBuilder(); |
| 186 |
| 187 // Finalize state into a URLRequestContextConfig. Must only be called once, |
| 188 // as once |mock_cert_verifier| is moved into a URLRequestContextConfig, it |
| 189 // cannot be used again. |
| 190 std::unique_ptr<URLRequestContextConfig> Build(); |
| 191 |
| 192 // Enable QUIC. |
| 193 bool enable_quic = false; |
| 194 // QUIC User Agent ID. |
| 195 std::string quic_user_agent_id = ""; |
| 196 // Enable SPDY. |
| 197 bool enable_spdy = true; |
| 198 // Enable SDCH. |
| 199 bool enable_sdch = false; |
| 200 // Type of http cache. |
| 201 URLRequestContextConfig::HttpCacheType http_cache = |
| 202 URLRequestContextConfig::DISABLED; |
| 203 // Max size of http cache in bytes. |
| 204 int http_cache_max_size = 0; |
| 205 // Disable caching for HTTP responses. Other information may be stored in |
| 206 // the cache. |
| 207 bool load_disable_cache = false; |
| 208 // Storage path for http cache and cookie storage. |
| 209 std::string storage_path = ""; |
| 210 // User-Agent request header field. |
| 211 std::string user_agent = ""; |
| 212 // Experimental options encoded as a string in a JSON format containing |
| 213 // experiments and their corresponding configuration options. The format |
| 214 // is a JSON object with the name of the experiment as the key, and the |
| 215 // configuration options as the value. An example: |
| 216 // {"experiment1": {"option1": "option_value1", "option2": "option_value2", |
| 217 // ...}, "experiment2: {"option3", "option_value3", ...}, ...} |
| 218 std::string experimental_options = "{}"; |
| 219 // Enable Data Reduction Proxy with authentication key. |
| 220 std::string data_reduction_proxy_key = ""; |
| 221 std::string data_reduction_primary_proxy = ""; |
| 222 std::string data_reduction_fallback_proxy = ""; |
| 223 std::string data_reduction_secure_proxy_check_url = ""; |
| 224 |
| 225 // Certificate verifier for testing. |
| 226 std::unique_ptr<net::CertVerifier> mock_cert_verifier = nullptr; |
| 227 |
| 228 // Enable network quality estimator. |
| 229 bool enable_network_quality_estimator = false; |
| 230 |
| 231 // Enable public key pinning bypass for local trust anchors. |
| 232 bool bypass_public_key_pinning_for_local_trust_anchors = true; |
| 233 |
| 234 // Data to populate CertVerifierCache. |
| 235 std::string cert_verifier_data = ""; |
| 236 |
| 237 private: |
| 238 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); |
| 239 }; |
| 240 |
179 } // namespace cronet | 241 } // namespace cronet |
180 | 242 |
181 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 243 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
OLD | NEW |