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..0b3fbc74d15d2b6054b206870ca2aa07cacfd88e 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 |
| @@ -28,10 +32,22 @@ CRONET_EXPORT |
| // This method only has any effect before |start| is called. |
| + (void)setPartialUserAgent:(NSString*)userAgent; |
| +// This method only has any effect before |start| is called. |
| ++ (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting; |
|
kapishnikov
2016/08/10 17:47:40
I wonder if we can somehow hide "...ForTesting" me
mef
2016/08/11 21:22:15
Great idea! I've extracted them into Cronet(TestSu
|
| + |
| +// Sets a native MockCertVerifier for testing. |
| +// This method only has any effect before |start| is called. |
| ++ (void)setMockCertVerifierForTesting:(void*)mockCertVerifierForTesting; |
| + |
| // 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 |
| +// request. If this is not set, Cronet will handle all requests. |
| +// This method only has any effect before |start| is called. |
| ++ (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, |
| +// including |
| +// requests done through shared NSURLSession. |
|
kapishnikov
2016/08/10 17:47:40
This can fit in the previous line.
mef
2016/08/11 21:22:15
Done.
|
| +// 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 Croet into an NSURLSession, passed in by the caller. Note that this |
|
kapishnikov
2016/08/10 17:47:40
Croer=>Cronet
mef
2016/08/11 21:22:15
Done.
|
| +// NSURLSession will share settings with the sharedSession, which the |
|
kapishnikov
2016/08/10 17:47:40
The shared session has its own internal configurat
mef
2016/08/11 21:22:15
Done.
|
| +// |registerHttpProtocolHandler| method installs Cronet into. |
| +// 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,11 @@ 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. |
| +// 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. |
| ++ (NSData*)getGlobalMetricsDeltas; |
|
kapishnikov
2016/08/10 17:47:40
What is the structure of NSData? What should the u
mef
2016/08/11 21:22:15
Done.
|
| + |
| @end |