| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ | 5 #ifndef IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ |
| 6 #define IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ | 6 #define IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "net/cert/cert_status_flags.h" | 10 #include "net/cert/cert_status_flags.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class HttpResponseHeaders; | 15 class HttpResponseHeaders; |
| 16 class SSLInfo; | 16 class SSLInfo; |
| 17 class X509Certificate; | 17 class X509Certificate; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace web { | 20 namespace web { |
| 21 struct SSLStatus; | 21 struct SSLStatus; |
| 22 } | 22 } |
| 23 | 23 |
| 24 // All the methods in this protocol must be sent on the main thread. | 24 // All the methods in this protocol must be sent on the main thread. |
| 25 @protocol CRWRequestTrackerDelegate | 25 @protocol CRWRequestTrackerDelegate |
| 26 | 26 |
| 27 // Returns |YES| of all the requests are static file requests and returns |NO| | |
| 28 // if all the requests are network requests. Note it is not allowed for a | |
| 29 // |CRWRequestTrackerDelegate| to send both static file requests and network | |
| 30 // requests. | |
| 31 - (BOOL)isForStaticFileRequests; | |
| 32 | |
| 33 // The tracker calls this method every time there is a change in the SSL status | 27 // The tracker calls this method every time there is a change in the SSL status |
| 34 // of a page. The info is whatever object was passed to TrimToURL(). | 28 // of a page. The info is whatever object was passed to TrimToURL(). |
| 35 - (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus | 29 - (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus |
| 36 forPageUrl:(const GURL&)url | 30 forPageUrl:(const GURL&)url |
| 37 userInfo:(id)userInfo; | 31 userInfo:(id)userInfo; |
| 38 | 32 |
| 39 // The tracker calls this method when it receives response headers. | 33 // The tracker calls this method when it receives response headers. |
| 40 - (void)handleResponseHeaders:(net::HttpResponseHeaders*)headers | 34 - (void)handleResponseHeaders:(net::HttpResponseHeaders*)headers |
| 41 requestUrl:(const GURL&)requestUrl; | 35 requestUrl:(const GURL&)requestUrl; |
| 42 | 36 |
| 43 // This method is called when a network request has an issue with the SSL | |
| 44 // connection to present it to the user. The user will decide if the request | |
| 45 // should continue or not and the callback should be invoked to let the backend | |
| 46 // know. | |
| 47 // If the callback is not called the request will be cancelled on the next call | |
| 48 // to TrimToURL(). | |
| 49 // The callback is safe to call until the requestTracker it originated from | |
| 50 // is deleted. | |
| 51 typedef void (^SSLErrorCallback)(BOOL); | |
| 52 - (void)presentSSLError:(const net::SSLInfo&)info | |
| 53 forSSLStatus:(const web::SSLStatus&)status | |
| 54 onUrl:(const GURL&)url | |
| 55 recoverable:(BOOL)recoverable | |
| 56 callback:(SSLErrorCallback)shouldContinue; | |
| 57 | |
| 58 // Update the progress. | 37 // Update the progress. |
| 59 - (void)updatedProgress:(float)progress; | 38 - (void)updatedProgress:(float)progress; |
| 60 | 39 |
| 61 // This method is called when a certificate with an error is in use. | 40 // This method is called when a certificate with an error is in use. |
| 62 - (void)certificateUsed:(net::X509Certificate*)certificate | 41 - (void)certificateUsed:(net::X509Certificate*)certificate |
| 63 forHost:(const std::string&)host | 42 forHost:(const std::string&)host |
| 64 status:(net::CertStatus)status; | 43 status:(net::CertStatus)status; |
| 65 | 44 |
| 66 // Called when all the active allowed certificates need to be cleared. This | 45 // Called when all the active allowed certificates need to be cleared. This |
| 67 // happens during the TrimToURL(), which corresponds to a navigation. | 46 // happens during the TrimToURL(), which corresponds to a navigation. |
| 68 - (void)clearCertificates; | 47 - (void)clearCertificates; |
| 69 @end | 48 @end |
| 70 | 49 |
| 71 #endif // IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ | 50 #endif // IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_ |
| OLD | NEW |