OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // observing and modifying requests. | 37 // observing and modifying requests. |
38 class CONTENT_EXPORT ResourceDispatcherHostDelegate { | 38 class CONTENT_EXPORT ResourceDispatcherHostDelegate { |
39 public: | 39 public: |
40 // Called when a request begins. Return false to abort the request. | 40 // Called when a request begins. Return false to abort the request. |
41 virtual bool ShouldBeginRequest( | 41 virtual bool ShouldBeginRequest( |
42 int child_id, | 42 int child_id, |
43 int route_id, | 43 int route_id, |
44 const std::string& method, | 44 const std::string& method, |
45 const GURL& url, | 45 const GURL& url, |
46 ResourceType::Type resource_type, | 46 ResourceType::Type resource_type, |
47 const ResourceContext& resource_context, | 47 ResourceContext* resource_context, |
48 const Referrer& referrer); | 48 const Referrer& referrer); |
49 | 49 |
50 // Called after ShouldBeginRequest when all the resource handlers from the | 50 // Called after ShouldBeginRequest when all the resource handlers from the |
51 // content layer have been added. To add new handlers to the front, return | 51 // content layer have been added. To add new handlers to the front, return |
52 // a new handler that is chained to the given one, otherwise just reutrn the | 52 // a new handler that is chained to the given one, otherwise just reutrn the |
53 // given handler. | 53 // given handler. |
54 virtual void RequestBeginning( | 54 virtual void RequestBeginning( |
55 net::URLRequest* request, | 55 net::URLRequest* request, |
56 const ResourceContext& resource_context, | 56 ResourceContext* resource_context, |
57 ResourceType::Type resource_type, | 57 ResourceType::Type resource_type, |
58 int child_id, | 58 int child_id, |
59 int route_id, | 59 int route_id, |
60 bool is_continuation_of_transferred_request, | 60 bool is_continuation_of_transferred_request, |
61 ScopedVector<ResourceThrottle>* throttles); | 61 ScopedVector<ResourceThrottle>* throttles); |
62 | 62 |
63 // Allows an embedder to add additional resource handlers for a download. | 63 // Allows an embedder to add additional resource handlers for a download. |
64 // |is_new_request| is true if this is a request that is just starting, i.e. | 64 // |is_new_request| is true if this is a request that is just starting, i.e. |
65 // the content layer has just added its own resource handlers; it's false if | 65 // the content layer has just added its own resource handlers; it's false if |
66 // this was originally a non-download request that had some resource handlers | 66 // this was originally a non-download request that had some resource handlers |
67 // applied already and now we found out it's a download. | 67 // applied already and now we found out it's a download. |
68 // |in_complete| is true if this is invoked from |OnResponseCompleted|. | 68 // |in_complete| is true if this is invoked from |OnResponseCompleted|. |
69 virtual void DownloadStarting( | 69 virtual void DownloadStarting( |
70 net::URLRequest* request, | 70 net::URLRequest* request, |
71 const ResourceContext& resource_context, | 71 ResourceContext* resource_context, |
72 int child_id, | 72 int child_id, |
73 int route_id, | 73 int route_id, |
74 int request_id, | 74 int request_id, |
75 bool is_new_request, | 75 bool is_new_request, |
76 ScopedVector<ResourceThrottle>* throttles); | 76 ScopedVector<ResourceThrottle>* throttles); |
77 | 77 |
78 // Called to determine whether a request's start should be deferred. This | 78 // Called to determine whether a request's start should be deferred. This |
79 // is only called if the ResourceHandler associated with the request does | 79 // is only called if the ResourceHandler associated with the request does |
80 // not ask for a deferral. A return value of true will defer the start of | 80 // not ask for a deferral. A return value of true will defer the start of |
81 // the request, false will continue the request. | 81 // the request, false will continue the request. |
82 virtual bool ShouldDeferStart( | 82 virtual bool ShouldDeferStart( |
83 net::URLRequest* request, | 83 net::URLRequest* request, |
84 const ResourceContext& resource_context); | 84 ResourceContext* resource_context); |
85 | 85 |
86 // Called when an SSL Client Certificate is requested. If false is returned, | 86 // Called when an SSL Client Certificate is requested. If false is returned, |
87 // the request is canceled. Otherwise, the certificate is chosen. | 87 // the request is canceled. Otherwise, the certificate is chosen. |
88 virtual bool AcceptSSLClientCertificateRequest( | 88 virtual bool AcceptSSLClientCertificateRequest( |
89 net::URLRequest* request, | 89 net::URLRequest* request, |
90 net::SSLCertRequestInfo* cert_request_info); | 90 net::SSLCertRequestInfo* cert_request_info); |
91 | 91 |
92 // Called when authentication is required and credentials are needed. If | 92 // Called when authentication is required and credentials are needed. If |
93 // false is returned, CancelAuth() is called on the URLRequest and the error | 93 // false is returned, CancelAuth() is called on the URLRequest and the error |
94 // page is shown. If true is returned, the user will be prompted for | 94 // page is shown. If true is returned, the user will be prompted for |
(...skipping 28 matching lines...) Expand all Loading... |
123 ResourceResponse* response); | 123 ResourceResponse* response); |
124 | 124 |
125 protected: | 125 protected: |
126 ResourceDispatcherHostDelegate(); | 126 ResourceDispatcherHostDelegate(); |
127 virtual ~ResourceDispatcherHostDelegate(); | 127 virtual ~ResourceDispatcherHostDelegate(); |
128 }; | 128 }; |
129 | 129 |
130 } // namespace content | 130 } // namespace content |
131 | 131 |
132 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 132 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |