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

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

Issue 6532073: Move core pieces of browser\renderer_host to src\content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/renderer_host/resource_handler.h" 9 // TODO(jam): remove this file when all files have been converted.
10 #include "net/url_request/url_request_status.h" 10 #include "content/browser/renderer_host/cross_site_resource_handler.h"
11
12 class ResourceDispatcherHost;
13 struct GlobalRequestID;
14
15 // Ensures that cross-site responses are delayed until the onunload handler of
16 // the previous page is allowed to run. This handler wraps an
17 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event
18 // handlers. This is important, so that it can intercept OnResponseStarted
19 // after we determine that a response is safe and not a download.
20 class CrossSiteResourceHandler : public ResourceHandler {
21 public:
22 CrossSiteResourceHandler(ResourceHandler* handler,
23 int render_process_host_id,
24 int render_view_id,
25 ResourceDispatcherHost* resource_dispatcher_host);
26
27 // ResourceHandler implementation:
28 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size);
29 virtual bool OnRequestRedirected(int request_id, const GURL& new_url,
30 ResourceResponse* response, bool* defer);
31 virtual bool OnResponseStarted(int request_id,
32 ResourceResponse* response);
33 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer);
34 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
35 int min_size);
36 virtual bool OnReadCompleted(int request_id, int* bytes_read);
37 virtual bool OnResponseCompleted(int request_id,
38 const net::URLRequestStatus& status,
39 const std::string& security_info);
40 virtual void OnRequestClosed();
41
42 // We can now send the response to the new renderer, which will cause
43 // TabContents to swap in the new renderer and destroy the old one.
44 void ResumeResponse();
45
46 private:
47 virtual ~CrossSiteResourceHandler();
48
49 // Prepare to render the cross-site response in a new RenderViewHost, by
50 // telling the old RenderViewHost to run its onunload handler.
51 void StartCrossSiteTransition(
52 int request_id,
53 ResourceResponse* response,
54 const GlobalRequestID& global_id);
55
56 scoped_refptr<ResourceHandler> next_handler_;
57 int render_process_host_id_;
58 int render_view_id_;
59 bool has_started_response_;
60 bool in_cross_site_transition_;
61 int request_id_;
62 bool completed_during_transition_;
63 net::URLRequestStatus completed_status_;
64 std::string completed_security_info_;
65 ResourceResponse* response_;
66 ResourceDispatcherHost* rdh_;
67
68 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler);
69 };
70 11
71 #endif // CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_ 12 #endif // CHROME_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698