Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/cronet/ios/Cronet.h" | 5 #import "components/cronet/ios/Cronet.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 [NSURLCache setSharedURLCache:gPreservedSharedURLCache]; | 226 [NSURLCache setSharedURLCache:gPreservedSharedURLCache]; |
| 227 gPreservedSharedURLCache = nil; | 227 gPreservedSharedURLCache = nil; |
| 228 } | 228 } |
| 229 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; | 229 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; |
| 230 } | 230 } |
| 231 | 231 |
| 232 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config { | 232 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config { |
| 233 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ]; | 233 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ]; |
| 234 } | 234 } |
| 235 | 235 |
| 236 + (void)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes { | 236 + (bool)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes { |
|
mef
2016/11/10 17:09:48
BOOL
lilyhoughton
2016/11/16 16:04:10
Done.
| |
| 237 if (gChromeNet.Get().get() && [fileName length]) { | 237 if (gChromeNet.Get().get() && [fileName length]) { |
|
kapishnikov
2016/11/10 20:52:17
I think it would be better if we did the validatio
lilyhoughton
2016/11/16 16:04:10
I wanted to keep the obj-c wrapper as thin as poss
kapishnikov
2016/11/18 22:17:27
Acknowledged.
| |
| 238 gChromeNet.Get()->StartNetLog([fileName UTF8String], logBytes); | 238 NSURL* file = |
| 239 [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory | |
| 240 inDomains:NSUserDomainMask] | |
| 241 lastObject] URLByAppendingPathComponent:fileName]; | |
| 242 return gChromeNet.Get()->StartNetLog(base::SysNSStringToUTF8([file path]), l ogBytes); | |
| 239 } | 243 } |
| 244 | |
| 245 return false; | |
|
kapishnikov
2016/11/10 20:52:17
Use 'NO' instead of 'false' since it is Objective
lilyhoughton
2016/11/16 16:04:10
Done.
| |
| 240 } | 246 } |
| 241 | 247 |
| 242 + (void)stopNetLog { | 248 + (void)stopNetLog { |
| 243 if (gChromeNet.Get().get()) { | 249 if (gChromeNet.Get().get()) { |
| 244 gChromeNet.Get()->StopNetLog(); | 250 gChromeNet.Get()->StopNetLog(); |
| 245 } | 251 } |
| 246 } | 252 } |
| 247 | 253 |
| 248 + (NSString*)getUserAgent { | 254 + (NSString*)getUserAgent { |
| 249 if (!gChromeNet.Get().get()) { | 255 if (!gChromeNet.Get().get()) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 280 gHostResolverRulesForTesting = hostResolverRulesForTesting; | 286 gHostResolverRulesForTesting = hostResolverRulesForTesting; |
| 281 } | 287 } |
| 282 | 288 |
| 283 // This is a non-public dummy method that prevents the linker from stripping out | 289 // This is a non-public dummy method that prevents the linker from stripping out |
| 284 // the otherwise non-referenced methods from 'cronet_bidirectional_stream.cc'. | 290 // the otherwise non-referenced methods from 'cronet_bidirectional_stream.cc'. |
| 285 + (void)preventStrippingCronetBidirectionalStream { | 291 + (void)preventStrippingCronetBidirectionalStream { |
| 286 cronet_bidirectional_stream_create(NULL, 0, 0); | 292 cronet_bidirectional_stream_create(NULL, 0, 0); |
| 287 } | 293 } |
| 288 | 294 |
| 289 @end | 295 @end |
| OLD | NEW |