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

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: Removed boolean from api Created 5 years, 8 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 * String, key to use when authenticating with the proxy.
106 */
107 public UrlRequestContextConfig enableDataReductionProxy(String key) {
108 return (putString(
109 UrlRequestContextConfigList.DATA_REDUCTION_PROXY_KEY, key));
110 }
111
112 /**
113 * Overrides Data Reduction Proxy configuration parameters with a primary
114 * proxy name, fallback proxy name, and a secure proxy check url. Proxies
115 * are specified as [scheme://]host[:port]. Used for testing.
116 * @param primaryProxy The primary data reduction proxy to use.
117 * @param fallbackProxy A fallback data reduction proxy to use.
118 * @param secureProxyCheckUrl A url to fetch to determine if using a secure
119 * proxy is allowed.
120 */
121 public UrlRequestContextConfig setDataReductionProxyOptions(
122 String primaryProxy,
123 String fallbackProxy,
124 String secureProxyCheckUrl) {
125 if (primaryProxy.isEmpty() || fallbackProxy.isEmpty()
126 || secureProxyCheckUrl.isEmpty()) {
127 throw new IllegalArgumentException(
128 "Primary and fallback proxies and check url must be set");
129 }
130 putString(UrlRequestContextConfigList.DATA_REDUCTION_PRIMARY_PROXY,
131 primaryProxy);
132 putString(UrlRequestContextConfigList.DATA_REDUCTION_FALLBACK_PROXY,
133 fallbackProxy);
134 putString(UrlRequestContextConfigList
135 .DATA_REDUCTION_SECURE_PROXY_CHECK_URL, secureProxyCheckUrl);
136 return this;
137 }
138
139 /**
105 * Enumeration, disable or enable cache in memory or on disk. 140 * Enumeration, disable or enable cache in memory or on disk.
106 */ 141 */
107 public enum HttpCache { 142 public enum HttpCache {
108 /** 143 /**
109 * Disable cache, some data may still be temporarily stored in memory. 144 * Disable cache, some data may still be temporarily stored in memory.
110 */ 145 */
111 DISABLED, 146 DISABLED,
112 147
113 /** 148 /**
114 * Enable in memory cache, including HTTP data. 149 * Enable in memory cache, including HTTP data.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 try { 293 try {
259 mConfig.put(key, value); 294 mConfig.put(key, value);
260 } catch (JSONException e) { 295 } catch (JSONException e) {
261 // Intentionally do nothing. 296 // Intentionally do nothing.
262 } 297 }
263 return this; 298 return this;
264 } 299 }
265 300
266 private JSONObject mConfig = new JSONObject(); 301 private JSONObject mConfig = new JSONObject();
267 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698