summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 19:10:23 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 19:10:23 +0000
commit195e77d6f2d2f615c2a5138750db124853c0a093 (patch)
treee1ea14d75832faa10ca8951e82c44a1e4b1a03ab /chrome
parent35350e871b173b3daa1e6e9921e1930ecc9331c4 (diff)
downloadchromium_src-195e77d6f2d2f615c2a5138750db124853c0a093.zip
chromium_src-195e77d6f2d2f615c2a5138750db124853c0a093.tar.gz
chromium_src-195e77d6f2d2f615c2a5138750db124853c0a093.tar.bz2
Add support to URLRequest for deferring redirects.
I chose to add an out parameter to OnReceivedRedirect because it allows for the default behavior to remain the same. I considered adding a ContinueAfterRedirect method that all OnReceivedRedirect implementations would need to call, but this caused one annoying problem: In the case of a ChromePlugin, it is possible for the URLRequest to get deleted inside the handler for the redirect. This would make it hard to subsequently call a method on the URLRequest since I would need to have a way to determine if the URLRequest had been deleted. TEST=covered by unit tests BUG=16413,6442 R=eroman,wtc Review URL: http://codereview.chromium.org/155897 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_plugin_host.cc3
-rw-r--r--chrome/browser/net/url_fetcher.cc2
-rw-r--r--chrome/browser/plugin_process_host.cc6
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc3
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h3
-rw-r--r--chrome/common/chrome_plugin_unittest.cc2
6 files changed, 6 insertions, 13 deletions
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 4772769..75a2fc3 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -189,7 +189,8 @@ class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
}
// URLRequest::Delegate
- virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url) {
+ virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url,
+ bool* defer_redirect) {
plugin_->functions().response_funcs->received_redirect(
cprequest_.get(), new_url.spec().c_str());
}
diff --git a/chrome/browser/net/url_fetcher.cc b/chrome/browser/net/url_fetcher.cc
index 4783aea8..03586eb 100644
--- a/chrome/browser/net/url_fetcher.cc
+++ b/chrome/browser/net/url_fetcher.cc
@@ -44,8 +44,6 @@ class URLFetcher::Core
void Stop();
// URLRequest::Delegate implementations
- virtual void OnReceivedRedirect(URLRequest* request,
- const GURL& new_url) { }
virtual void OnResponseStarted(URLRequest* request);
virtual void OnReadCompleted(URLRequest* request, int bytes_read);
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index fe9addf..f03b42f 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -82,8 +82,6 @@ class PluginDownloadUrlHelper : public URLRequest::Delegate {
void InitiateDownload();
// URLRequest::Delegate
- virtual void OnReceivedRedirect(URLRequest* request,
- const GURL& new_url);
virtual void OnAuthRequired(URLRequest* request,
net::AuthChallengeInfo* auth_info);
virtual void OnSSLCertificateError(URLRequest* request,
@@ -143,10 +141,6 @@ void PluginDownloadUrlHelper::InitiateDownload() {
download_file_request_->Start();
}
-void PluginDownloadUrlHelper::OnReceivedRedirect(URLRequest* request,
- const GURL& new_url) {
-}
-
void PluginDownloadUrlHelper::OnAuthRequired(
URLRequest* request,
net::AuthChallengeInfo* auth_info) {
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 9ac5b7f..5e46a8a 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -889,7 +889,8 @@ void ResourceDispatcherHost::RemovePendingRequest(
// URLRequest::Delegate -------------------------------------------------------
void ResourceDispatcherHost::OnReceivedRedirect(URLRequest* request,
- const GURL& new_url) {
+ const GURL& new_url,
+ bool* defer_redirect) {
RESOURCE_LOG("OnReceivedRedirect: " << request->url().spec());
ExtraRequestInfo* info = ExtraInfoForRequest(request);
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 7a0d4220..70ca89f 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -309,7 +309,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// URLRequest::Delegate
virtual void OnReceivedRedirect(URLRequest* request,
- const GURL& new_url);
+ const GURL& new_url,
+ bool* defer_redirect);
virtual void OnAuthRequired(URLRequest* request,
net::AuthChallengeInfo* auth_info);
virtual void OnCertificateRequested(
diff --git a/chrome/common/chrome_plugin_unittest.cc b/chrome/common/chrome_plugin_unittest.cc
index 8a884a6..521552b 100644
--- a/chrome/common/chrome_plugin_unittest.cc
+++ b/chrome/common/chrome_plugin_unittest.cc
@@ -41,8 +41,6 @@ class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
void RunTest(const GURL& url, const TestResponsePayload* expected_payload);
// URLRequest::Delegate implementations
- virtual void OnReceivedRedirect(URLRequest* request,
- const GURL& new_url) { }
virtual void OnResponseStarted(URLRequest* request);
virtual void OnReadCompleted(URLRequest* request, int bytes_read);