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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 cache_params.max_size = http_cache_max_size; | 72 cache_params.max_size = http_cache_max_size; |
73 context_builder->EnableHttpCache(cache_params); | 73 context_builder->EnableHttpCache(cache_params); |
74 } else { | 74 } else { |
75 context_builder->DisableHttpCache(); | 75 context_builder->DisableHttpCache(); |
76 } | 76 } |
77 context_builder->set_user_agent(user_agent); | 77 context_builder->set_user_agent(user_agent); |
78 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); | 78 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); |
79 context_builder->set_quic_connection_options( | 79 context_builder->set_quic_connection_options( |
80 net::QuicUtils::ParseQuicConnectionOptions(quic_connection_options)); | 80 net::QuicUtils::ParseQuicConnectionOptions(quic_connection_options)); |
| 81 context_builder->set_sdch_enabled(enable_sdch); |
81 // TODO(mef): Use |config| to set cookies. | 82 // TODO(mef): Use |config| to set cookies. |
82 } | 83 } |
83 | 84 |
84 // static | 85 // static |
85 void URLRequestContextConfig::RegisterJSONConverter( | 86 void URLRequestContextConfig::RegisterJSONConverter( |
86 base::JSONValueConverter<URLRequestContextConfig>* converter) { | 87 base::JSONValueConverter<URLRequestContextConfig>* converter) { |
87 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_USER_AGENT, | 88 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_USER_AGENT, |
88 &URLRequestContextConfig::user_agent); | 89 &URLRequestContextConfig::user_agent); |
89 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, | 90 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, |
90 &URLRequestContextConfig::storage_path); | 91 &URLRequestContextConfig::storage_path); |
91 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, | 92 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, |
92 &URLRequestContextConfig::enable_quic); | 93 &URLRequestContextConfig::enable_quic); |
93 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, | 94 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, |
94 &URLRequestContextConfig::enable_spdy); | 95 &URLRequestContextConfig::enable_spdy); |
| 96 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SDCH, |
| 97 &URLRequestContextConfig::enable_sdch); |
95 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, | 98 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, |
96 &URLRequestContextConfig::http_cache); | 99 &URLRequestContextConfig::http_cache); |
97 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_LOAD_DISABLE_CACHE, | 100 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_LOAD_DISABLE_CACHE, |
98 &URLRequestContextConfig::load_disable_cache); | 101 &URLRequestContextConfig::load_disable_cache); |
99 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, | 102 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, |
100 &URLRequestContextConfig::http_cache_max_size); | 103 &URLRequestContextConfig::http_cache_max_size); |
101 converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_QUIC_HINTS, | 104 converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_QUIC_HINTS, |
102 &URLRequestContextConfig::quic_hints); | 105 &URLRequestContextConfig::quic_hints); |
103 converter->RegisterStringField( | 106 converter->RegisterStringField( |
104 REQUEST_CONTEXT_CONFIG_QUIC_OPTIONS, | 107 REQUEST_CONTEXT_CONFIG_QUIC_OPTIONS, |
105 &URLRequestContextConfig::quic_connection_options); | 108 &URLRequestContextConfig::quic_connection_options); |
106 } | 109 } |
107 | 110 |
108 } // namespace cronet | 111 } // namespace cronet |
OLD | NEW |