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

Side by Side Diff: net/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java

Issue 183333002: Cronet Java wrappers to fallback to HttpUrlConnection if Cronet is not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address formatting comments. Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 package org.chromium.net;
6
7 import android.content.Context;
8 import android.util.Log;
9
10 /**
11 * Provides context for the native HTTP operations.
12 */
13 public class ChromiumUrlRequestContext extends UrlRequestContext {
14 private static final Object sLock = new Object();
15
16 private static final String TAG = "ChromiumNetwork";
17
18 private static ChromiumUrlRequestContext sInstance;
19
20 private ChromiumUrlRequestContext(Context context, String userAgent,
21 int loggingLevel) {
22 super(context, userAgent, loggingLevel);
23 }
24
25 public static ChromiumUrlRequestContext getInstance(
26 Context context) {
27 synchronized (sLock) {
28 if (sInstance == null) {
29 int loggingLevel;
30 if (Log.isLoggable(TAG, Log.VERBOSE)) {
31 loggingLevel = LOG_VERBOSE;
32 } else if (Log.isLoggable(TAG, Log.DEBUG)) {
33 loggingLevel = LOG_DEBUG;
34 } else {
35 loggingLevel = LOG_NONE;
36 }
37 sInstance = new ChromiumUrlRequestContext(
38 context.getApplicationContext(),
39 UserAgent.from(context),
40 loggingLevel);
41 }
42 }
43 return sInstance;
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698