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

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

Issue 624443003: Setup ProxyConfigServiceAndroid in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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
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.os.Handler;
9 import android.os.Looper;
8 import android.os.Process; 10 import android.os.Process;
9 import android.util.Log; 11 import android.util.Log;
10 12
11 import org.chromium.base.CalledByNative; 13 import org.chromium.base.CalledByNative;
12 import org.chromium.base.JNINamespace; 14 import org.chromium.base.JNINamespace;
13 15
14 /** 16 /**
15 * Provides context for the native HTTP operations. 17 * Provides context for the native HTTP operations.
16 */ 18 */
17 @JNINamespace("cronet") 19 @JNINamespace("cronet")
(...skipping 12 matching lines...) Expand all
30 * Constructor. 32 * Constructor.
31 * 33 *
32 */ 34 */
33 protected ChromiumUrlRequestContext(Context context, String userAgent, 35 protected ChromiumUrlRequestContext(Context context, String userAgent,
34 String config) { 36 String config) {
35 mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter( 37 mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter(
36 context, userAgent, getLoggingLevel(), config); 38 context, userAgent, getLoggingLevel(), config);
37 if (mChromiumUrlRequestContextAdapter == 0) { 39 if (mChromiumUrlRequestContextAdapter == 0) {
38 throw new NullPointerException("Context Adapter creation failed"); 40 throw new NullPointerException("Context Adapter creation failed");
39 } 41 }
42 // Post a task to UI thread to init native Chromium URLRequestContext.
43 Runnable task = new Runnable() {
44 public void run() {
45 nativeInitRequestContext(mChromiumUrlRequestContextAdapter);
46 }
47 };
48 new Handler(Looper.getMainLooper()).post(task);
40 } 49 }
41 50
42 /** 51 /**
43 * Returns the version of this network stack formatted as N.N.N.N/X where 52 * Returns the version of this network stack formatted as N.N.N.N/X where
44 * N.N.N.N is the version of Chromium and X is the revision number. 53 * N.N.N.N is the version of Chromium and X is the revision number.
45 */ 54 */
46 public static String getVersion() { 55 public static String getVersion() {
47 return Version.getVersion(); 56 return Version.getVersion();
48 } 57 }
49 58
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 long chromiumUrlRequestContextAdapter); 131 long chromiumUrlRequestContextAdapter);
123 132
124 private native void nativeInitializeStatistics(); 133 private native void nativeInitializeStatistics();
125 134
126 private native String nativeGetStatisticsJSON(String filter); 135 private native String nativeGetStatisticsJSON(String filter);
127 136
128 private native void nativeStartNetLogToFile( 137 private native void nativeStartNetLogToFile(
129 long chromiumUrlRequestContextAdapter, String fileName); 138 long chromiumUrlRequestContextAdapter, String fileName);
130 139
131 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); 140 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter);
141 private native void nativeInitRequestContext(long chromiumUrlRequestContextA dapter);
mef 2014/10/10 21:20:37 nit: I'd put argument to the next line.
xunjieli 2014/10/14 19:14:48 Done.
132 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698