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;
8 import android.util.Log;
11 * Provides context for the native HTTP operations.
13 public class ChromiumUrlRequestContext extends UrlRequestContext {
14 private static final Object sLock = new Object();
16 private static final String TAG = "ChromiumNetwork";
18 private static ChromiumUrlRequestContext sInstance;
20 private ChromiumUrlRequestContext(Context context, String userAgent,
22 super(context, userAgent, loggingLevel);
25 public static ChromiumUrlRequestContext getInstance(
27 synchronized (sLock) {
28 if (sInstance == null) {
30 if (Log.isLoggable(TAG, Log.VERBOSE)) {
31 loggingLevel = LOG_VERBOSE;
32 } else if (Log.isLoggable(TAG, Log.DEBUG)) {
33 loggingLevel = LOG_DEBUG;
35 loggingLevel = LOG_NONE;
37 sInstance = new ChromiumUrlRequestContext(
38 context.getApplicationContext(),
39 UserAgent.from(context),