| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 class GURL; |
| 14 class ResourceDispatcherHostLoginDelegate; |
| 15 class ResourceHandler; |
| 16 struct ResourceHostMsg_Request; |
| 17 |
| 18 namespace content { |
| 19 class ResourceContext; |
| 20 } |
| 21 |
| 22 namespace net { |
| 23 class AuthChallengeInfo; |
| 24 class SSLCertRequestInfo; |
| 25 class URLRequest; |
| 26 } |
| 27 |
| 28 // Interface that the embedder provides to ResourceDispatcherHost to allow |
| 29 // observing and modifying requests. |
| 30 class ResourceDispatcherHostDelegate { |
| 31 public: |
| 32 // Called when a request begins. Return false to abort the request. |
| 33 virtual bool ShouldBeginRequest( |
| 34 int child_id, int route_id, |
| 35 const ResourceHostMsg_Request& request_data, |
| 36 const content::ResourceContext& resource_context, |
| 37 const GURL& referrer); |
| 38 |
| 39 // Called after ShouldBeginRequest when all the resource handlers from the |
| 40 // content layer have been added. To add new handlers to the front, return |
| 41 // a new handler that is chained to the given one, otherwise just reutrn the |
| 42 // given handler. |
| 43 virtual ResourceHandler* RequestBeginning(ResourceHandler* handler, |
| 44 net::URLRequest* request, |
| 45 bool is_subresource, |
| 46 int child_id, |
| 47 int route_id); |
| 48 |
| 49 // Called when a download is starting, after the resource handles from the |
| 50 // content layer have been added. |
| 51 virtual ResourceHandler* DownloadStarting(ResourceHandler* handler, |
| 52 int child_id, |
| 53 int route_id); |
| 54 |
| 55 // Called to determine whether a request's start should be deferred. This |
| 56 // is only called if the ResourceHandler associated with the request does |
| 57 // not ask for a deferral. A return value of true will defer the start of |
| 58 // the request, false will continue the request. |
| 59 virtual bool ShouldDeferStart( |
| 60 net::URLRequest* request, |
| 61 const content::ResourceContext& resource_context); |
| 62 |
| 63 // Called when an SSL Client Certificate is requested. If false is returned, |
| 64 // the request is canceled. Otherwise, the certificate is chosen. |
| 65 virtual bool AcceptSSLClientCertificateRequest( |
| 66 net::URLRequest* request, |
| 67 net::SSLCertRequestInfo* cert_request_info); |
| 68 |
| 69 // Called when authentication is required and credentials are needed. If |
| 70 // false is returned, CancelAuth() is called on the URLRequest and the error |
| 71 // page is shown. If true is returned, the user will be prompted for |
| 72 // authentication credentials. |
| 73 virtual bool AcceptAuthRequest(net::URLRequest* request, |
| 74 net::AuthChallengeInfo* auth_info); |
| 75 |
| 76 // Creates a ResourceDispatcherHostLoginDelegate that asks the user for a |
| 77 // username and password. |
| 78 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
| 79 net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
| 80 |
| 81 // Launches the url for the given tab. |
| 82 virtual void HandleExternalProtocol(const GURL& url, |
| 83 int child_id, |
| 84 int route_id); |
| 85 |
| 86 protected: |
| 87 ResourceDispatcherHostDelegate(); |
| 88 virtual ~ResourceDispatcherHostDelegate(); |
| 89 }; |
| 90 |
| 91 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
| OLD | NEW |