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

Unified Diff: components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java

Issue 586143002: Initial implementation of Cronet Async API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java
diff --git a/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java b/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java
index 6c59ae18da42b31e8bf50bed595c41bcd85e309e..4883f9984263b17a1a5ca748af39965079fe70bb 100644
--- a/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java
+++ b/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java
@@ -25,13 +25,6 @@ public class HttpUrlRequestFactoryConfig {
}
/**
- * Override the name of the native library backing cronet.
- */
- public HttpUrlRequestFactoryConfig setLibraryName(String libName) {
- return putString(UrlRequestContextConfig.NATIVE_LIBRARY_NAME, libName);
- }
-
- /**
* Create config from json serialized using @toString.
*/
public HttpUrlRequestFactoryConfig(String json) throws JSONException {
@@ -50,6 +43,24 @@ public class HttpUrlRequestFactoryConfig {
return mConfig.optBoolean(UrlRequestContextConfig.ENABLE_LEGACY_MODE);
}
+ /**
+ * Override the user-agent header for all requests.
+ */
+ public HttpUrlRequestFactoryConfig setUserAgent(String userAgent) {
+ return putString(UrlRequestContextConfig.USER_AGENT, userAgent);
+ }
+
+ String userAgent() {
+ return mConfig.optString(UrlRequestContextConfig.USER_AGENT);
+ }
+
+ /**
+ * Override the name of the native library backing cronet.
+ */
+ public HttpUrlRequestFactoryConfig setLibraryName(String libName) {
+ return putString(UrlRequestContextConfig.NATIVE_LIBRARY_NAME, libName);
+ }
+
/**
* Boolean, enable QUIC if true.
*/
@@ -125,7 +136,7 @@ public class HttpUrlRequestFactoryConfig {
hint.put(UrlRequestContextConfig.QUIC_HINT_ALT_PORT, alternatePort);
quicHints.put(hint);
} catch (JSONException e) {
- ;
+ // Ignore the exception.
}
return this;
}
@@ -145,7 +156,7 @@ public class HttpUrlRequestFactoryConfig {
try {
mConfig.put(key, value);
} catch (JSONException e) {
- ;
+ // Ignore the exception.
}
return this;
}
@@ -158,7 +169,7 @@ public class HttpUrlRequestFactoryConfig {
try {
mConfig.put(key, value);
} catch (JSONException e) {
- ;
+ // Ignore the exception.
}
return this;
}
@@ -171,7 +182,7 @@ public class HttpUrlRequestFactoryConfig {
try {
mConfig.put(key, value);
} catch (JSONException e) {
- ;
+ // Ignore the exception.
}
return this;
}

Powered by Google App Engine
This is Rietveld 408576698