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 |
11 | 11 |
12 // A callback, called when the clearCache message has completed. The |errorCode| | 12 // A callback, called when the clearCache message has completed. The |errorCode| |
13 // is a network stack error code indicating whether the clear request succeeded | 13 // is a network stack error code indicating whether the clear request succeeded |
14 // or not. Even if the request failed, the cache may have been cleared anyway, | 14 // or not. Even if the request failed, the cache may have been cleared anyway, |
15 // or it may not have; it is not useful to retry a failing cache-clear attempt. | 15 // or it may not have; it is not useful to retry a failing cache-clear attempt. |
16 // The only real use of |errorCode| is for error reporting and statistics | 16 // The only real use of |errorCode| is for error reporting and statistics |
17 // gathering. | 17 // gathering. |
18 typedef void(^ClearCacheCallback)(int errorCode); | 18 typedef void(^ClearCacheCallback)(int errorCode); |
19 | 19 |
20 // Interface for installing CrNet. | 20 // Interface for installing CrNet. |
| 21 __attribute__((visibility("default"))) |
21 @interface CrNet : NSObject | 22 @interface CrNet : NSObject |
22 | 23 |
23 // Sets whether SPDY should be supported by CrNet. This method only has any | 24 // Sets whether HTTP/2 should be supported by CrNet. This method only has |
24 // effect before |install| is called. | 25 // any effect before |install| is called. |
25 + (void)setSpdyEnabled:(BOOL)spdyEnabled; | 26 + (void)setHttp2Enabled:(BOOL)http2Enabled; |
26 | 27 |
27 // Sets whether QUIC should be supported by CrNet. This method only has any | 28 // Sets whether QUIC should be supported by CrNet. This method only has any |
28 // effect before |install| is called. | 29 // effect before |install| is called. |
29 + (void)setQuicEnabled:(BOOL)quicEnabled; | 30 + (void)setQuicEnabled:(BOOL)quicEnabled; |
30 | 31 |
31 // 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 |
32 // 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 |
33 // 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 |
34 // 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. |
35 + (void)setSDCHEnabled:(BOOL)sdchEnabled | 36 + (void)setSDCHEnabled:(BOOL)sdchEnabled |
36 withPrefStore:(NSString*)filename; | 37 withPrefStore:(NSString *)filename; |
37 | 38 |
38 // |userAgent| is expected to be of the form Product/Version. | 39 // |userAgent| is expected to be of the form Product/Version. |
39 // Example: Foo/3.0.0.0 | 40 // Example: Foo/3.0.0.0 |
40 // | 41 // |
41 // This method only has any effect before |install| is called. | 42 // This method only has any effect before |install| is called. |
42 + (void)setPartialUserAgent:(NSString *)userAgent; | 43 + (void)setPartialUserAgent:(NSString *)userAgent; |
43 | 44 |
44 // 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 |
45 // request. If this is not set, CrNet will handle all requests. | 46 // request. If this is not set, CrNet will handle all requests. |
46 // 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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // Returns the full user-agent that the stack uses. | 109 // Returns the full user-agent that the stack uses. |
109 // This is the exact string servers will see. | 110 // This is the exact string servers will see. |
110 + (NSString *)userAgent; | 111 + (NSString *)userAgent; |
111 | 112 |
112 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an | 113 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an |
113 // unspecified thread. | 114 // unspecified thread. |
114 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; | 115 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; |
115 | 116 |
116 @end | 117 @end |
OLD | NEW |