| 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 "base/values.h" |
| 15 #include "net/base/hash_value.h" | 16 #include "net/base/hash_value.h" |
| 16 #include "net/cert/cert_verifier.h" | 17 #include "net/cert/cert_verifier.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class DictionaryValue; | |
| 20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
| 21 } // namespace base | 21 } // namespace base |
| 22 | 22 |
| 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, and experimental option parsing |
| 34 // should be kept more separate from applying the configuration. |
| 33 struct URLRequestContextConfig { | 35 struct URLRequestContextConfig { |
| 34 // Type of HTTP cache. | 36 // Type of HTTP cache. |
| 35 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net.impl | 37 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net.impl |
| 36 enum HttpCacheType { | 38 enum HttpCacheType { |
| 37 // No HTTP cache. | 39 // No HTTP cache. |
| 38 DISABLED, | 40 DISABLED, |
| 39 // HTTP cache persisted to disk. | 41 // HTTP cache persisted to disk. |
| 40 DISK, | 42 DISK, |
| 41 // HTTP cache kept in memory. | 43 // HTTP cache kept in memory. |
| 42 MEMORY, | 44 MEMORY, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Data to populte CertVerifierCache. | 161 // Data to populte CertVerifierCache. |
| 160 const std::string cert_verifier_data; | 162 const std::string cert_verifier_data; |
| 161 | 163 |
| 162 // App-provided list of servers that support QUIC. | 164 // App-provided list of servers that support QUIC. |
| 163 ScopedVector<QuicHint> quic_hints; | 165 ScopedVector<QuicHint> quic_hints; |
| 164 | 166 |
| 165 // The list of public key pins. | 167 // The list of public key pins. |
| 166 ScopedVector<Pkp> pkp_list; | 168 ScopedVector<Pkp> pkp_list; |
| 167 | 169 |
| 168 // Experimental options that are recognized by the config parser. | 170 // Experimental options that are recognized by the config parser. |
| 169 std::unique_ptr<base::DictionaryValue> effective_experimental_options; | 171 std::unique_ptr<base::DictionaryValue> effective_experimental_options = |
| 172 nullptr; |
| 170 | 173 |
| 171 private: | 174 private: |
| 175 // Parses experimental options and makes appropriate changes to settings in |
| 176 // the URLRequestContextConfig and URLRequestContextBuilder. |
| 177 void ParseAndSetExperimentalOptions( |
| 178 net::URLRequestContextBuilder* context_builder, |
| 179 net::NetLog* net_log, |
| 180 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); |
| 181 |
| 172 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | 182 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); |
| 173 }; | 183 }; |
| 174 | 184 |
| 175 // Stores intermediate state for URLRequestContextConfig. Initializes with | 185 // Stores intermediate state for URLRequestContextConfig. Initializes with |
| 176 // (mostly) sane defaults, then the appropriate member variables can be | 186 // (mostly) sane defaults, then the appropriate member variables can be |
| 177 // modified, and it can be finalized with Build(). | 187 // modified, and it can be finalized with Build(). |
| 178 struct URLRequestContextConfigBuilder { | 188 struct URLRequestContextConfigBuilder { |
| 179 URLRequestContextConfigBuilder(); | 189 URLRequestContextConfigBuilder(); |
| 180 ~URLRequestContextConfigBuilder(); | 190 ~URLRequestContextConfigBuilder(); |
| 181 | 191 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Data to populate CertVerifierCache. | 236 // Data to populate CertVerifierCache. |
| 227 std::string cert_verifier_data = ""; | 237 std::string cert_verifier_data = ""; |
| 228 | 238 |
| 229 private: | 239 private: |
| 230 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); | 240 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfigBuilder); |
| 231 }; | 241 }; |
| 232 | 242 |
| 233 } // namespace cronet | 243 } // namespace cronet |
| 234 | 244 |
| 235 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 245 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
| OLD | NEW |