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

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

Issue 1085903002: Enable Sdch in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 5 years, 7 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
11 import java.io.File; 11 import java.io.File;
12 12
13 /** 13 /**
14 * A config for UrlRequestContext, which allows runtime configuration of 14 * A config for UrlRequestContext, which allows runtime configuration of
15 * UrlRequestContext. 15 * UrlRequestContext.
16 */ 16 */
17 public class UrlRequestContextConfig { 17 public class UrlRequestContextConfig {
18
19 /** 18 /**
20 * Default config enables SPDY, QUIC, in memory http cache. 19 * Default config enables SPDY, disables QUIC, SDCH and http cache.
21 */ 20 */
22 public UrlRequestContextConfig() { 21 public UrlRequestContextConfig() {
23 enableLegacyMode(false); 22 enableLegacyMode(false);
24 enableQUIC(false); 23 enableQUIC(false);
25 enableSPDY(true); 24 enableSPDY(true);
25 enableSDCH(false);
26 enableHttpCache(HttpCache.DISABLED, 0); 26 enableHttpCache(HttpCache.DISABLED, 0);
27 } 27 }
28 28
29 /** 29 /**
30 * Create config from json serialized using @toString. 30 * Create config from json serialized using @toString.
31 */ 31 */
32 public UrlRequestContextConfig(String json) throws JSONException { 32 public UrlRequestContextConfig(String json) throws JSONException {
33 mConfig = new JSONObject(json); 33 mConfig = new JSONObject(json);
34 } 34 }
35 35
(...skipping 59 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 SDCH compression if true.
106 */
107 public UrlRequestContextConfig enableSDCH(boolean value) {
108 return putBoolean(UrlRequestContextConfigList.ENABLE_SDCH, value);
109 }
110
111 /**
105 * Enumeration, disable or enable cache in memory or on disk. 112 * Enumeration, disable or enable cache in memory or on disk.
106 */ 113 */
107 public enum HttpCache { 114 public enum HttpCache {
108 /** 115 /**
109 * Disable cache, some data may still be temporarily stored in memory. 116 * Disable cache, some data may still be temporarily stored in memory.
110 */ 117 */
111 DISABLED, 118 DISABLED,
112 119
113 /** 120 /**
114 * Enable in memory cache, including HTTP data. 121 * Enable in memory cache, including HTTP data.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 try { 265 try {
259 mConfig.put(key, value); 266 mConfig.put(key, value);
260 } catch (JSONException e) { 267 } catch (JSONException e) {
261 // Intentionally do nothing. 268 // Intentionally do nothing.
262 } 269 }
263 return this; 270 return this;
264 } 271 }
265 272
266 private JSONObject mConfig = new JSONObject(); 273 private JSONObject mConfig = new JSONObject();
267 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698