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

Side by Side Diff: ios/crnet/CrNet.mm

Issue 1979313002: Added crnet_framework target to build CrNet dynamic framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Andrei's comments. Created 4 years, 7 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
« no previous file with comments | « ios/crnet/CrNet.h ('k') | ios/crnet/Info.plist » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ios/crnet/CrNet.h" 5 #import "ios/crnet/CrNet.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "ios/net/crn_http_protocol_handler.h" 9 #import "ios/net/crn_http_protocol_handler.h"
10 #import "ios/crnet/crnet_environment.h" 10 #import "ios/crnet/crnet_environment.h"
11 11
12 static CrNetEnvironment* g_chrome_net = NULL; 12 static CrNetEnvironment* g_chrome_net = NULL;
13 13
14 static BOOL g_spdy_enabled = YES; 14 static BOOL g_http2_enabled = YES;
15 static BOOL g_quic_enabled = NO; 15 static BOOL g_quic_enabled = NO;
16 static BOOL g_sdch_enabled = NO; 16 static BOOL g_sdch_enabled = NO;
17 static NSString* g_user_agent = nil; 17 static NSString* g_user_agent = nil;
18 static NSString* g_sdch_pref_store_filename = nil; 18 static NSString* g_sdch_pref_store_filename = nil;
19 static RequestFilterBlock g_request_filter_block = nil; 19 static RequestFilterBlock g_request_filter_block = nil;
20 20
21 @implementation CrNet 21 @implementation CrNet
22 22
23 + (void)setSpdyEnabled:(BOOL)spdyEnabled { 23 + (void)setHttp2Enabled:(BOOL)http2Enabled {
24 g_spdy_enabled = spdyEnabled; 24 g_http2_enabled = http2Enabled;
25 } 25 }
26 26
27 + (void)setQuicEnabled:(BOOL)quicEnabled { 27 + (void)setQuicEnabled:(BOOL)quicEnabled {
28 g_quic_enabled = quicEnabled; 28 g_quic_enabled = quicEnabled;
29 } 29 }
30 30
31 + (void)setSDCHEnabled:(BOOL)sdchEnabled 31 + (void)setSDCHEnabled:(BOOL)sdchEnabled
32 withPrefStore:(NSString*)filename { 32 withPrefStore:(NSString*)filename {
33 g_sdch_enabled = sdchEnabled; 33 g_sdch_enabled = sdchEnabled;
34 g_sdch_pref_store_filename = filename; 34 g_sdch_pref_store_filename = filename;
35 } 35 }
36 36
37 + (void)setPartialUserAgent:(NSString *)userAgent { 37 + (void)setPartialUserAgent:(NSString *)userAgent {
38 g_user_agent = userAgent; 38 g_user_agent = userAgent;
39 } 39 }
40 40
41 + (void)installInternal { 41 + (void)installInternal {
42 CrNetEnvironment::Initialize(); 42 CrNetEnvironment::Initialize();
43 std::string partial_user_agent = base::SysNSStringToUTF8(g_user_agent); 43 std::string partial_user_agent = base::SysNSStringToUTF8(g_user_agent);
44 g_chrome_net = new CrNetEnvironment(partial_user_agent); 44 g_chrome_net = new CrNetEnvironment(partial_user_agent);
45 45
46 g_chrome_net->set_spdy_enabled(g_spdy_enabled); 46 g_chrome_net->set_spdy_enabled(g_http2_enabled);
47 g_chrome_net->set_quic_enabled(g_quic_enabled); 47 g_chrome_net->set_quic_enabled(g_quic_enabled);
48 g_chrome_net->set_sdch_enabled(g_sdch_enabled); 48 g_chrome_net->set_sdch_enabled(g_sdch_enabled);
49 if (g_sdch_pref_store_filename) { 49 if (g_sdch_pref_store_filename) {
50 std::string filename = base::SysNSStringToUTF8(g_sdch_pref_store_filename); 50 std::string filename = base::SysNSStringToUTF8(g_sdch_pref_store_filename);
51 g_chrome_net->set_sdch_pref_store_filename(filename); 51 g_chrome_net->set_sdch_pref_store_filename(filename);
52 } 52 }
53 53
54 g_chrome_net->Install(); 54 g_chrome_net->Install();
55 g_chrome_net->SetHTTPProtocolHandlerRegistered(true); 55 g_chrome_net->SetHTTPProtocolHandlerRegistered(true);
56 g_chrome_net->SetRequestFilterBlock(g_request_filter_block); 56 g_chrome_net->SetRequestFilterBlock(g_request_filter_block);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 } 130 }
131 131
132 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)clearCacheCallback { 132 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)clearCacheCallback {
133 if (g_chrome_net) { 133 if (g_chrome_net) {
134 g_chrome_net->ClearCache(clearCacheCallback); 134 g_chrome_net->ClearCache(clearCacheCallback);
135 } 135 }
136 } 136 }
137 137
138 @end 138 @end
OLDNEW
« no previous file with comments | « ios/crnet/CrNet.h ('k') | ios/crnet/Info.plist » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698