Chromium Code Reviews| Index: chrome/browser/renderer_host/transfer_navigation_resource_handler.h |
| diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_handler.h b/chrome/browser/renderer_host/transfer_navigation_resource_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6ad0baf9b448d44421866c7008b17661e0454d1e |
| --- /dev/null |
| +++ b/chrome/browser/renderer_host/transfer_navigation_resource_handler.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ |
| +#define CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ |
| +#pragma once |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/time.h" |
| +#include "base/timer.h" |
| +#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| +#include "content/browser/renderer_host/resource_handler.h" |
| + |
| +namespace content { |
| +struct ResourceResponse; |
| +} |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +class ResourceDispatcherHost; |
| + |
| +// This ResourceHandler checks whether a navigation is redirected to or |
| +// 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.
|
| +// renderer. Such a redirection cancels the old request and creates a new |
| +// one, which results in losing the POST request body and the redirection |
| +// counter. If such a transfer of the navigation to a new renderer |
| +// is detected, we store the old URL request and make sure that it is |
| +// picked up when the new renderer sends a navigation request. |
| +class TransferNavigationResourceHandler : public ResourceHandler { |
| + public: |
| + TransferNavigationResourceHandler( |
| + ResourceHandler* handler, |
| + ResourceDispatcherHost* resource_dispatcher_host, |
| + net::URLRequest* request); |
| + |
| + // ResourceHandler implementation: |
| + virtual bool OnUploadProgress( |
| + int request_id, uint64 position, uint64 size) OVERRIDE; |
| + virtual bool OnRequestRedirected( |
| + int request_id, const GURL& new_url, content::ResourceResponse* response, |
| + bool* defer) OVERRIDE; |
| + virtual bool OnResponseStarted( |
| + int request_id, content::ResourceResponse* response) OVERRIDE; |
| + virtual bool OnWillStart( |
| + int request_id, const GURL& url, bool* defer) OVERRIDE; |
| + virtual bool OnWillRead( |
| + int request_id, net::IOBuffer** buf, int* buf_size, |
| + int min_size) OVERRIDE; |
| + virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; |
| + virtual bool OnResponseCompleted(int request_id, |
| + const net::URLRequestStatus& status, |
| + const std::string& security_info) OVERRIDE; |
| + virtual void OnRequestClosed() OVERRIDE; |
| + |
| + private: |
| + virtual ~TransferNavigationResourceHandler(); |
| + |
| + scoped_refptr<ResourceHandler> next_handler_; |
| + ResourceDispatcherHost* rdh_; |
| + net::URLRequest* request_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TransferNavigationResourceHandler); |
| +}; |
| + |
| + |
| +#endif // CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_HANDLER_H_ |