| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Boolean, enable SDCH compression if true. | 105 * Boolean, enable SDCH compression if true. |
| 106 */ | 106 */ |
| 107 public UrlRequestContextConfig enableSDCH(boolean value) { | 107 public UrlRequestContextConfig enableSDCH(boolean value) { |
| 108 return putBoolean(UrlRequestContextConfigList.ENABLE_SDCH, value); | 108 return putBoolean(UrlRequestContextConfigList.ENABLE_SDCH, value); |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * String, key to use when authenticating with the proxy. |
| 113 */ |
| 114 public UrlRequestContextConfig enableDataReductionProxy(String key) { |
| 115 return (putString( |
| 116 UrlRequestContextConfigList.DATA_REDUCTION_PROXY_KEY, key)); |
| 117 } |
| 118 |
| 119 /** |
| 120 * Overrides Data Reduction Proxy configuration parameters with a primary |
| 121 * proxy name, fallback proxy name, and a secure proxy check url. Proxies |
| 122 * are specified as [scheme://]host[:port]. Used for testing. |
| 123 * @param primaryProxy The primary data reduction proxy to use. |
| 124 * @param fallbackProxy A fallback data reduction proxy to use. |
| 125 * @param secureProxyCheckUrl A url to fetch to determine if using a secure |
| 126 * proxy is allowed. |
| 127 */ |
| 128 public UrlRequestContextConfig setDataReductionProxyOptions( |
| 129 String primaryProxy, |
| 130 String fallbackProxy, |
| 131 String secureProxyCheckUrl) { |
| 132 if (primaryProxy.isEmpty() || fallbackProxy.isEmpty() |
| 133 || secureProxyCheckUrl.isEmpty()) { |
| 134 throw new IllegalArgumentException( |
| 135 "Primary and fallback proxies and check url must be set"); |
| 136 } |
| 137 putString(UrlRequestContextConfigList.DATA_REDUCTION_PRIMARY_PROXY, |
| 138 primaryProxy); |
| 139 putString(UrlRequestContextConfigList.DATA_REDUCTION_FALLBACK_PROXY, |
| 140 fallbackProxy); |
| 141 putString(UrlRequestContextConfigList |
| 142 .DATA_REDUCTION_SECURE_PROXY_CHECK_URL, secureProxyCheckUrl); |
| 143 return this; |
| 144 } |
| 145 |
| 146 /** |
| 112 * Enumeration, disable or enable cache in memory or on disk. | 147 * Enumeration, disable or enable cache in memory or on disk. |
| 113 */ | 148 */ |
| 114 public enum HttpCache { | 149 public enum HttpCache { |
| 115 /** | 150 /** |
| 116 * Disable cache, some data may still be temporarily stored in memory. | 151 * Disable cache, some data may still be temporarily stored in memory. |
| 117 */ | 152 */ |
| 118 DISABLED, | 153 DISABLED, |
| 119 | 154 |
| 120 /** | 155 /** |
| 121 * Enable in memory cache, including HTTP data. | 156 * Enable in memory cache, including HTTP data. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 try { | 300 try { |
| 266 mConfig.put(key, value); | 301 mConfig.put(key, value); |
| 267 } catch (JSONException e) { | 302 } catch (JSONException e) { |
| 268 // Intentionally do nothing. | 303 // Intentionally do nothing. |
| 269 } | 304 } |
| 270 return this; | 305 return this; |
| 271 } | 306 } |
| 272 | 307 |
| 273 private JSONObject mConfig = new JSONObject(); | 308 private JSONObject mConfig = new JSONObject(); |
| 274 } | 309 } |
| OLD | NEW |