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; |
} |