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.os.Build; | 8 import android.os.Build; |
9 | 9 |
10 import org.chromium.base.annotations.UsedByReflection; | 10 import org.chromium.base.annotations.UsedByReflection; |
11 | 11 |
12 import java.nio.channels.WritableByteChannel; | 12 import java.nio.channels.WritableByteChannel; |
13 import java.util.Map; | 13 import java.util.Map; |
14 | 14 |
15 /** | 15 /** |
16 * Network request factory using the native http stack implementation. | 16 * Network request factory using the native http stack implementation. |
17 * @deprecated Use {@link CronetUrlRequestContext} instead. | 17 * @deprecated Use {@link CronetEngine} instead. |
18 */ | 18 */ |
19 @UsedByReflection("HttpUrlRequestFactory.java") | 19 @UsedByReflection("HttpUrlRequestFactory.java") |
20 @Deprecated | 20 @Deprecated |
21 public class ChromiumUrlRequestFactory extends HttpUrlRequestFactory { | 21 public class ChromiumUrlRequestFactory extends HttpUrlRequestFactory { |
22 private ChromiumUrlRequestContext mRequestContext; | 22 private ChromiumUrlRequestContext mRequestContext; |
23 | 23 |
24 @UsedByReflection("HttpUrlRequestFactory.java") | 24 @UsedByReflection("HttpUrlRequestFactory.java") |
25 public ChromiumUrlRequestFactory( | 25 public ChromiumUrlRequestFactory(Context context, CronetEngine.Builder confi
g) { |
26 Context context, UrlRequestContextConfig config) { | |
27 if (isEnabled()) { | 26 if (isEnabled()) { |
28 String userAgent = config.userAgent(); | 27 String userAgent = config.userAgent(); |
29 if (userAgent.isEmpty()) { | 28 if (userAgent.isEmpty()) { |
30 userAgent = UserAgent.from(context); | 29 userAgent = UserAgent.from(context); |
31 } | 30 } |
32 mRequestContext = new ChromiumUrlRequestContext(context, | 31 mRequestContext = new ChromiumUrlRequestContext(context, |
33 userAgent, config); | 32 userAgent, config); |
34 } | 33 } |
35 } | 34 } |
36 | 35 |
(...skipping 29 matching lines...) Expand all Loading... |
66 | 65 |
67 @Override | 66 @Override |
68 public void stopNetLog() { | 67 public void stopNetLog() { |
69 mRequestContext.stopNetLog(); | 68 mRequestContext.stopNetLog(); |
70 } | 69 } |
71 | 70 |
72 public ChromiumUrlRequestContext getRequestContext() { | 71 public ChromiumUrlRequestContext getRequestContext() { |
73 return mRequestContext; | 72 return mRequestContext; |
74 } | 73 } |
75 } | 74 } |
OLD | NEW |