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

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

Issue 2339223002: Cronet API Refactoring (Closed)
Patch Set: Rebased onto Charles change + Paul's Comments Created 4 years, 2 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.urlconnection; 5 package org.chromium.net.urlconnection;
6 6
7 import org.chromium.net.CronetEngine; 7 import org.chromium.net.impl.CronetEngineBase;
8 8
9 import java.io.IOException; 9 import java.io.IOException;
10 import java.net.Proxy; 10 import java.net.Proxy;
11 import java.net.URL; 11 import java.net.URL;
12 import java.net.URLConnection; 12 import java.net.URLConnection;
13 import java.net.URLStreamHandler; 13 import java.net.URLStreamHandler;
14 14
15 /** 15 /**
16 * A {@link URLStreamHandler} that handles HTTP and HTTPS connections. One can u se this class to 16 * A {@link URLStreamHandler} that handles HTTP and HTTPS connections. One can u se this class to
17 * create {@link java.net.HttpURLConnection} instances implemented by Cronet; fo r example: <pre> 17 * create {@link java.net.HttpURLConnection} instances implemented by Cronet; fo r example: <pre>
18 * 18 *
19 * CronetHttpURLStreamHandler streamHandler = new CronetHttpURLStreamHandler(myC ontext); 19 * CronetHttpURLStreamHandler streamHandler = new CronetHttpURLStreamHandler(myC ontext);
20 * HttpURLConnection connection = (HttpURLConnection)streamHandler.openConnectio n( 20 * HttpURLConnection connection = (HttpURLConnection)streamHandler.openConnectio n(
21 * new URL("http://chromium.org"));</pre> 21 * new URL("http://chromium.org"));</pre>
22 * <b>Note:</b> Cronet's {@code HttpURLConnection} implementation is subject to some limitations 22 * <b>Note:</b> Cronet's {@code HttpURLConnection} implementation is subject to some limitations
23 * listed {@link CronetURLStreamHandlerFactory here}. 23 * listed {@link CronetURLStreamHandlerFactory here}.
24 */ 24 */
25 class CronetHttpURLStreamHandler extends URLStreamHandler { 25 class CronetHttpURLStreamHandler extends URLStreamHandler {
26 private final CronetEngine mCronetEngine; 26 private final CronetEngineBase mCronetEngine;
27 27
28 public CronetHttpURLStreamHandler(CronetEngine cronetEngine) { 28 public CronetHttpURLStreamHandler(CronetEngineBase cronetEngine) {
pauljensen 2016/09/26 14:51:22 why the change to CronetEngineBase?
kapishnikov 2016/09/27 18:38:26 This is internal implementation. I think the less
29 mCronetEngine = cronetEngine; 29 mCronetEngine = cronetEngine;
30 } 30 }
31 31
32 /** 32 /**
33 * Establishes a new connection to the resource specified by the {@link URL} {@code url}. 33 * Establishes a new connection to the resource specified by the {@link URL} {@code url}.
34 * @return an {@link java.net.HttpURLConnection} instance implemented by Cro net. 34 * @return an {@link java.net.HttpURLConnection} instance implemented by Cro net.
35 */ 35 */
36 @Override 36 @Override
37 public URLConnection openConnection(URL url) throws IOException { 37 public URLConnection openConnection(URL url) throws IOException {
38 return mCronetEngine.openConnection(url); 38 return mCronetEngine.openConnection(url);
39 } 39 }
40 40
41 /** 41 /**
42 * Establishes a new connection to the resource specified by the {@link URL} {@code url} 42 * Establishes a new connection to the resource specified by the {@link URL} {@code url}
43 * using the given proxy. 43 * using the given proxy.
44 * @return an {@link java.net.HttpURLConnection} instance implemented by Cro net. 44 * @return an {@link java.net.HttpURLConnection} instance implemented by Cro net.
45 */ 45 */
46 @Override 46 @Override
47 public URLConnection openConnection(URL url, Proxy proxy) throws IOException { 47 public URLConnection openConnection(URL url, Proxy proxy) throws IOException {
48 return mCronetEngine.openConnection(url, proxy); 48 return mCronetEngine.openConnection(url, proxy);
49 } 49 }
50 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698