| 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 android.content.Context; | 7 import android.content.Context; |
| 8 import android.util.Log; | 8 import android.util.Log; |
| 9 | 9 |
| 10 import java.lang.reflect.Constructor; | 10 import java.lang.reflect.Constructor; |
| 11 import java.nio.channels.WritableByteChannel; | 11 import java.nio.channels.WritableByteChannel; |
| 12 import java.util.Map; | 12 import java.util.Map; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * A factory for {@link HttpUrlRequest}'s, which uses the best HTTP stack | 15 * A factory for {@link HttpUrlRequest}'s, which uses the best HTTP stack |
| 16 * available on the current platform. | 16 * available on the current platform. |
| 17 * @deprecated Use {@link CronetEngine} instead. | 17 * @deprecated Use {@link CronetEngine} instead. |
| 18 */ | 18 */ |
| 19 @Deprecated | 19 @Deprecated |
| 20 public abstract class HttpUrlRequestFactory { | 20 public abstract class HttpUrlRequestFactory { |
| 21 private static final String TAG = "HttpUrlRequestFactory"; | 21 private static final String TAG = "HttpUrlRequestFactory"; |
| 22 | 22 |
| 23 private static final String CHROMIUM_URL_REQUEST_FACTORY = | 23 private static final String CHROMIUM_URL_REQUEST_FACTORY = |
| 24 "org.chromium.net.ChromiumUrlRequestFactory"; | 24 "org.chromium.net.impl.ChromiumUrlRequestFactory"; |
| 25 | 25 |
| 26 public static HttpUrlRequestFactory createFactory( | 26 public static HttpUrlRequestFactory createFactory( |
| 27 Context context, CronetEngine.Builder config) { | 27 Context context, CronetEngine.Builder config) { |
| 28 HttpUrlRequestFactory factory = null; | 28 HttpUrlRequestFactory factory = null; |
| 29 if (!config.legacyMode()) { | 29 if (!config.legacyMode()) { |
| 30 factory = createChromiumFactory(context, config); | 30 factory = createChromiumFactory(context, config); |
| 31 } | 31 } |
| 32 if (factory == null) { | 32 if (factory == null) { |
| 33 // Default to HttpUrlConnection-based networking. | 33 // Default to HttpUrlConnection-based networking. |
| 34 factory = new HttpUrlConnectionUrlRequestFactory(context, config); | 34 factory = new HttpUrlConnectionUrlRequestFactory(context, config); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } catch (ClassNotFoundException e) { | 97 } catch (ClassNotFoundException e) { |
| 98 // Leave as null | 98 // Leave as null |
| 99 } catch (Exception e) { | 99 } catch (Exception e) { |
| 100 throw new IllegalStateException( | 100 throw new IllegalStateException( |
| 101 "Cannot instantiate: " + CHROMIUM_URL_REQUEST_FACTORY, | 101 "Cannot instantiate: " + CHROMIUM_URL_REQUEST_FACTORY, |
| 102 e); | 102 e); |
| 103 } | 103 } |
| 104 return factory; | 104 return factory; |
| 105 } | 105 } |
| 106 } | 106 } |
| OLD | NEW |