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

Unified Diff: ios/crnet/CrNet.mm

Issue 2206283003: [Cronet] Add CrNet.setUserAgent method on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crnetgn
Patch Set: Unmark setPartialUserAgent as deprecated. Created 4 years, 4 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 | « ios/crnet/CrNet.h ('k') | ios/crnet/crnet_environment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/crnet/CrNet.mm
diff --git a/ios/crnet/CrNet.mm b/ios/crnet/CrNet.mm
index f040e25f134435060148622de19900d521431f3d..40aa291021057ef3c499e2de46f100dcca5cdcbc 100644
--- a/ios/crnet/CrNet.mm
+++ b/ios/crnet/CrNet.mm
@@ -14,6 +14,7 @@ static CrNetEnvironment* g_chrome_net = NULL;
static BOOL g_http2_enabled = YES;
static BOOL g_quic_enabled = NO;
static BOOL g_sdch_enabled = NO;
+static BOOL g_user_agent_partial = NO;
static NSString* g_user_agent = nil;
static NSString* g_sdch_pref_store_filename = nil;
static RequestFilterBlock g_request_filter_block = nil;
@@ -35,13 +36,18 @@ static RequestFilterBlock g_request_filter_block = nil;
}
+ (void)setPartialUserAgent:(NSString *)userAgent {
+ [self setUserAgent:userAgent partial:YES];
+}
+
++ (void)setUserAgent:(NSString*)userAgent partial:(bool)partial {
g_user_agent = userAgent;
+ g_user_agent_partial = partial;
}
+ (void)installInternal {
CrNetEnvironment::Initialize();
- std::string partial_user_agent = base::SysNSStringToUTF8(g_user_agent);
- g_chrome_net = new CrNetEnvironment(partial_user_agent);
+ std::string user_agent = base::SysNSStringToUTF8(g_user_agent);
+ g_chrome_net = new CrNetEnvironment(user_agent, g_user_agent_partial == YES);
g_chrome_net->set_spdy_enabled(g_http2_enabled);
g_chrome_net->set_quic_enabled(g_quic_enabled);
« no previous file with comments | « ios/crnet/CrNet.h ('k') | ios/crnet/crnet_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698