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 | 8 |
9 import java.io.IOException; | 9 import java.io.IOException; |
10 import java.io.PrintWriter; | 10 import java.io.PrintWriter; |
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 * Network request using {@link java.net.HttpURLConnection}. | 15 * Network request using {@link java.net.HttpURLConnection}. |
16 * @deprecated Use {@link UrlRequestContext} instead. | 16 * @deprecated Use {@link CronetEngine} instead. |
17 */ | 17 */ |
18 @Deprecated | 18 @Deprecated |
19 class HttpUrlConnectionUrlRequestFactory extends HttpUrlRequestFactory { | 19 class HttpUrlConnectionUrlRequestFactory extends HttpUrlRequestFactory { |
20 | 20 |
21 private final Context mContext; | 21 private final Context mContext; |
22 private final String mDefaultUserAgent; | 22 private final String mDefaultUserAgent; |
23 | 23 |
24 public HttpUrlConnectionUrlRequestFactory( | 24 public HttpUrlConnectionUrlRequestFactory(Context context, CronetEngine.Buil
der config) { |
25 Context context, UrlRequestContextConfig config) { | |
26 mContext = context; | 25 mContext = context; |
27 String userAgent = config.userAgent(); | 26 String userAgent = config.userAgent(); |
28 if (userAgent.isEmpty()) { | 27 if (userAgent.isEmpty()) { |
29 userAgent = UserAgent.from(mContext); | 28 userAgent = UserAgent.from(mContext); |
30 } | 29 } |
31 mDefaultUserAgent = userAgent; | 30 mDefaultUserAgent = userAgent; |
32 } | 31 } |
33 | 32 |
34 @Override | 33 @Override |
35 public boolean isEnabled() { | 34 public boolean isEnabled() { |
(...skipping 28 matching lines...) Expand all Loading... |
64 out.close(); | 63 out.close(); |
65 } catch (IOException e) { | 64 } catch (IOException e) { |
66 // Ignore any exceptions. | 65 // Ignore any exceptions. |
67 } | 66 } |
68 } | 67 } |
69 | 68 |
70 @Override | 69 @Override |
71 public void stopNetLog() { | 70 public void stopNetLog() { |
72 } | 71 } |
73 } | 72 } |
OLD | NEW |