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

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

Issue 997623002: [Cronet] Respect user agent string from config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestFactory.java
diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestFactory.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestFactory.java
index e5a224afe1a542441f272dbe2626ea4d3d9fc19e..a1b02818c8b921fb26c8b1b78d3d76b2a2e36556 100644
--- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestFactory.java
+++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestFactory.java
@@ -23,8 +23,14 @@ public class ChromiumUrlRequestFactory extends HttpUrlRequestFactory {
public ChromiumUrlRequestFactory(
Context context, UrlRequestContextConfig config) {
if (isEnabled()) {
- mRequestContext =
- new ChromiumUrlRequestContext(context, UserAgent.from(context), config);
+ String userAgent = config.userAgent();
+ if (!userAgent.isEmpty()) {
mef 2015/03/16 15:39:55 Suggest changing to: if (userAgent.isEmpty())
xunjieli 2015/03/16 15:45:56 Done.
+ mRequestContext = new ChromiumUrlRequestContext(context,
+ userAgent, config);
+ } else {
+ mRequestContext = new ChromiumUrlRequestContext(context,
+ UserAgent.from(context), config);
+ }
}
}
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698