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
3 // found in the LICENSE file.
5 package org.chromium.net;
7 import android.content.Context;
9 import java.nio.channels.WritableByteChannel;
13 * Network request using {@link java.net.HttpURLConnection}.
15 class HttpUrlConnectionUrlRequestFactory extends HttpUrlRequestFactory {
17 private final Context mContext;
19 public HttpUrlConnectionUrlRequestFactory(Context context) {
20 mContext = context.getApplicationContext();
24 protected boolean isEnabled() {
29 protected String getName() {
30 return "HttpUrlConnection";
34 protected HttpUrlRequest createRequest(String url, int requestPriority,
35 Map<String, String> headers, HttpUrlRequestListener listener) {
36 return new HttpUrlConnectionUrlRequest(mContext, url, requestPriority,
41 protected HttpUrlRequest createRequest(String url, int requestPriority,
42 Map<String, String> headers, WritableByteChannel channel,
43 HttpUrlRequestListener listener) {
44 return new HttpUrlConnectionUrlRequest(mContext, url, requestPriority,
45 headers, channel, listener);