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 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import org.json.JSONArray; | 7 import org.json.JSONArray; |
8 import org.json.JSONException; | 8 import org.json.JSONException; |
9 import org.json.JSONObject; | 9 import org.json.JSONObject; |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 } | 95 } |
96 | 96 |
97 /** | 97 /** |
98 * Boolean, enable SPDY if true. | 98 * Boolean, enable SPDY if true. |
99 */ | 99 */ |
100 public UrlRequestContextConfig enableSPDY(boolean value) { | 100 public UrlRequestContextConfig enableSPDY(boolean value) { |
101 return putBoolean(UrlRequestContextConfigList.ENABLE_SPDY, value); | 101 return putBoolean(UrlRequestContextConfigList.ENABLE_SPDY, value); |
102 } | 102 } |
103 | 103 |
104 /** | 104 /** |
105 * Boolean, enable Data Reduction Proxy if true. The key is used to | |
106 * authenticate with the proxy. | |
107 */ | |
108 public UrlRequestContextConfig enableDataReductionProxy(boolean value, | |
mmenke
2015/04/24 19:10:28
Wonder if we really need a value - if you don't wa
bengr
2015/04/24 21:13:51
Probably not necessary immediately, but I wanted e
mmenke
2015/04/24 21:17:59
Note that we don't support modifying the config af
bengr
2015/04/24 22:12:44
Done.
| |
109 String key) { | |
110 return (putBoolean(UrlRequestContextConfigList | |
111 .ENABLE_DATA_REDUCTION_PROXY, value) | |
112 .putString(UrlRequestContextConfigList | |
113 .DATA_REDUCTION_PROXY_KEY, key)); | |
114 } | |
115 | |
116 /** | |
105 * Enumeration, disable or enable cache in memory or on disk. | 117 * Enumeration, disable or enable cache in memory or on disk. |
106 */ | 118 */ |
107 public enum HttpCache { | 119 public enum HttpCache { |
108 /** | 120 /** |
109 * Disable cache, some data may still be temporarily stored in memory. | 121 * Disable cache, some data may still be temporarily stored in memory. |
110 */ | 122 */ |
111 DISABLED, | 123 DISABLED, |
112 | 124 |
113 /** | 125 /** |
114 * Enable in memory cache, including HTTP data. | 126 * Enable in memory cache, including HTTP data. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 * @param quicConnectionOptions comma-separated QUIC options (for example | 222 * @param quicConnectionOptions comma-separated QUIC options (for example |
211 * "PACE,IW10") to use if QUIC is enabled. | 223 * "PACE,IW10") to use if QUIC is enabled. |
212 */ | 224 */ |
213 public UrlRequestContextConfig setExperimentalQuicConnectionOptions( | 225 public UrlRequestContextConfig setExperimentalQuicConnectionOptions( |
214 String quicConnectionOptions) { | 226 String quicConnectionOptions) { |
215 return putString(UrlRequestContextConfigList.QUIC_OPTIONS, | 227 return putString(UrlRequestContextConfigList.QUIC_OPTIONS, |
216 quicConnectionOptions); | 228 quicConnectionOptions); |
217 } | 229 } |
218 | 230 |
219 /** | 231 /** |
232 * Overrides Data Reduction Proxy configuration parameters with a primary | |
mmenke
2015/04/24 19:10:28
Overrides parameters implies we have defaults, but
bengr
2015/04/24 21:13:51
We do. They are hard coded in DRP code for now.
| |
233 * proxy name, fallback proxy name, and a secure proxy check url. Proxies | |
234 * are specified as scheme://host[:port]. | |
235 * @param primaryProxy | |
236 * @param fallbackProxy | |
237 * @param secureProxyCheck | |
238 */ | |
mmenke
2015/04/24 19:10:28
Suggest moving this below the other DRP method (Kn
bengr
2015/04/24 21:13:51
Done.
| |
239 public UrlRequestContextConfig setDataReductionProxyOptions( | |
240 String primaryProxy, | |
241 String fallbackProxy, | |
242 String secureProxyCheckUrl) { | |
mmenke
2015/04/24 19:10:28
IF any of these are empty throw an IllegalArgument
bengr
2015/04/24 21:13:51
Done.
| |
243 return putString( | |
244 UrlRequestContextConfigList.DATA_REDUCTION_PRIMARY_PROXY, | |
245 primaryProxy) | |
246 .putString(UrlRequestContextConfigList | |
247 .DATA_REDUCTION_FALLBACK_PROXY, fallbackProxy) | |
248 .putString(UrlRequestContextConfigList | |
249 .DATA_REDUCTION_SECURE_PROXY_CHECK_URL, | |
250 secureProxyCheckUrl); | |
mmenke
2015/04/24 19:10:28
Think this would be more legibly as just 3 indepen
bengr
2015/04/24 21:13:51
Done.
| |
251 } | |
252 | |
253 /** | |
220 * Get JSON string representation of the config. | 254 * Get JSON string representation of the config. |
221 */ | 255 */ |
222 @Override | 256 @Override |
223 public String toString() { | 257 public String toString() { |
224 return mConfig.toString(); | 258 return mConfig.toString(); |
225 } | 259 } |
226 | 260 |
227 /** | 261 /** |
228 * Sets a boolean value in the config. Returns a reference to the same | 262 * Sets a boolean value in the config. Returns a reference to the same |
229 * config object, so you can chain put calls together. | 263 * config object, so you can chain put calls together. |
(...skipping 28 matching lines...) Expand all Loading... | |
258 try { | 292 try { |
259 mConfig.put(key, value); | 293 mConfig.put(key, value); |
260 } catch (JSONException e) { | 294 } catch (JSONException e) { |
261 // Intentionally do nothing. | 295 // Intentionally do nothing. |
262 } | 296 } |
263 return this; | 297 return this; |
264 } | 298 } |
265 | 299 |
266 private JSONObject mConfig = new JSONObject(); | 300 private JSONObject mConfig = new JSONObject(); |
267 } | 301 } |
OLD | NEW |