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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/json/json_value_converter.h" | 10 #include "base/json/json_value_converter.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/time/time.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 class CertVerifier; | 16 class CertVerifier; |
16 class URLRequestContextBuilder; | 17 class URLRequestContextBuilder; |
17 } // namespace net | 18 } // namespace net |
18 | 19 |
19 namespace cronet { | 20 namespace cronet { |
20 | 21 |
21 // Common configuration parameters used by Cronet to configure | 22 // Common configuration parameters used by Cronet to configure |
22 // URLRequestContext. Can be parsed from JSON string passed through JNI. | 23 // URLRequestContext. Can be parsed from JSON string passed through JNI. |
(...skipping 11 matching lines...) Expand all Loading... |
34 std::string host; | 35 std::string host; |
35 // Port of the server that supports QUIC. | 36 // Port of the server that supports QUIC. |
36 int port; | 37 int port; |
37 // Alternate protocol port. | 38 // Alternate protocol port. |
38 int alternate_port; | 39 int alternate_port; |
39 | 40 |
40 private: | 41 private: |
41 DISALLOW_COPY_AND_ASSIGN(QuicHint); | 42 DISALLOW_COPY_AND_ASSIGN(QuicHint); |
42 }; | 43 }; |
43 | 44 |
| 45 // Public-Key-Pinning configuration structure. |
| 46 struct Pkp { |
| 47 Pkp(); |
| 48 ~Pkp(); |
| 49 |
| 50 // Register |converter| for use in converter.Convert(). |
| 51 static void RegisterJSONConverter(base::JSONValueConverter<Pkp>* converter); |
| 52 |
| 53 // Host name. |
| 54 std::string host; |
| 55 // Pin hashes (currently SHA256 only). |
| 56 ScopedVector<std::string> pin_hashes; |
| 57 // Indicates whether the pinning should apply to the pinned host subdomains. |
| 58 bool include_subdomains; |
| 59 // Expiration date for the pins. |
| 60 base::Time expiration_date; |
| 61 |
| 62 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(Pkp); |
| 64 }; |
| 65 |
44 URLRequestContextConfig(); | 66 URLRequestContextConfig(); |
45 ~URLRequestContextConfig(); | 67 ~URLRequestContextConfig(); |
46 | 68 |
47 // Load config values from JSON format. | 69 // Load config values from JSON format. |
48 bool LoadFromJSON(const std::string& config_string); | 70 bool LoadFromJSON(const std::string& config_string); |
49 | 71 |
50 // Configure |context_builder| based on |this|. | 72 // Configure |context_builder| based on |this|. |
51 void ConfigureURLRequestContextBuilder( | 73 void ConfigureURLRequestContextBuilder( |
52 net::URLRequestContextBuilder* context_builder); | 74 net::URLRequestContextBuilder* context_builder); |
53 | 75 |
(...skipping 26 matching lines...) Expand all Loading... |
80 // is a JSON object with the name of the experiment as the key, and the | 102 // is a JSON object with the name of the experiment as the key, and the |
81 // configuration options as the value. An example: | 103 // configuration options as the value. An example: |
82 // {"experiment1": {"option1": "option_value1", "option2": "option_value2", | 104 // {"experiment1": {"option1": "option_value1", "option2": "option_value2", |
83 // ...}, "experiment2: {"option3", "option_value3", ...}, ...} | 105 // ...}, "experiment2: {"option3", "option_value3", ...}, ...} |
84 std::string experimental_options; | 106 std::string experimental_options; |
85 // Enable Data Reduction Proxy with authentication key. | 107 // Enable Data Reduction Proxy with authentication key. |
86 std::string data_reduction_proxy_key; | 108 std::string data_reduction_proxy_key; |
87 std::string data_reduction_primary_proxy; | 109 std::string data_reduction_primary_proxy; |
88 std::string data_reduction_fallback_proxy; | 110 std::string data_reduction_fallback_proxy; |
89 std::string data_reduction_secure_proxy_check_url; | 111 std::string data_reduction_secure_proxy_check_url; |
| 112 // The list of public key pins. |
| 113 ScopedVector<Pkp> pkp_list; |
90 | 114 |
91 // Certificate verifier for testing. | 115 // Certificate verifier for testing. |
92 scoped_ptr<net::CertVerifier> mock_cert_verifier; | 116 scoped_ptr<net::CertVerifier> mock_cert_verifier; |
93 | 117 |
94 private: | 118 private: |
95 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | 119 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); |
96 }; | 120 }; |
97 | 121 |
98 } // namespace cronet | 122 } // namespace cronet |
99 | 123 |
100 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 124 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
OLD | NEW |