Fix breakages in https://codereview.chromium.org/1155713003/
[chromium-blink-merge.git] / ios / web / net / crw_request_tracker_delegate.h
blob2e8d8277647177db92107cecc38ab01b5eafc346
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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_
6 #define IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_
8 #include <vector>
10 #include "net/cert/cert_status_flags.h"
12 class GURL;
14 namespace net {
15 class HttpResponseHeaders;
16 class SSLInfo;
17 class X509Certificate;
20 namespace web {
21 struct SSLStatus;
24 // All the methods in this protocol must be sent on the main thread.
25 @protocol CRWRequestTrackerDelegate
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;
33 // 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().
35 - (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus
36 forPageUrl:(const GURL&)url
37 userInfo:(id)userInfo;
39 // The tracker calls this method when it receives response headers.
40 - (void)handleResponseHeaders:(net::HttpResponseHeaders*)headers
41 requestUrl:(const GURL&)requestUrl;
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;
58 // Update the progress.
59 - (void)updatedProgress:(float)progress;
61 // This method is called when a certificate with an error is in use.
62 - (void)certificateUsed:(net::X509Certificate*)certificate
63 forHost:(const std::string&)host
64 status:(net::CertStatus)status;
66 // Called when all the active allowed certificates need to be cleared. This
67 // happens during the TrimToURL(), which corresponds to a navigation.
68 - (void)clearCertificates;
69 @end
71 #endif // IOS_WEB_NET_CRW_REQUEST_TRACKER_DELEGATE_H_