| 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 18 matching lines...) Expand all Loading... |
| 29 // effect before |install| is called. | 29 // effect before |install| is called. |
| 30 + (void)setQuicEnabled:(BOOL)quicEnabled; | 30 + (void)setQuicEnabled:(BOOL)quicEnabled; |
| 31 | 31 |
| 32 // Sets whether SDCH should be supported by CrNet. This method only has any | 32 // Sets whether SDCH should be supported by CrNet. This method only has any |
| 33 // effect before |install| is called. The |filename| argument is used to specify | 33 // effect before |install| is called. The |filename| argument is used to specify |
| 34 // which file should be used for SDCH persistence metadata. If |filename| is | 34 // which file should be used for SDCH persistence metadata. If |filename| is |
| 35 // nil, persistence is not enabled. The default is for SDCH to be disabled. | 35 // nil, persistence is not enabled. The default is for SDCH to be disabled. |
| 36 + (void)setSDCHEnabled:(BOOL)sdchEnabled | 36 + (void)setSDCHEnabled:(BOOL)sdchEnabled |
| 37 withPrefStore:(NSString *)filename; | 37 withPrefStore:(NSString *)filename; |
| 38 | 38 |
| 39 // |userAgent| is expected to be of the form Product/Version. | 39 // Set partial UserAgent. This function is a deprecated shortcut for: |
| 40 // Example: Foo/3.0.0.0 | 40 // [CrNet setUserAgent:userAgent partial:YES]; |
| 41 // See the documentation for |setUserAgent| for details about the |userAgent| |
| 42 // argument. |
| 43 // This method only has any effect before |install| is called. |
| 44 + (void)setPartialUserAgent:(NSString *)userAgent; |
| 45 |
| 46 // |userAgent| is expected to be the user agent value sent to remote. |
| 47 // If |partial| is set to YES, then actual user agent value is based on device |
| 48 // model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is |
| 49 // sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) |
| 50 // AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31 |
| 51 // Safari/601.1.46". |
| 52 // If partial is set to NO, then |userAgent| value is complete value sent to |
| 53 // the remote. For Example: "Foo/3.0.0.0" is sent as "Foo/3.0.0.0". |
| 41 // | 54 // |
| 42 // This method only has any effect before |install| is called. | 55 // This method only has any effect before |install| is called. |
| 43 + (void)setPartialUserAgent:(NSString *)userAgent; | 56 + (void)setUserAgent:(NSString*)userAgent partial:(bool)partial; |
| 44 | 57 |
| 45 // Set the block used to determine whether or not CrNet should handle the | 58 // 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. | 59 // 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 | 60 // Must not be called while requests are in progress. This method can be called |
| 48 // either before or after |install|. | 61 // either before or after |install|. |
| 49 + (void)setRequestFilterBlock:(RequestFilterBlock)block; | 62 + (void)setRequestFilterBlock:(RequestFilterBlock)block; |
| 50 | 63 |
| 51 // Installs CrNet. Once installed, CrNet intercepts and handles all | 64 // Installs CrNet. Once installed, CrNet intercepts and handles all |
| 52 // NSURLConnection and NSURLRequests issued by the app, including UIWebView page | 65 // NSURLConnection and NSURLRequests issued by the app, including UIWebView page |
| 53 // loads. It is recommended to call this method on the application main thread. | 66 // loads. It is recommended to call this method on the application main thread. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 125 |
| 113 // Returns the full user-agent that the stack uses. | 126 // Returns the full user-agent that the stack uses. |
| 114 // This is the exact string servers will see. | 127 // This is the exact string servers will see. |
| 115 + (NSString *)userAgent; | 128 + (NSString *)userAgent; |
| 116 | 129 |
| 117 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an | 130 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an |
| 118 // unspecified thread. | 131 // unspecified thread. |
| 119 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; | 132 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; |
| 120 | 133 |
| 121 @end | 134 @end |
| OLD | NEW |