| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.net.http.HttpResponseCache; | 9 import android.net.http.HttpResponseCache; |
| 10 import android.support.annotation.IntDef; | 10 import android.support.annotation.IntDef; |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 * | 1100 * |
| 1101 * @return an {@link URLStreamHandlerFactory} instance implemented by this | 1101 * @return an {@link URLStreamHandlerFactory} instance implemented by this |
| 1102 * CronetEngine. | 1102 * CronetEngine. |
| 1103 */ | 1103 */ |
| 1104 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory(); | 1104 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory(); |
| 1105 | 1105 |
| 1106 private static CronetEngine createCronetEngine(Builder builder) { | 1106 private static CronetEngine createCronetEngine(Builder builder) { |
| 1107 CronetEngine cronetEngine = null; | 1107 CronetEngine cronetEngine = null; |
| 1108 try { | 1108 try { |
| 1109 Class<? extends CronetEngine> engineClass = | 1109 Class<? extends CronetEngine> engineClass = |
| 1110 CronetEngine.class.getClassLoader() | 1110 builder.getContext() |
| 1111 .getClassLoader() |
| 1111 .loadClass(CRONET_URL_REQUEST_CONTEXT) | 1112 .loadClass(CRONET_URL_REQUEST_CONTEXT) |
| 1112 .asSubclass(CronetEngine.class); | 1113 .asSubclass(CronetEngine.class); |
| 1113 Constructor<? extends CronetEngine> constructor = | 1114 Constructor<? extends CronetEngine> constructor = |
| 1114 engineClass.getConstructor(Builder.class); | 1115 engineClass.getConstructor(Builder.class); |
| 1115 CronetEngine possibleEngine = constructor.newInstance(builder); | 1116 CronetEngine possibleEngine = constructor.newInstance(builder); |
| 1116 if (possibleEngine.isEnabled()) { | 1117 if (possibleEngine.isEnabled()) { |
| 1117 cronetEngine = possibleEngine; | 1118 cronetEngine = possibleEngine; |
| 1118 } | 1119 } |
| 1119 } catch (ClassNotFoundException e) { | 1120 } catch (ClassNotFoundException e) { |
| 1120 // Leave as null. | 1121 // Leave as null. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 * @hide as it's a prototype. | 1277 * @hide as it's a prototype. |
| 1277 */ | 1278 */ |
| 1278 public interface RequestFinishedListener { | 1279 public interface RequestFinishedListener { |
| 1279 /** | 1280 /** |
| 1280 * Invoked with request info. | 1281 * Invoked with request info. |
| 1281 * @param requestInfo {@link UrlRequestInfo} for finished request. | 1282 * @param requestInfo {@link UrlRequestInfo} for finished request. |
| 1282 */ | 1283 */ |
| 1283 void onRequestFinished(UrlRequestInfo requestInfo); | 1284 void onRequestFinished(UrlRequestInfo requestInfo); |
| 1284 } | 1285 } |
| 1285 } | 1286 } |
| OLD | NEW |