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