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

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/HttpUrlConnectionUrlRequestFactory.java

Issue 1429863008: [Cronet] Remove JSON serialization of CronetEngine.Builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Helen's comments Created 5 years 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; 5 package org.chromium.net;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.text.TextUtils;
8 9
9 import java.io.IOException; 10 import java.io.IOException;
10 import java.io.PrintWriter; 11 import java.io.PrintWriter;
11 import java.nio.channels.WritableByteChannel; 12 import java.nio.channels.WritableByteChannel;
12 import java.util.Map; 13 import java.util.Map;
13 14
14 /** 15 /**
15 * Network request using {@link java.net.HttpURLConnection}. 16 * Network request using {@link java.net.HttpURLConnection}.
16 * @deprecated Use {@link CronetEngine} instead. 17 * @deprecated Use {@link CronetEngine} instead.
17 */ 18 */
18 @Deprecated 19 @Deprecated
19 class HttpUrlConnectionUrlRequestFactory extends HttpUrlRequestFactory { 20 class HttpUrlConnectionUrlRequestFactory extends HttpUrlRequestFactory {
20 21
21 private final Context mContext; 22 private final Context mContext;
22 private final String mDefaultUserAgent; 23 private final String mDefaultUserAgent;
23 24
24 public HttpUrlConnectionUrlRequestFactory(Context context, CronetEngine.Buil der config) { 25 public HttpUrlConnectionUrlRequestFactory(Context context, CronetEngine.Buil der config) {
25 mContext = context; 26 mContext = context;
26 String userAgent = config.getUserAgent(); 27 String userAgent = config.getUserAgent();
27 if (userAgent.isEmpty()) { 28 if (TextUtils.isEmpty(userAgent)) {
28 // Cannot use config.getDefaultUserAgent() as config.mContext may be null. 29 // Cannot use config.getDefaultUserAgent() as config.mContext may be null.
29 userAgent = new CronetEngine.Builder(mContext).getDefaultUserAgent() ; 30 userAgent = new CronetEngine.Builder(mContext).getDefaultUserAgent() ;
30 } 31 }
31 mDefaultUserAgent = userAgent; 32 mDefaultUserAgent = userAgent;
32 } 33 }
33 34
34 @Override 35 @Override
35 public boolean isEnabled() { 36 public boolean isEnabled() {
36 return true; 37 return true;
37 } 38 }
(...skipping 26 matching lines...) Expand all
64 out.close(); 65 out.close();
65 } catch (IOException e) { 66 } catch (IOException e) {
66 // Ignore any exceptions. 67 // Ignore any exceptions.
67 } 68 }
68 } 69 }
69 70
70 @Override 71 @Override
71 public void stopNetLog() { 72 public void stopNetLog() {
72 } 73 }
73 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698