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 #include "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
6 | 6 |
7 #include "net/url_request/url_request_context_builder.h" | 7 #include "net/url_request/url_request_context_builder.h" |
8 | 8 |
9 namespace cronet { | 9 namespace cronet { |
10 | 10 |
11 #define DEFINE_CONTEXT_CONFIG(x) const char REQUEST_CONTEXT_CONFIG_##x[] = #x; | 11 #define DEFINE_CONTEXT_CONFIG(x) const char REQUEST_CONTEXT_CONFIG_##x[] = #x; |
12 #include "components/cronet/url_request_context_config_list.h" | 12 #include "components/cronet/url_request_context_config_list.h" |
13 #undef DEFINE_CONTEXT_CONFIG | 13 #undef DEFINE_CONTEXT_CONFIG |
14 | 14 |
| 15 URLRequestContextConfig::QuicHint::QuicHint() { |
| 16 } |
| 17 |
| 18 URLRequestContextConfig::QuicHint::~QuicHint() { |
| 19 } |
| 20 |
| 21 // static |
| 22 void URLRequestContextConfig::QuicHint::RegisterJSONConverter( |
| 23 base::JSONValueConverter<URLRequestContextConfig::QuicHint>* converter) { |
| 24 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_QUIC_HINT_HOST, |
| 25 &URLRequestContextConfig::QuicHint::host); |
| 26 converter->RegisterIntField( |
| 27 REQUEST_CONTEXT_CONFIG_QUIC_HINT_PORT, |
| 28 &URLRequestContextConfig::QuicHint::port); |
| 29 converter->RegisterIntField( |
| 30 REQUEST_CONTEXT_CONFIG_QUIC_HINT_ALT_PORT, |
| 31 &URLRequestContextConfig::QuicHint::alternate_port); |
| 32 } |
| 33 |
15 URLRequestContextConfig::URLRequestContextConfig() { | 34 URLRequestContextConfig::URLRequestContextConfig() { |
16 } | 35 } |
17 | 36 |
18 URLRequestContextConfig::~URLRequestContextConfig() { | 37 URLRequestContextConfig::~URLRequestContextConfig() { |
19 } | 38 } |
20 | 39 |
21 void URLRequestContextConfig::ConfigureURLRequestContextBuilder( | 40 void URLRequestContextConfig::ConfigureURLRequestContextBuilder( |
22 net::URLRequestContextBuilder* context_builder) { | 41 net::URLRequestContextBuilder* context_builder) { |
23 std::string config_cache; | 42 std::string config_cache; |
24 if (http_cache != REQUEST_CONTEXT_CONFIG_HTTP_CACHE_DISABLED) { | 43 if (http_cache != REQUEST_CONTEXT_CONFIG_HTTP_CACHE_DISABLED) { |
(...skipping 22 matching lines...) Expand all Loading... |
47 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, | 66 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, |
48 &URLRequestContextConfig::enable_quic); | 67 &URLRequestContextConfig::enable_quic); |
49 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, | 68 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, |
50 &URLRequestContextConfig::enable_spdy); | 69 &URLRequestContextConfig::enable_spdy); |
51 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, | 70 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, |
52 &URLRequestContextConfig::http_cache); | 71 &URLRequestContextConfig::http_cache); |
53 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, | 72 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, |
54 &URLRequestContextConfig::http_cache_max_size); | 73 &URLRequestContextConfig::http_cache_max_size); |
55 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, | 74 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, |
56 &URLRequestContextConfig::storage_path); | 75 &URLRequestContextConfig::storage_path); |
| 76 converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_QUIC_HINTS, |
| 77 &URLRequestContextConfig::quic_hints); |
57 } | 78 } |
58 | 79 |
59 } // namespace cronet | 80 } // namespace cronet |
OLD | NEW |