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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 cache_params.path = base::FilePath(storage_path); | 48 cache_params.path = base::FilePath(storage_path); |
49 } else { | 49 } else { |
50 cache_params.type = | 50 cache_params.type = |
51 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY; | 51 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY; |
52 } | 52 } |
53 cache_params.max_size = http_cache_max_size; | 53 cache_params.max_size = http_cache_max_size; |
54 context_builder->EnableHttpCache(cache_params); | 54 context_builder->EnableHttpCache(cache_params); |
55 } else { | 55 } else { |
56 context_builder->DisableHttpCache(); | 56 context_builder->DisableHttpCache(); |
57 } | 57 } |
58 | 58 context_builder->set_user_agent(user_agent); |
59 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); | 59 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); |
60 // TODO(mef): Use |config| to set cookies. | 60 // TODO(mef): Use |config| to set cookies. |
61 } | 61 } |
62 | 62 |
63 // static | 63 // static |
64 void URLRequestContextConfig::RegisterJSONConverter( | 64 void URLRequestContextConfig::RegisterJSONConverter( |
65 base::JSONValueConverter<URLRequestContextConfig>* converter) { | 65 base::JSONValueConverter<URLRequestContextConfig>* converter) { |
66 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, | 66 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_QUIC, |
67 &URLRequestContextConfig::enable_quic); | 67 &URLRequestContextConfig::enable_quic); |
68 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, | 68 converter->RegisterBoolField(REQUEST_CONTEXT_CONFIG_ENABLE_SPDY, |
69 &URLRequestContextConfig::enable_spdy); | 69 &URLRequestContextConfig::enable_spdy); |
70 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, | 70 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE, |
71 &URLRequestContextConfig::http_cache); | 71 &URLRequestContextConfig::http_cache); |
72 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, | 72 converter->RegisterIntField(REQUEST_CONTEXT_CONFIG_HTTP_CACHE_MAX_SIZE, |
73 &URLRequestContextConfig::http_cache_max_size); | 73 &URLRequestContextConfig::http_cache_max_size); |
74 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, | 74 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_STORAGE_PATH, |
75 &URLRequestContextConfig::storage_path); | 75 &URLRequestContextConfig::storage_path); |
76 converter->RegisterStringField(REQUEST_CONTEXT_CONFIG_USER_AGENT, | |
77 &URLRequestContextConfig::user_agent); | |
76 converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_QUIC_HINTS, | 78 converter->RegisterRepeatedMessage(REQUEST_CONTEXT_CONFIG_QUIC_HINTS, |
77 &URLRequestContextConfig::quic_hints); | 79 &URLRequestContextConfig::quic_hints); |
mmenke
2014/11/06 20:50:15
Should try to match order here and in url_request_
mef
2014/11/06 22:51:47
Done.
| |
78 } | 80 } |
79 | 81 |
80 } // namespace cronet | 82 } // namespace cronet |
OLD | NEW |