Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "bidirectional_stream_c.h" | 7 #include "bidirectional_stream_c.h" |
| 8 | 8 |
| 9 // TODO(mef): Remove this header after transition to bidirectional_stream_c.h | 9 // TODO(mef): Remove this header after transition to bidirectional_stream_c.h |
| 10 // See crbug.com/650462 for details. | 10 // See crbug.com/650462 for details. |
| 11 #include "cronet_c_for_grpc.h" | 11 #include "cronet_c_for_grpc.h" |
| 12 | 12 |
| 13 // Type of HTTP cache; public interface to private implementation defined in | 13 // Type of HTTP cache; public interface to private implementation defined in |
| 14 // URLRequestContextConfig class. | 14 // URLRequestContextConfig class. |
| 15 enum HttpCacheType { | 15 typedef NS_ENUM(NSInteger, CRNHttpCacheType) { |
|
robgaunt
2017/02/01 19:46:44
In objective-C, acronyms and initialisms are conve
| |
| 16 // Disabled HTTP cache. Some data may still be temporarily stored in memory. | 16 // Disabled HTTP cache. Some data may still be temporarily stored in memory. |
| 17 DISABLED, | 17 CRNHttpCacheTypeDisabled, |
| 18 // Enable on-disk HTTP cache, including HTTP data. | 18 // Enable on-disk HTTP cache, including HTTP data. |
| 19 DISK, | 19 CRNHttpCacheTypeDisk, |
| 20 // Enable in-memory cache, including HTTP data. | 20 // Enable in-memory cache, including HTTP data. |
| 21 MEMORY, | 21 CRNHttpCacheTypeMemory, |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 // A block, that takes a request, and returns YES if the request should | 24 // A block, that takes a request, and returns YES if the request should |
| 25 // be handled. | 25 // be handled. |
| 26 typedef BOOL (^RequestFilterBlock)(NSURLRequest* request); | 26 typedef BOOL (^RequestFilterBlock)(NSURLRequest* request); |
| 27 | 27 |
| 28 // Interface for installing Cronet. | 28 // Interface for installing Cronet. |
| 29 // TODO(gcasto): Should this macro be separate from the one defined in | 29 // TODO(gcasto): Should this macro be separate from the one defined in |
| 30 // bidirectional_stream_c.h? | 30 // bidirectional_stream_c.h? |
| 31 GRPC_SUPPORT_EXPORT | 31 GRPC_SUPPORT_EXPORT |
| 32 @interface Cronet : NSObject | 32 @interface Cronet : NSObject |
| 33 | 33 |
| 34 // Sets whether HTTP/2 should be supported by CronetEngine. This method only has | 34 // Sets whether HTTP/2 should be supported by CronetEngine. This method only has |
| 35 // any effect before |start| is called. | 35 // any effect before |start| is called. |
| 36 + (void)setHttp2Enabled:(BOOL)http2Enabled; | 36 + (void)setHttp2Enabled:(BOOL)http2Enabled; |
| 37 | 37 |
| 38 // Sets whether QUIC should be supported by CronetEngine. This method only has | 38 // Sets whether QUIC should be supported by CronetEngine. This method only has |
| 39 // any effect before |start| is called. | 39 // any effect before |start| is called. |
| 40 + (void)setQuicEnabled:(BOOL)quicEnabled; | 40 + (void)setQuicEnabled:(BOOL)quicEnabled; |
| 41 | 41 |
| 42 // Set HTTP Cache type to be used by CronetEngine. This method only has any | 42 // Set HTTP Cache type to be used by CronetEngine. This method only has any |
| 43 // effect before |start| is called. See HttpCacheType enum for available | 43 // effect before |start| is called. See HttpCacheType enum for available |
| 44 // options. | 44 // options. |
| 45 + (void)setHttpCacheType:(HttpCacheType)httpCacheType; | 45 + (void)setHttpCacheType:(CRNHttpCacheType)httpCacheType; |
| 46 | 46 |
| 47 // Adds hint that host supports QUIC on altPort. This method only has any effect | 47 // Adds hint that host supports QUIC on altPort. This method only has any effect |
| 48 // before |start| is called. | 48 // before |start| is called. |
| 49 + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort; | 49 + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort; |
| 50 | 50 |
| 51 // Sets the User-Agent request header string to be sent with all requests. | 51 // Sets the User-Agent request header string to be sent with all requests. |
| 52 // If |partial| is set to YES, then actual user agent value is based on device | 52 // If |partial| is set to YES, then actual user agent value is based on device |
| 53 // model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is | 53 // model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is |
| 54 // sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) | 54 // sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) |
| 55 // AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31 | 55 // AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 128 |
| 129 // Sets Host Resolver Rules for testing. | 129 // Sets Host Resolver Rules for testing. |
| 130 // This method must be called after |start| has been called. | 130 // This method must be called after |start| has been called. |
| 131 + (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting; | 131 + (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting; |
| 132 | 132 |
| 133 // Enables TestCertVerifier which accepts all certificates for testing. | 133 // Enables TestCertVerifier which accepts all certificates for testing. |
| 134 // This method only has any effect before |start| is called. | 134 // This method only has any effect before |start| is called. |
| 135 + (void)enableTestCertVerifierForTesting; | 135 + (void)enableTestCertVerifierForTesting; |
| 136 | 136 |
| 137 @end | 137 @end |
| OLD | NEW |