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 17 matching lines...) Expand all Loading... |
28 // effect before |install| is called. | 28 // effect before |install| is called. |
29 + (void)setQuicEnabled:(BOOL)quicEnabled; | 29 + (void)setQuicEnabled:(BOOL)quicEnabled; |
30 | 30 |
31 // Sets whether SDCH should be supported by CrNet. This method only has any | 31 // 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 | 32 // 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 | 33 // 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. | 34 // nil, persistence is not enabled. The default is for SDCH to be disabled. |
35 + (void)setSDCHEnabled:(BOOL)sdchEnabled | 35 + (void)setSDCHEnabled:(BOOL)sdchEnabled |
36 withPrefStore:(NSString*)filename; | 36 withPrefStore:(NSString*)filename; |
37 | 37 |
38 // Set the alternate protocol threshold. Servers announce alternate protocols | |
39 // with a probability value; any alternate protocol whose probability value is | |
40 // greater than this value will be used, so |alternateProtocolThreshold| == 0 | |
41 // implies any announced alternate protocol will be used, and | |
42 // |alternateProtocolThreshold| == 1 implies no alternate protocol will ever be | |
43 // used. Note that individual alternate protocols must also be individually | |
44 // enabled to be considered; currently the only alternate protocol is QUIC (SPDY | |
45 // is not controlled by this mechanism). | |
46 // | |
47 // For example, imagine your service has two frontends a.service.com and | |
48 // b.service.com, and you would like to divide your users into three classes: | |
49 // Users who use QUIC for both a and b | |
50 // Users who use QUIC for a but not b | |
51 // Users who use QUIC for neither a nor b | |
52 // You can achieve that effect with: | |
53 // a.service.com advertises QUIC with p=0.67 | |
54 // b.service.com advertises QUIC with p=0.33 | |
55 // alternateProtocolThreshold set to a uniform random number in [0,1] | |
56 // Now equal proportions of users will fall into the three experimental groups. | |
57 // | |
58 // The default for this value is 1.0, i.e. all alternate protocols disabled. | |
59 + (void)setAlternateProtocolThreshold:(double)alternateProtocolThreshold; | |
60 | |
61 // |userAgent| is expected to be of the form Product/Version. | 38 // |userAgent| is expected to be of the form Product/Version. |
62 // Example: Foo/3.0.0.0 | 39 // Example: Foo/3.0.0.0 |
63 // | 40 // |
64 // This method only has any effect before |install| is called. | 41 // This method only has any effect before |install| is called. |
65 + (void)setPartialUserAgent:(NSString *)userAgent; | 42 + (void)setPartialUserAgent:(NSString *)userAgent; |
66 | 43 |
67 // Set the block used to determine whether or not CrNet should handle the | 44 // Set the block used to determine whether or not CrNet should handle the |
68 // request. If this is not set, CrNet will handle all requests. | 45 // request. If this is not set, CrNet will handle all requests. |
69 // Must not be called while requests are in progress. This method can be called | 46 // Must not be called while requests are in progress. This method can be called |
70 // either before or after |install|. | 47 // either before or after |install|. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 107 |
131 // Returns the full user-agent that the stack uses. | 108 // Returns the full user-agent that the stack uses. |
132 // This is the exact string servers will see. | 109 // This is the exact string servers will see. |
133 + (NSString *)userAgent; | 110 + (NSString *)userAgent; |
134 | 111 |
135 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an | 112 // Clears CrNet's http cache. The supplied callback, if not nil, is run on an |
136 // unspecified thread. | 113 // unspecified thread. |
137 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; | 114 + (void)clearCacheWithCompletionCallback:(ClearCacheCallback)completionBlock; |
138 | 115 |
139 @end | 116 @end |
OLD | NEW |