| OLD | NEW |
| 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 <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 | 6 |
| 7 // A block, that takes a request, and returns YES if the request should | 7 // A block, that takes a request, and returns YES if the request should |
| 8 // be handled. | 8 // be handled. |
| 9 typedef BOOL(^RequestFilterBlock)(NSURLRequest *request); | 9 typedef BOOL(^RequestFilterBlock)(NSURLRequest *request); |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 + (void)setPartialUserAgent:(NSString *)userAgent; | 43 + (void)setPartialUserAgent:(NSString *)userAgent; |
| 44 | 44 |
| 45 // Set the block used to determine whether or not CrNet should handle the | 45 // Set the block used to determine whether or not CrNet should handle the |
| 46 // request. If this is not set, CrNet will handle all requests. | 46 // request. If this is not set, CrNet will handle all requests. |
| 47 // Must not be called while requests are in progress. This method can be called | 47 // Must not be called while requests are in progress. This method can be called |
| 48 // either before or after |install|. | 48 // either before or after |install|. |
| 49 + (void)setRequestFilterBlock:(RequestFilterBlock)block; | 49 + (void)setRequestFilterBlock:(RequestFilterBlock)block; |
| 50 | 50 |
| 51 // Installs CrNet. Once installed, CrNet intercepts and handles all | 51 // Installs CrNet. Once installed, CrNet intercepts and handles all |
| 52 // NSURLConnection and NSURLRequests issued by the app, including UIWebView page | 52 // NSURLConnection and NSURLRequests issued by the app, including UIWebView page |
| 53 // loads. | 53 // loads. It is recommended to call this method on the application main thread. |
| 54 // If the method is called on any thread other than the main one, the method |
| 55 // will internally try to execute synchronously using the main GCD queue. |
| 56 // Please make sure that the main thread is not blocked by a job |
| 57 // that calls this method; otherwise, a deadlock can occur. |
| 54 + (void)install; | 58 + (void)install; |
| 55 | 59 |
| 56 // Installs CrNet into an NSURLSession, passed in by the caller. Note that this | 60 // Installs CrNet into an NSURLSession, passed in by the caller. Note that this |
| 57 // NSURLSession will share settings with the sharedSession, which the |install| | 61 // NSURLSession will share settings with the sharedSession, which the |install| |
| 58 // method installs CrNet into. This method must be called after |install|. | 62 // method installs CrNet into. This method must be called after |install|. |
| 59 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config; | 63 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config; |
| 60 | 64 |
| 61 // Installs CrNet. This function is a deprecated shortcut for: | 65 // Installs CrNet. This function is a deprecated shortcut for: |
| 62 // [CrNet setPartialUserAgent:userAgent]; | 66 // [CrNet setPartialUserAgent:userAgent]; |
| 63 // [CrNet install]; | 67 // [CrNet install]; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 112 |
| 109 // Returns the full user-agent that the stack uses. | 113 // Returns the full user-agent that the stack uses. |
| 110 // This is the exact string servers will see. | 114 // This is the exact string servers will see. |
| 111 + (NSString *)userAgent; | 115 + (NSString *)userAgent; |
| 112 | 116 |
| 113 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an | 117 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an |
| 114 // unspecified thread. | 118 // unspecified thread. |
| 115 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; | 119 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; |
| 116 | 120 |
| 117 @end | 121 @end |
| OLD | NEW |