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

Side by Side Diff: content/browser/renderer_host/cross_site_resource_handler.h

Issue 11414299: Add content/browser/loader/ for resource loading related classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
7
8 #include "content/browser/renderer_host/layered_resource_handler.h"
9 #include "net/url_request/url_request_status.h"
10
11 namespace net {
12 class URLRequest;
13 }
14
15 namespace content {
16
17 // Ensures that cross-site responses are delayed until the onunload handler of
18 // the previous page is allowed to run. This handler wraps an
19 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event
20 // handlers. This is important, so that it can intercept OnResponseStarted
21 // after we determine that a response is safe and not a download.
22 class CrossSiteResourceHandler : public LayeredResourceHandler {
23 public:
24 CrossSiteResourceHandler(scoped_ptr<ResourceHandler> next_handler,
25 int render_process_host_id,
26 int render_view_id,
27 net::URLRequest* request);
28 virtual ~CrossSiteResourceHandler();
29
30 // ResourceHandler implementation:
31 virtual bool OnRequestRedirected(int request_id,
32 const GURL& new_url,
33 ResourceResponse* response,
34 bool* defer) OVERRIDE;
35 virtual bool OnResponseStarted(int request_id,
36 ResourceResponse* response,
37 bool* defer) OVERRIDE;
38 virtual bool OnReadCompleted(int request_id,
39 int bytes_read,
40 bool* defer) OVERRIDE;
41 virtual bool OnResponseCompleted(int request_id,
42 const net::URLRequestStatus& status,
43 const std::string& security_info) OVERRIDE;
44
45 // We can now send the response to the new renderer, which will cause
46 // WebContentsImpl to swap in the new renderer and destroy the old one.
47 void ResumeResponse();
48
49 private:
50 // Prepare to render the cross-site response in a new RenderViewHost, by
51 // telling the old RenderViewHost to run its onunload handler.
52 void StartCrossSiteTransition(
53 int request_id,
54 ResourceResponse* response);
55
56 void ResumeIfDeferred();
57
58 int render_process_host_id_;
59 int render_view_id_;
60 net::URLRequest* request_;
61 bool has_started_response_;
62 bool in_cross_site_transition_;
63 int request_id_;
64 bool completed_during_transition_;
65 bool did_defer_;
66 net::URLRequestStatus completed_status_;
67 std::string completed_security_info_;
68 ResourceResponse* response_;
69
70 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler);
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698