| 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 ResumeBlockedRequestsForRoute is called. |
| 37 static void BlockRequestsForFramesFromUI(RenderFrameHost* root_frame_host); |
| 38 |
| 39 // Resumes any blocked request for the specified root RenderFrameHost and |
| 40 // child frame hosts. |
| 41 static void ResumeBlockedRequestsForFramesFromUI( |
| 42 RenderFrameHost* root_frame_host); |
| 43 |
| 34 // This does not take ownership of the delegate. It is expected that the | 44 // This does not take ownership of the delegate. It is expected that the |
| 35 // delegate have a longer lifetime than the ResourceDispatcherHost. | 45 // delegate have a longer lifetime than the ResourceDispatcherHost. |
| 36 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; | 46 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; |
| 37 | 47 |
| 38 // Controls whether third-party sub-content can pop-up HTTP basic auth | 48 // Controls whether third-party sub-content can pop-up HTTP basic auth |
| 39 // dialog boxes. | 49 // dialog boxes. |
| 40 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; | 50 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; |
| 41 | 51 |
| 42 // Initiates a download by explicit request of the renderer (e.g. due to | 52 // Initiates a download by explicit request of the renderer (e.g. due to |
| 43 // alt-clicking a link) or some other chrome subsystem. | 53 // alt-clicking a link) or some other chrome subsystem. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 int render_frame_route_id, | 69 int render_frame_route_id, |
| 60 bool prefer_cache, | 70 bool prefer_cache, |
| 61 bool do_not_prompt_for_login, | 71 bool do_not_prompt_for_login, |
| 62 scoped_ptr<DownloadSaveInfo> save_info, | 72 scoped_ptr<DownloadSaveInfo> save_info, |
| 63 uint32_t download_id, | 73 uint32_t download_id, |
| 64 const DownloadStartedCallback& started_callback) = 0; | 74 const DownloadStartedCallback& started_callback) = 0; |
| 65 | 75 |
| 66 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. | 76 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. |
| 67 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; | 77 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; |
| 68 | 78 |
| 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: | 79 protected: |
| 78 virtual ~ResourceDispatcherHost() {} | 80 virtual ~ResourceDispatcherHost() {} |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace content | 83 } // namespace content |
| 82 | 84 |
| 83 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ | 85 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |