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

Unified Diff: chrome/browser/renderer_host/transfer_navigation_resource_handler.h

Issue 8669014: Fix a bug where redirect chain gets lost on process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: conditional disabling Created 9 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 side-by-side diff with in-line comments
Download patch
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..2943de3e9fb5290860f38275b81d3ef72fb0f221
--- /dev/null
+++ b/chrome/browser/renderer_host/transfer_navigation_resource_handler.h
@@ -0,0 +1,69 @@
+// 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 redirect will cause a
+// renderer process swap. When that happens, we remember the request so
+// that we can transfer it to be handled by the new renderer. This fixes
+// http://crbug.com/79520
+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_

Powered by Google App Engine
This is Rietveld 408576698