Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: content/public/browser/resource_dispatcher_host.h

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/content_export.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 25
26 class CONTENT_EXPORT ResourceDispatcherHost { 26 class CONTENT_EXPORT ResourceDispatcherHost {
27 public: 27 public:
28 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)>
29 DownloadStartedCallback;
30
31 // Returns the singleton instance of the ResourceDispatcherHost. 28 // Returns the singleton instance of the ResourceDispatcherHost.
32 static ResourceDispatcherHost* Get(); 29 static ResourceDispatcherHost* Get();
33 30
34 // This does not take ownership of the delegate. It is expected that the 31 // This does not take ownership of the delegate. It is expected that the
35 // delegate have a longer lifetime than the ResourceDispatcherHost. 32 // delegate have a longer lifetime than the ResourceDispatcherHost.
36 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; 33 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0;
37 34
38 // Controls whether third-party sub-content can pop-up HTTP basic auth 35 // Controls whether third-party sub-content can pop-up HTTP basic auth
39 // dialog boxes. 36 // dialog boxes.
40 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; 37 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0;
41 38
42 // Initiates a download by explicit request of the renderer (e.g. due to
43 // alt-clicking a link) or some other chrome subsystem.
44 // |is_content_initiated| is used to indicate that the request was generated
45 // from a web page, and hence may not be as trustworthy as a browser
46 // generated request. If |download_id| is invalid, a download id will be
47 // automatically assigned to the request, otherwise the specified download id
48 // will be used. (Note that this will result in re-use of an existing
49 // download item if the download id was already assigned.) If the download
50 // is started, |started_callback| will be called on the UI thread with the
51 // DownloadItem; otherwise an interrupt reason will be returned.
52 virtual DownloadInterruptReason BeginDownload(
53 scoped_ptr<net::URLRequest> request,
54 const Referrer& referrer,
55 bool is_content_initiated,
56 ResourceContext* context,
57 int child_id,
58 int render_view_route_id,
59 int render_frame_route_id,
60 bool prefer_cache,
61 bool do_not_prompt_for_login,
62 scoped_ptr<DownloadSaveInfo> save_info,
63 uint32_t download_id,
64 const DownloadStartedCallback& started_callback) = 0;
65
66 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. 39 // Clears the ResourceDispatcherHostLoginDelegate associated with the request.
67 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; 40 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0;
68 41
69 // Causes all new requests for the route identified by |child_id| and 42 // Causes all new requests for the route identified by |child_id| and
70 // |route_id| to be blocked (not being started) until 43 // |route_id| to be blocked (not being started) until
71 // ResumeBlockedRequestsForRoute is called. 44 // ResumeBlockedRequestsForRoute is called.
72 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0; 45 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0;
73 46
74 // Resumes any blocked request for the specified route id. 47 // Resumes any blocked request for the specified route id.
75 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0; 48 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0;
76 49
77 protected: 50 protected:
78 virtual ~ResourceDispatcherHost() {} 51 virtual ~ResourceDispatcherHost() {}
79 }; 52 };
80 53
81 } // namespace content 54 } // namespace content
82 55
83 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ 56 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698