Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/time.h" | |
| 14 #include "base/timer.h" | |
| 15 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | |
| 16 #include "content/browser/renderer_host/resource_handler.h" | |
| 17 | |
| 18 namespace content { | |
| 19 struct ResourceResponse; | |
| 20 } | |
| 21 | |
| 22 namespace net { | |
| 23 class URLRequest; | |
| 24 } | |
| 25 | |
| 26 class ResourceDispatcherHost; | |
| 27 | |
| 28 // This ResourceHandler checks whether a navigation is redirected to or | |
| 29 // form a chrome-extension:// URL that is handled in a different | |
|
Charlie Reis
2011/12/02 22:38:11
s/form/from/
s/is handled in/should be handled by/
Matt Perry
2011/12/03 00:14:24
Done.
| |
| 30 // renderer. Such a redirection cancels the old request and creates a new | |
| 31 // one, which results in losing the POST request body and the redirection | |
| 32 // counter. If such a transfer of the navigation to a new renderer | |
| 33 // is detected, we store the old URL request and make sure that it is | |
| 34 // picked up when the new renderer sends a navigation request. | |
| 35 class TransferNavigationResourceHandler : public ResourceHandler { | |
| 36 public: | |
| 37 TransferNavigationResourceHandler( | |
| 38 ResourceHandler* handler, | |
| 39 ResourceDispatcherHost* resource_dispatcher_host, | |
| 40 net::URLRequest* request); | |
| 41 | |
| 42 // ResourceHandler implementation: | |
| 43 virtual bool OnUploadProgress( | |
| 44 int request_id, uint64 position, uint64 size) OVERRIDE; | |
| 45 virtual bool OnRequestRedirected( | |
| 46 int request_id, const GURL& new_url, content::ResourceResponse* response, | |
| 47 bool* defer) OVERRIDE; | |
| 48 virtual bool OnResponseStarted( | |
| 49 int request_id, content::ResourceResponse* response) OVERRIDE; | |
| 50 virtual bool OnWillStart( | |
| 51 int request_id, const GURL& url, bool* defer) OVERRIDE; | |
| 52 virtual bool OnWillRead( | |
| 53 int request_id, net::IOBuffer** buf, int* buf_size, | |
| 54 int min_size) OVERRIDE; | |
| 55 virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; | |
| 56 virtual bool OnResponseCompleted(int request_id, | |
| 57 const net::URLRequestStatus& status, | |
| 58 const std::string& security_info) OVERRIDE; | |
| 59 virtual void OnRequestClosed() OVERRIDE; | |
| 60 | |
| 61 private: | |
| 62 virtual ~TransferNavigationResourceHandler(); | |
| 63 | |
| 64 scoped_refptr<ResourceHandler> next_handler_; | |
| 65 ResourceDispatcherHost* rdh_; | |
| 66 net::URLRequest* request_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(TransferNavigationResourceHandler); | |
| 69 }; | |
| 70 | |
| 71 | |
| 72 #endif // CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ | |
| OLD | NEW |