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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 quicHints = new JSONArray(); | 118 quicHints = new JSONArray(); |
119 mConfig.put(UrlRequestContextConfig.QUIC_HINTS, quicHints); | 119 mConfig.put(UrlRequestContextConfig.QUIC_HINTS, quicHints); |
120 } | 120 } |
121 | 121 |
122 JSONObject hint = new JSONObject(); | 122 JSONObject hint = new JSONObject(); |
123 hint.put(UrlRequestContextConfig.QUIC_HINT_HOST, host); | 123 hint.put(UrlRequestContextConfig.QUIC_HINT_HOST, host); |
124 hint.put(UrlRequestContextConfig.QUIC_HINT_PORT, port); | 124 hint.put(UrlRequestContextConfig.QUIC_HINT_PORT, port); |
125 hint.put(UrlRequestContextConfig.QUIC_HINT_ALT_PORT, alternatePort); | 125 hint.put(UrlRequestContextConfig.QUIC_HINT_ALT_PORT, alternatePort); |
126 quicHints.put(hint); | 126 quicHints.put(hint); |
127 } catch (JSONException e) { | 127 } catch (JSONException e) { |
128 ; | 128 // Intentionally do nothing. |
129 } | 129 } |
130 return this; | 130 return this; |
131 } | 131 } |
132 | 132 |
133 /** | 133 /** |
134 * Get JSON string representation of the config. | 134 * Get JSON string representation of the config. |
135 */ | 135 */ |
| 136 @Override |
136 public String toString() { | 137 public String toString() { |
137 return mConfig.toString(); | 138 return mConfig.toString(); |
138 } | 139 } |
139 | 140 |
140 /** | 141 /** |
141 * Sets a boolean value in the config. Returns a reference to the same | 142 * Sets a boolean value in the config. Returns a reference to the same |
142 * config object, so you can chain put calls together. | 143 * config object, so you can chain put calls together. |
143 */ | 144 */ |
144 private HttpUrlRequestFactoryConfig putBoolean(String key, boolean value) { | 145 private HttpUrlRequestFactoryConfig putBoolean(String key, boolean value) { |
145 try { | 146 try { |
146 mConfig.put(key, value); | 147 mConfig.put(key, value); |
147 } catch (JSONException e) { | 148 } catch (JSONException e) { |
148 ; | 149 // Intentionally do nothing. |
149 } | 150 } |
150 return this; | 151 return this; |
151 } | 152 } |
152 | 153 |
153 /** | 154 /** |
154 * Sets a long value in the config. Returns a reference to the same | 155 * Sets a long value in the config. Returns a reference to the same |
155 * config object, so you can chain put calls together. | 156 * config object, so you can chain put calls together. |
156 */ | 157 */ |
157 private HttpUrlRequestFactoryConfig putLong(String key, long value) { | 158 private HttpUrlRequestFactoryConfig putLong(String key, long value) { |
158 try { | 159 try { |
159 mConfig.put(key, value); | 160 mConfig.put(key, value); |
160 } catch (JSONException e) { | 161 } catch (JSONException e) { |
161 ; | 162 // Intentionally do nothing. |
162 } | 163 } |
163 return this; | 164 return this; |
164 } | 165 } |
165 | 166 |
166 /** | 167 /** |
167 * Sets a string value in the config. Returns a reference to the same | 168 * Sets a string value in the config. Returns a reference to the same |
168 * config object, so you can chain put calls together. | 169 * config object, so you can chain put calls together. |
169 */ | 170 */ |
170 private HttpUrlRequestFactoryConfig putString(String key, String value) { | 171 private HttpUrlRequestFactoryConfig putString(String key, String value) { |
171 try { | 172 try { |
172 mConfig.put(key, value); | 173 mConfig.put(key, value); |
173 } catch (JSONException e) { | 174 } catch (JSONException e) { |
174 ; | 175 // Intentionally do nothing. |
175 } | 176 } |
176 return this; | 177 return this; |
177 } | 178 } |
178 | 179 |
179 private JSONObject mConfig = new JSONObject(); | 180 private JSONObject mConfig = new JSONObject(); |
180 } | 181 } |
OLD | NEW |