Chromium Code Reviews| Index: components/cronet/ios/Cronet.h |
| diff --git a/components/cronet/ios/Cronet.h b/components/cronet/ios/Cronet.h |
| index fc7b9c2486aa0573c1e3ce33264b8a67646e7390..534d20b7fa86b86ec6a0dc0b7119a1ad571c3a3a 100644 |
| --- a/components/cronet/ios/Cronet.h |
| +++ b/components/cronet/ios/Cronet.h |
| @@ -6,6 +6,10 @@ |
| #include "cronet_c_for_grpc.h" |
| +// A block, that takes a request, and returns YES if the request should |
| +// be handled. |
| +typedef BOOL (^RequestFilterBlock)(NSURLRequest* request); |
| + |
| // Interface for installing Cronet. |
| CRONET_EXPORT |
| @interface Cronet : NSObject |
| @@ -22,16 +26,28 @@ CRONET_EXPORT |
| // before |start| is called. |
| + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort; |
| -// |userAgent| is expected to be of the form Product/Version. |
| -// Example: Foo/3.0.0.0 |
| +// |userAgent| is expected to be the user agent value sent to remote. |
|
kapishnikov
2016/10/19 18:28:53
Not sure about the use of 'expected' here. Maybe b
mef
2016/10/19 20:12:58
Done.
|
| +// If |partial| is set to YES, then actual user agent value is based on device |
| +// model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is |
| +// sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) |
| +// AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31 |
| +// Safari/601.1.46". |
| +// If partial is set to NO, then |userAgent| value is complete value sent to |
|
kapishnikov
2016/10/19 18:28:53
partial -> |partial|
mef
2016/10/19 20:12:58
Done.
|
| +// the remote. For Example: "Foo/3.0.0.0" is sent as "Foo/3.0.0.0". |
| // |
| // This method only has any effect before |start| is called. |
| -+ (void)setPartialUserAgent:(NSString*)userAgent; |
| ++ (void)setUserAgent:(NSString*)userAgent partial:(BOOL)partial; |
| // Sets SSLKEYLogFileName to export SSL key for Wireshark decryption of packet |
| // captures. This method only has any effect before |start| is called. |
| + (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName; |
| +// Set the block used to determine whether or not Cronet should handle the |
|
kapishnikov
2016/10/19 18:28:53
Set->Sets
mef
2016/10/19 20:12:58
Done.
|
| +// request. If this is not set, Cronet will handle all requests. Cronet retains |
|
kapishnikov
2016/10/19 18:28:53
this->'the block'
mef
2016/10/19 20:12:58
Done.
|
| +// strong reference to the block, which can be released by calling this method |
| +// with nil block. |
| ++ (void)setRequestFilterBlock:(RequestFilterBlock)block; |
| + |
| // Starts CronetEngine. It is recommended to call this method on the application |
| // main thread. If the method is called on any thread other than the main one, |
| // the method will internally try to execute synchronously using the main GCD |
| @@ -39,6 +55,24 @@ CRONET_EXPORT |
| // that calls this method; otherwise, a deadlock can occur. |
| + (void)start; |
| +// Registers Cronet as HttpProtocol Handler. Once registered, Cronet intercepts |
| +// and handles all NSURLConnection and NSURLRequests issued by the app, |
|
kapishnikov
2016/10/19 18:28:53
Since
1) NSURLRequest is merely a value objects th
mef
2016/10/19 20:12:58
Done.
|
| +// including requests done through shared NSURLSession. |
| +// This method must be called after |start|. |
| ++ (void)registerHttpProtocolHandler; |
| + |
| +// Unregister Cronet as HttpProtocol Handler. This means that Cronet will stop |
| +// intercepting requests, however, it won't tear down the Cronet environment. |
| +// This method must be called after |start|. |
| ++ (void)unregisterHttpProtocolHandler; |
| + |
| +// Installs Cronet into NSURLSessionConfiguration so that all |
| +// NSURLSessions created with this configuration will use the Cronet stack. |
| +// Note that all Cronet settings are global and are shared between |
| +// all NSURLSessions & NSURLConnections that use the Cronet stack. |
| +// This method must be called after |start|. |
| ++ (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config; |
| + |
| // Starts net-internals logging to a file named |fileName| in the application |
| // temporary directory. |fileName| must not be empty. Log level is determined |
| // by |logBytes| - if YES then LOG_ALL otherwise LOG_ALL_BUT_BYTES. If the file |
| @@ -57,4 +91,22 @@ CRONET_EXPORT |
| // Get a pointer to global instance of cronet_engine for GRPC C API. |
| + (cronet_engine*)getGlobalEngine; |
| +// Returns differences in metrics collected by Cronet since the last call to |
| +// getGlobalMetricsDeltas, serialized as a |
| +// <a href=https://developers.google.com/protocol-buffers>protobuf</a>. |
|
kapishnikov
2016/10/19 18:28:53
Xcode uses markup to specify links: see https://de
mef
2016/10/19 20:12:58
Done.
|
| +// |
| +// Cronet starts collecting these metrics after the first call to |
| +// getGlobalMetricsDeltras, so the first call returns no |
| +// useful data as no metrics have yet been collected. |
| +// differences in metrics collected by Cronet, since the last call |
|
kapishnikov
2016/10/19 18:28:53
I think this line should not be here.
mef
2016/10/19 20:12:58
Done.
|
| ++ (NSData*)getGlobalMetricsDeltas; |
| + |
| +// Sets Host Resolver Rules for testing. |
| +// This method only has any effect before |start| is called. |
| ++ (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting; |
| + |
| +// Enables TestCertVerifier which accepts all certificates for testing. |
| +// This method only has any effect before |start| is called. |
| ++ (void)enableTestCertVerifierForTesting; |
|
kapishnikov
2016/10/19 18:28:53
I remember we discussed moving these methods to Te
mef
2016/10/19 20:12:58
Yes, I would like to revisit that idea if we can c
|
| + |
| @end |