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 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 namespace net { | 23 namespace net { |
24 class CertVerifier; | 24 class CertVerifier; |
25 class NetLog; | 25 class NetLog; |
26 class URLRequestContextBuilder; | 26 class URLRequestContextBuilder; |
27 } // namespace net | 27 } // namespace net |
28 | 28 |
29 namespace cronet { | 29 namespace cronet { |
30 | 30 |
31 // Common configuration parameters used by Cronet to configure | 31 // Common configuration parameters used by Cronet to configure |
32 // URLRequestContext. | 32 // URLRequestContext. |
33 // TODO(mgersh): This shouldn't be a struct. Refactor into a struct that holds | |
34 // the data and a class that handles the logic and holds the struct, or some | |
35 // other more reasonable way of passing around configuration. | |
33 struct URLRequestContextConfig { | 36 struct URLRequestContextConfig { |
34 // Type of HTTP cache. | 37 // Type of HTTP cache. |
35 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net.impl | 38 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net.impl |
36 enum HttpCacheType { | 39 enum HttpCacheType { |
37 // No HTTP cache. | 40 // No HTTP cache. |
38 DISABLED, | 41 DISABLED, |
39 // HTTP cache persisted to disk. | 42 // HTTP cache persisted to disk. |
40 DISK, | 43 DISK, |
41 // HTTP cache kept in memory. | 44 // HTTP cache kept in memory. |
42 MEMORY, | 45 MEMORY, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // MockCertVerifier to use for testing purposes. | 108 // MockCertVerifier to use for testing purposes. |
106 std::unique_ptr<net::CertVerifier> mock_cert_verifier, | 109 std::unique_ptr<net::CertVerifier> mock_cert_verifier, |
107 // Enable network quality estimator. | 110 // Enable network quality estimator. |
108 bool enable_network_quality_estimator, | 111 bool enable_network_quality_estimator, |
109 // Enable bypassing of public key pinning for local trust anchors | 112 // Enable bypassing of public key pinning for local trust anchors |
110 bool bypass_public_key_pinning_for_local_trust_anchors, | 113 bool bypass_public_key_pinning_for_local_trust_anchors, |
111 // Certificate verifier cache data. | 114 // Certificate verifier cache data. |
112 const std::string& cert_verifier_data); | 115 const std::string& cert_verifier_data); |
113 ~URLRequestContextConfig(); | 116 ~URLRequestContextConfig(); |
114 | 117 |
118 // Parses experimental options and makes appropriate changes to settings in | |
119 // the URLRequestContextConfig and URLRequestContextBuilder. | |
120 void ParseAndSetExperimentalOptions( | |
kapishnikov
2017/06/20 19:34:08
This method looks internal to URLRequestContextCon
mgersh
2017/06/20 21:33:57
Made it private.
| |
121 net::URLRequestContextBuilder* context_builder, | |
122 net::NetLog* net_log, | |
123 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); | |
124 | |
115 // Configures |context_builder| based on |this|. | 125 // Configures |context_builder| based on |this|. |
116 void ConfigureURLRequestContextBuilder( | 126 void ConfigureURLRequestContextBuilder( |
117 net::URLRequestContextBuilder* context_builder, | 127 net::URLRequestContextBuilder* context_builder, |
118 net::NetLog* net_log, | 128 net::NetLog* net_log, |
119 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); | 129 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); |
120 | 130 |
121 // Enable QUIC. | 131 // Enable QUIC. |
122 const bool enable_quic; | 132 const bool enable_quic; |
123 // QUIC User Agent ID. | 133 // QUIC User Agent ID. |
124 const std::string quic_user_agent_id; | 134 const std::string quic_user_agent_id; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 // Data to populte CertVerifierCache. | 169 // Data to populte CertVerifierCache. |
160 const std::string cert_verifier_data; | 170 const std::string cert_verifier_data; |
161 | 171 |
162 // App-provided list of servers that support QUIC. | 172 // App-provided list of servers that support QUIC. |
163 ScopedVector<QuicHint> quic_hints; | 173 ScopedVector<QuicHint> quic_hints; |
164 | 174 |
165 // The list of public key pins. | 175 // The list of public key pins. |
166 ScopedVector<Pkp> pkp_list; | 176 ScopedVector<Pkp> pkp_list; |
167 | 177 |
168 // Experimental options that are recognized by the config parser. | 178 // Experimental options that are recognized by the config parser. |
169 std::unique_ptr<base::DictionaryValue> effective_experimental_options; | 179 std::unique_ptr<base::DictionaryValue> effective_experimental_options = |
180 nullptr; | |
170 | 181 |
171 private: | 182 private: |
172 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | 183 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); |
173 }; | 184 }; |
174 | 185 |
175 // Stores intermediate state for URLRequestContextConfig. Initializes with | 186 // Stores intermediate state for URLRequestContextConfig. Initializes with |
176 // (mostly) sane defaults, then the appropriate member variables can be | 187 // (mostly) sane defaults, then the appropriate member variables can be |
177 // modified, and it can be finalized with Build(). | 188 // modified, and it can be finalized with Build(). |
178 struct URLRequestContextConfigBuilder { | 189 struct URLRequestContextConfigBuilder { |
179 URLRequestContextConfigBuilder(); | 190 URLRequestContextConfigBuilder(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // Data to populate CertVerifierCache. | 237 // Data to populate CertVerifierCache. |
227 std::string cert_verifier_data = ""; | 238 std::string cert_verifier_data = ""; |
228 | 239 |
229 private: | 240 private: |
230 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); | 241 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); |
231 }; | 242 }; |
232 | 243 |
233 } // namespace cronet | 244 } // namespace cronet |
234 | 245 |
235 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 246 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
OLD | NEW |