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

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

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

Powered by Google App Engine
This is Rietveld 408576698