Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/UrlRequestContextConfig.java

Issue 937513003: Add Data Saver support to Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
mmenke 2015/04/01 15:46:14 Need to describe what "key" is, and maybe rename i
bengr 2015/04/24 02:30:43 Done. The format is TBD.
106 */
107 public UrlRequestContextConfig enableDataReductionProxy(boolean value,
108 String key) {
109 return (putBoolean(UrlRequestContextConfigList
110 .ENABLE_DATA_REDUCTION_PROXY, value)
111 .putString(UrlRequestContextConfigList
112 .DATA_REDUCTION_PROXY_KEY, key));
113 }
114
115 /**
105 * Enumeration, disable or enable cache in memory or on disk. 116 * Enumeration, disable or enable cache in memory or on disk.
106 */ 117 */
107 public enum HttpCache { 118 public enum HttpCache {
108 /** 119 /**
109 * Disable cache, some data may still be temporarily stored in memory. 120 * Disable cache, some data may still be temporarily stored in memory.
110 */ 121 */
111 DISABLED, 122 DISABLED,
112 123
113 /** 124 /**
114 * Enable in memory cache, including HTTP data. 125 * Enable in memory cache, including HTTP data.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 * @param quicConnectionOptions comma-separated QUIC options (for example 221 * @param quicConnectionOptions comma-separated QUIC options (for example
211 * "PACE,IW10") to use if QUIC is enabled. 222 * "PACE,IW10") to use if QUIC is enabled.
212 */ 223 */
213 public UrlRequestContextConfig setExperimentalQuicConnectionOptions( 224 public UrlRequestContextConfig setExperimentalQuicConnectionOptions(
214 String quicConnectionOptions) { 225 String quicConnectionOptions) {
215 return putString(UrlRequestContextConfigList.QUIC_OPTIONS, 226 return putString(UrlRequestContextConfigList.QUIC_OPTIONS,
216 quicConnectionOptions); 227 quicConnectionOptions);
217 } 228 }
218 229
219 /** 230 /**
231 * Overrides Data Reduction Proxy configuration parameters with a comma-
232 * separated list that specifies the primary proxy name, the fallback
233 * proxy name, and a secure proxy check url. E.g:
mmenke 2015/04/01 15:46:14 Secure proxy check? Should also comment if they'r
bengr 2015/04/24 02:30:43 Done.
234 * https://www.primary.com,https://www.fallback.com:80,http://check.com/
235 * @param dataReductionProxyParams
236 */
237 public UrlRequestContextConfig setDataReductionProxyOptions(
238 String dataReductionProxyParams) {
239 return putString(
240 UrlRequestContextConfigList.DATA_REDUCTION_PROXY_OPTIONS,
241 dataReductionProxyParams);
242 }
243
244 /**
220 * Get JSON string representation of the config. 245 * Get JSON string representation of the config.
221 */ 246 */
222 @Override 247 @Override
223 public String toString() { 248 public String toString() {
224 return mConfig.toString(); 249 return mConfig.toString();
225 } 250 }
226 251
227 /** 252 /**
228 * Sets a boolean value in the config. Returns a reference to the same 253 * Sets a boolean value in the config. Returns a reference to the same
229 * config object, so you can chain put calls together. 254 * config object, so you can chain put calls together.
(...skipping 28 matching lines...) Expand all
258 try { 283 try {
259 mConfig.put(key, value); 284 mConfig.put(key, value);
260 } catch (JSONException e) { 285 } catch (JSONException e) {
261 // Intentionally do nothing. 286 // Intentionally do nothing.
262 } 287 }
263 return this; 288 return this;
264 } 289 }
265 290
266 private JSONObject mConfig = new JSONObject(); 291 private JSONObject mConfig = new JSONObject();
267 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698