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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/browser/download_interrupt_reasons.h" | 12 #include "content/public/browser/download_interrupt_reasons.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class URLRequest; | 15 class URLRequest; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class DownloadItem; | 20 class DownloadItem; |
21 class ResourceContext; | 21 class ResourceContext; |
22 class ResourceDispatcherHostDelegate; | 22 class ResourceDispatcherHostDelegate; |
23 struct DownloadSaveInfo; | 23 struct DownloadSaveInfo; |
24 struct Referrer; | 24 struct Referrer; |
| 25 class RenderFrameHost; |
25 | 26 |
26 class CONTENT_EXPORT ResourceDispatcherHost { | 27 class CONTENT_EXPORT ResourceDispatcherHost { |
27 public: | 28 public: |
28 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)> | 29 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)> |
29 DownloadStartedCallback; | 30 DownloadStartedCallback; |
30 | 31 |
31 // Returns the singleton instance of the ResourceDispatcherHost. | 32 // Returns the singleton instance of the ResourceDispatcherHost. |
32 static ResourceDispatcherHost* Get(); | 33 static ResourceDispatcherHost* Get(); |
33 | 34 |
| 35 // Causes all new requests for the root RenderFrameHost and its children to be |
| 36 // blocked (not being started) until ResumeBlockedRequestsForFrameFromUI is |
| 37 // called. |
| 38 static void BlockRequestsForFrameFromUI(RenderFrameHost* root_frame_host); |
| 39 |
| 40 // Resumes any blocked request for the specified root RenderFrameHost and |
| 41 // child frame hosts. |
| 42 static void ResumeBlockedRequestsForFrameFromUI( |
| 43 RenderFrameHost* root_frame_host); |
| 44 |
34 // This does not take ownership of the delegate. It is expected that the | 45 // This does not take ownership of the delegate. It is expected that the |
35 // delegate have a longer lifetime than the ResourceDispatcherHost. | 46 // delegate have a longer lifetime than the ResourceDispatcherHost. |
36 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; | 47 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; |
37 | 48 |
38 // Controls whether third-party sub-content can pop-up HTTP basic auth | 49 // Controls whether third-party sub-content can pop-up HTTP basic auth |
39 // dialog boxes. | 50 // dialog boxes. |
40 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; | 51 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; |
41 | 52 |
42 // Initiates a download by explicit request of the renderer (e.g. due to | 53 // Initiates a download by explicit request of the renderer (e.g. due to |
43 // alt-clicking a link) or some other chrome subsystem. | 54 // alt-clicking a link) or some other chrome subsystem. |
(...skipping 15 matching lines...) Expand all Loading... |
59 int render_frame_route_id, | 70 int render_frame_route_id, |
60 bool prefer_cache, | 71 bool prefer_cache, |
61 bool do_not_prompt_for_login, | 72 bool do_not_prompt_for_login, |
62 scoped_ptr<DownloadSaveInfo> save_info, | 73 scoped_ptr<DownloadSaveInfo> save_info, |
63 uint32_t download_id, | 74 uint32_t download_id, |
64 const DownloadStartedCallback& started_callback) = 0; | 75 const DownloadStartedCallback& started_callback) = 0; |
65 | 76 |
66 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. | 77 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. |
67 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; | 78 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; |
68 | 79 |
69 // Causes all new requests for the route identified by |child_id| and | |
70 // |route_id| to be blocked (not being started) until | |
71 // ResumeBlockedRequestsForRoute is called. | |
72 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0; | |
73 | |
74 // Resumes any blocked request for the specified route id. | |
75 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0; | |
76 | |
77 protected: | 80 protected: |
78 virtual ~ResourceDispatcherHost() {} | 81 virtual ~ResourceDispatcherHost() {} |
79 }; | 82 }; |
80 | 83 |
81 } // namespace content | 84 } // namespace content |
82 | 85 |
83 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ | 86 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |