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

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

Issue 2222723002: Avoid calling into the ContentBrowserClient interface from ResourceDispatcherHostImpl to determine … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to fix 64 bit windows redness Created 4 years, 4 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
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 <memory> 10 #include <memory>
11 #include <string>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 15
15 namespace net { 16 namespace net {
16 class URLRequest; 17 class URLRequest;
17 } 18 }
18 19
19 namespace content { 20 namespace content {
20 21
21 class DownloadItem; 22 class DownloadItem;
22 class ResourceContext; 23 class ResourceContext;
23 class ResourceDispatcherHostDelegate; 24 class ResourceDispatcherHostDelegate;
24 struct DownloadSaveInfo; 25 struct DownloadSaveInfo;
25 struct Referrer; 26 struct Referrer;
26 class RenderFrameHost; 27 class RenderFrameHost;
27 28
29 // This callback is invoked when the interceptor finishes processing the
30 // header.
31 // Parameter 1 is a bool indicating success or failure.
32 // Parameter 2 contains the error code in case of failure, else 0.
33 typedef base::Callback<void(bool, int)> OnHeaderProcessedCallback;
34
35 // This callback is registered by interceptors who are interested in being
36 // notified of certain HTTP headers in outgoing requests. For e.g. Origin.
37 // Parameter 1 contains the HTTP header.
38 // Parameter 2 contains its value.
39 // Parameter 3 contains the child process id.
40 // Parameter 4 contains the current ResourceContext.
41 // Parameter 5 contains the callback which needs to be invoked once the
42 // interceptor finishes its processing.
43 typedef base::Callback<void(const std::string&,
44 const std::string&,
45 int,
46 ResourceContext*,
47 OnHeaderProcessedCallback)>
48 InterceptorCallback;
49
28 class CONTENT_EXPORT ResourceDispatcherHost { 50 class CONTENT_EXPORT ResourceDispatcherHost {
29 public: 51 public:
30 // Returns the singleton instance of the ResourceDispatcherHost. 52 // Returns the singleton instance of the ResourceDispatcherHost.
31 static ResourceDispatcherHost* Get(); 53 static ResourceDispatcherHost* Get();
32 54
33 // Causes all new requests for the root RenderFrameHost and its children to be 55 // Causes all new requests for the root RenderFrameHost and its children to be
34 // blocked (not being started) until ResumeBlockedRequestsForFrameFromUI is 56 // blocked (not being started) until ResumeBlockedRequestsForFrameFromUI is
35 // called. 57 // called.
36 static void BlockRequestsForFrameFromUI(RenderFrameHost* root_frame_host); 58 static void BlockRequestsForFrameFromUI(RenderFrameHost* root_frame_host);
37 59
38 // Resumes any blocked request for the specified root RenderFrameHost and 60 // Resumes any blocked request for the specified root RenderFrameHost and
39 // child frame hosts. 61 // child frame hosts.
40 static void ResumeBlockedRequestsForFrameFromUI( 62 static void ResumeBlockedRequestsForFrameFromUI(
41 RenderFrameHost* root_frame_host); 63 RenderFrameHost* root_frame_host);
42 64
43 // This does not take ownership of the delegate. It is expected that the 65 // This does not take ownership of the delegate. It is expected that the
44 // delegate have a longer lifetime than the ResourceDispatcherHost. 66 // delegate have a longer lifetime than the ResourceDispatcherHost.
45 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0; 67 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) = 0;
46 68
47 // Controls whether third-party sub-content can pop-up HTTP basic auth 69 // Controls whether third-party sub-content can pop-up HTTP basic auth
48 // dialog boxes. 70 // dialog boxes.
49 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0; 71 virtual void SetAllowCrossOriginAuthPrompt(bool value) = 0;
50 72
51 // Clears the ResourceDispatcherHostLoginDelegate associated with the request. 73 // Clears the ResourceDispatcherHostLoginDelegate associated with the request.
52 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; 74 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0;
53 75
76 // Registers the |interceptor| for the |http_header| passed in.
77 // The |starts_with| parameter is used to match the prefix of the
78 // |http_header| in the response and the interceptor will be invoked if there
79 // is a match. If the |starts_with| parameter is empty, the interceptor will
80 // be invoked for every occurrence of the |http_header|.
81 // Currently only HTTP header based interceptors are supported.
82 // At the moment we only support one interceptor per |http_header|.
83 virtual void RegisterInterceptor(const std::string& http_header,
84 const std::string& starts_with,
85 const InterceptorCallback& interceptor) = 0;
86
54 protected: 87 protected:
55 virtual ~ResourceDispatcherHost() {} 88 virtual ~ResourceDispatcherHost() {}
56 }; 89 };
57 90
58 } // namespace content 91 } // namespace content
59 92
60 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_ 93 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698