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_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "content/common/content_export.h" |
9 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 class URLRequest; | 13 class URLRequest; |
13 } | 14 } |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class DownloadItem; | 18 class DownloadItem; |
18 class ResourceContext; | 19 class ResourceContext; |
(...skipping 10 matching lines...) Expand all Loading... |
29 static ResourceDispatcherHost* Get(); | 30 static ResourceDispatcherHost* Get(); |
30 | 31 |
31 // This does not take ownership of the delegate. It is expected that the | 32 // This does not take ownership of the delegate. It is expected that the |
32 // delegate have a longer lifetime than the ResourceDispatcherHost. | 33 // delegate have a longer lifetime than the ResourceDispatcherHost. |
33 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; | 34 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; |
34 | 35 |
35 // Controls whether third-party sub-content can pop-up HTTP basic auth | 36 // Controls whether third-party sub-content can pop-up HTTP basic auth |
36 // dialog boxes. | 37 // dialog boxes. |
37 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; | 38 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; |
38 | 39 |
39 // Initiates a download by explicit request of the renderer (e.g. due to | |
40 // alt-clicking a link) or some other chrome subsystem. | |
41 // |is_content_initiated| is used to indicate that the request was generated | |
42 // from a web page, and hence may not be as trustworthy as a browser | |
43 // generated request. If |download_id| is invalid, a download id will be | |
44 // automatically assigned to the request, otherwise the specified download id | |
45 // will be used. (Note that this will result in re-use of an existing | |
46 // download item if the download id was already assigned.) If the download | |
47 // is started, |started_callback| will be called on the UI thread with the | |
48 // DownloadItem; otherwise an error code will be returned. | |
49 virtual net::Error BeginDownload( | |
50 scoped_ptr<net::URLRequest> request, | |
51 const Referrer& referrer, | |
52 bool is_content_initiated, | |
53 ResourceContext* context, | |
54 int child_id, | |
55 int route_id, | |
56 bool prefer_cache, | |
57 scoped_ptr<DownloadSaveInfo> save_info, | |
58 uint32 download_id, | |
59 const DownloadStartedCallback& started_callback) = 0; | |
60 | |
61 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. | 40 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. |
62 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; | 41 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; |
63 | 42 |
64 // Causes all new requests for the route identified by |child_id| and | 43 // Causes all new requests for the route identified by |child_id| and |
65 // |route_id| to be blocked (not being started) until | 44 // |route_id| to be blocked (not being started) until |
66 // ResumeBlockedRequestsForRoute is called. | 45 // ResumeBlockedRequestsForRoute is called. |
67 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0; | 46 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0; |
68 | 47 |
69 // Resumes any blocked request for the specified route id. | 48 // Resumes any blocked request for the specified route id. |
70 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0; | 49 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0; |
71 | 50 |
72 protected: | 51 protected: |
73 virtual ~ResourceDispatcherHost() {} | 52 virtual ~ResourceDispatcherHost() {} |
74 }; | 53 }; |
75 | 54 |
76 } // namespace content | 55 } // namespace content |
77 | 56 |
78 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ | 57 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |