[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / public / browser / resource_dispatcher_host.h
blob3625abbc598ead8f39a1ba324e31c3896e1a17bc
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_
8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/download_interrupt_reasons.h"
12 namespace net {
13 class URLRequest;
16 namespace content {
18 class DownloadItem;
19 class ResourceContext;
20 class ResourceDispatcherHostDelegate;
21 struct DownloadSaveInfo;
22 struct Referrer;
24 class CONTENT_EXPORT ResourceDispatcherHost {
25 public:
26 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)>
27 DownloadStartedCallback;
29 // Returns the singleton instance of the ResourceDispatcherHost.
30 static ResourceDispatcherHost* Get();
32 // This does not take ownership of the delegate. It is expected that the
33 // delegate have a longer lifetime than the ResourceDispatcherHost.
34 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0;
36 // Controls whether third-party sub-content can pop-up HTTP basic auth
37 // dialog boxes.
38 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0;
40 // Initiates a download by explicit request of the renderer (e.g. due to
41 // alt-clicking a link) or some other chrome subsystem.
42 // |is_content_initiated| is used to indicate that the request was generated
43 // from a web page, and hence may not be as trustworthy as a browser
44 // generated request. If |download_id| is invalid, a download id will be
45 // automatically assigned to the request, otherwise the specified download id
46 // will be used. (Note that this will result in re-use of an existing
47 // download item if the download id was already assigned.) If the download
48 // is started, |started_callback| will be called on the UI thread with the
49 // DownloadItem; otherwise an interrupt reason will be returned.
50 virtual DownloadInterruptReason BeginDownload(
51 scoped_ptr<net::URLRequest> request,
52 const Referrer& referrer,
53 bool is_content_initiated,
54 ResourceContext* context,
55 int child_id,
56 int route_id,
57 bool prefer_cache,
58 bool do_not_prompt_for_login,
59 scoped_ptr<DownloadSaveInfo> save_info,
60 uint32 download_id,
61 const DownloadStartedCallback& started_callback) = 0;
63 // Clears the ResourceDispatcherHostLoginDelegate associated with the request.
64 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0;
66 // Causes all new requests for the route identified by |child_id| and
67 // |route_id| to be blocked (not being started) until
68 // ResumeBlockedRequestsForRoute is called.
69 virtual void BlockRequestsForRoute(int child_id, int route_id) = 0;
71 // Resumes any blocked request for the specified route id.
72 virtual void ResumeBlockedRequestsForRoute(int child_id, int route_id) = 0;
74 protected:
75 virtual ~ResourceDispatcherHost() {}
78 } // namespace content
80 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_