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 redirect will cause a |
| 29 // renderer process swap. When that happens, we remember the request so |
| 30 // that we can transfer it to be handled by the new renderer. This fixes |
| 31 // http://crbug.com/79520 |
| 32 class TransferNavigationResourceHandler : public ResourceHandler { |
| 33 public: |
| 34 TransferNavigationResourceHandler( |
| 35 ResourceHandler* handler, |
| 36 ResourceDispatcherHost* resource_dispatcher_host, |
| 37 net::URLRequest* request); |
| 38 |
| 39 // ResourceHandler implementation: |
| 40 virtual bool OnUploadProgress( |
| 41 int request_id, uint64 position, uint64 size) OVERRIDE; |
| 42 virtual bool OnRequestRedirected( |
| 43 int request_id, const GURL& new_url, content::ResourceResponse* response, |
| 44 bool* defer) OVERRIDE; |
| 45 virtual bool OnResponseStarted( |
| 46 int request_id, content::ResourceResponse* response) OVERRIDE; |
| 47 virtual bool OnWillStart( |
| 48 int request_id, const GURL& url, bool* defer) OVERRIDE; |
| 49 virtual bool OnWillRead( |
| 50 int request_id, net::IOBuffer** buf, int* buf_size, |
| 51 int min_size) OVERRIDE; |
| 52 virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; |
| 53 virtual bool OnResponseCompleted(int request_id, |
| 54 const net::URLRequestStatus& status, |
| 55 const std::string& security_info) OVERRIDE; |
| 56 virtual void OnRequestClosed() OVERRIDE; |
| 57 |
| 58 private: |
| 59 virtual ~TransferNavigationResourceHandler(); |
| 60 |
| 61 scoped_refptr<ResourceHandler> next_handler_; |
| 62 ResourceDispatcherHost* rdh_; |
| 63 net::URLRequest* request_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(TransferNavigationResourceHandler); |
| 66 }; |
| 67 |
| 68 |
| 69 #endif // CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ |
OLD | NEW |