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" | |
12 #include "base/memory/scoped_vector.h" | |
11 | 13 |
12 namespace net { | 14 namespace net { |
13 class URLRequestContextBuilder; | 15 class URLRequestContextBuilder; |
14 } // namespace net | 16 } // namespace net |
15 | 17 |
16 namespace cronet { | 18 namespace cronet { |
17 | 19 |
18 // Common configuration parameters used by Cronet to configure | 20 // Common configuration parameters used by Cronet to configure |
19 // URLRequestContext. Can be parsed from JSON string passed through JNI. | 21 // URLRequestContext. Can be parsed from JSON string passed through JNI. |
20 struct URLRequestContextConfig { | 22 struct URLRequestContextConfig { |
23 // App-provided hint that server supports QUIC. | |
24 struct QuicHint { | |
25 QuicHint(); | |
26 ~QuicHint(); | |
27 | |
28 // Register |converter| for use in converter.Convert(). | |
29 static void RegisterJSONConverter( | |
30 base::JSONValueConverter<QuicHint>* converter); | |
31 | |
32 // URL of the server that supports QUIC. | |
33 std::string server; | |
Ryan Hamilton
2014/09/10 20:58:19
If this is a URL it seems like the type should be
mmenke
2014/09/10 21:10:18
This is created automatically from a JSON-formatte
| |
34 // Alternate protocol port. | |
35 int alternate_port; | |
36 | |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(QuicHint); | |
39 }; | |
40 | |
21 URLRequestContextConfig(); | 41 URLRequestContextConfig(); |
22 ~URLRequestContextConfig(); | 42 ~URLRequestContextConfig(); |
23 | 43 |
24 // Configure |context_builder| based on |this|. | 44 // Configure |context_builder| based on |this|. |
25 void ConfigureURLRequestContextBuilder( | 45 void ConfigureURLRequestContextBuilder( |
26 net::URLRequestContextBuilder* context_builder); | 46 net::URLRequestContextBuilder* context_builder); |
27 | 47 |
28 // Register |converter| for use in converter.Convert(). | 48 // Register |converter| for use in converter.Convert(). |
29 static void RegisterJSONConverter( | 49 static void RegisterJSONConverter( |
30 base::JSONValueConverter<URLRequestContextConfig>* converter); | 50 base::JSONValueConverter<URLRequestContextConfig>* converter); |
31 | 51 |
32 // Enable QUIC. | 52 // Enable QUIC. |
33 bool enable_quic; | 53 bool enable_quic; |
34 // Enable SPDY. | 54 // Enable SPDY. |
35 bool enable_spdy; | 55 bool enable_spdy; |
36 // Type of http cache: "HTTP_CACHE_DISABLED", "HTTP_CACHE_DISK" or | 56 // Type of http cache: "HTTP_CACHE_DISABLED", "HTTP_CACHE_DISK" or |
37 // "HTTP_CACHE_IN_MEMORY". | 57 // "HTTP_CACHE_IN_MEMORY". |
38 std::string http_cache; | 58 std::string http_cache; |
39 // Max size of http cache in bytes. | 59 // Max size of http cache in bytes. |
40 int http_cache_max_size; | 60 int http_cache_max_size; |
41 // Storage path for http cache and cookie storage. | 61 // Storage path for http cache and cookie storage. |
42 std::string storage_path; | 62 std::string storage_path; |
63 // App-provided list of servers that support QUIC. | |
64 ScopedVector<QuicHint> quic_hints; | |
65 | |
66 private: | |
67 DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); | |
43 }; | 68 }; |
44 | 69 |
45 } // namespace cronet | 70 } // namespace cronet |
46 | 71 |
47 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ | 72 #endif // COMPONENTS_CRONET_URL_REQUEST_CONTEXT_CONFIG_H_ |
OLD | NEW |