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

Unified Diff: content/common/net/url_fetcher_impl.cc

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TestShellNetworkDelegate Created 8 years, 10 months 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: content/common/net/url_fetcher_impl.cc
diff --git a/content/common/net/url_fetcher_impl.cc b/content/common/net/url_fetcher_impl.cc
index 24a6a3bc95ff4c2241e86afc7edb2404fc7ff5d7..f8e0eac50d351ec5fa8bab8fff622b94dc3a5511 100644
--- a/content/common/net/url_fetcher_impl.cc
+++ b/content/common/net/url_fetcher_impl.cc
@@ -22,6 +22,7 @@
#include "base/timer.h"
#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/common/url_fetcher_factory.h"
+#include "content/public/common/url_request_user_data.h"
#include "googleurl/src/gurl.h"
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
@@ -247,6 +248,8 @@ class URLFetcherImpl::Core
// Read buffer
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
// Cookie/cache info for the request
+ int process_id_; // pid/rid of the associated render view.
jam 2012/03/05 19:11:03 nit: please don't say "pid" as that's confusing, a
jochen (gone - plz use gerrit) 2012/03/08 13:00:02 Done.
+ int routing_id_;
net::ResponseCookies cookies_; // Response cookies
net::HttpRequestHeaders extra_request_headers_;
scoped_refptr<net::HttpResponseHeaders> response_headers_;
@@ -548,6 +551,8 @@ URLFetcherImpl::Core::Core(URLFetcherImpl* fetcher,
load_flags_(net::LOAD_NORMAL),
response_code_(RESPONSE_CODE_INVALID),
buffer_(new net::IOBuffer(kBufferSize)),
+ process_id_(-1),
+ routing_id_(-1),
was_fetched_via_proxy_(false),
is_chunked_upload_(false),
num_retries_(0),
@@ -763,6 +768,8 @@ void URLFetcherImpl::Core::RetryOrCompleteUrlFetch() {
backoff_delay = base::TimeDelta();
}
request_context_getter_ = NULL;
+ process_id_ = -1;
+ routing_id_ = -1;
bool posted = delegate_loop_proxy_->PostTask(
FROM_HERE, base::Bind(&Core::OnCompletedURLRequest, this, backoff_delay));
@@ -810,6 +817,11 @@ void URLFetcherImpl::Core::StartURLRequest() {
request_->set_load_flags(flags);
request_->set_context(request_context_getter_->GetURLRequestContext());
request_->set_referrer(referrer_);
+ if (process_id_ != -1 && routing_id_ != -1) {
+ request_->SetUserData(
+ content::URLRequestUserData::kUserDataKey,
+ new content::URLRequestUserData(process_id_, routing_id_));
+ }
switch (request_type_) {
case GET:
@@ -890,6 +902,8 @@ void URLFetcherImpl::Core::CancelURLRequest() {
// delete the object, but we cannot delay the destruction of the request
// context.
request_context_getter_ = NULL;
+ process_id_ = -1;
+ routing_id_ = -1;
was_cancelled_ = true;
temp_file_writer_.reset();
}
@@ -1023,6 +1037,15 @@ void URLFetcherImpl::SetRequestContext(
core_->request_context_getter_ = request_context_getter;
}
+void URLFetcherImpl::AssociateWithRenderView(int process_id, int routing_id) {
+ DCHECK_EQ(core_->process_id_, -1);
+ DCHECK_EQ(core_->routing_id_, -1);
+ DCHECK_GE(process_id, 0);
+ DCHECK_GE(routing_id, 0);
+ core_->process_id_ = process_id;
+ core_->routing_id_ = routing_id;
+}
+
void URLFetcherImpl::SetAutomaticallyRetryOn5xx(bool retry) {
core_->automatically_retry_on_5xx_ = retry;
}
@@ -1074,12 +1097,6 @@ void URLFetcherImpl::Start() {
core_->Start();
}
-void URLFetcherImpl::StartWithRequestContextGetter(
- net::URLRequestContextGetter* request_context_getter) {
- SetRequestContext(request_context_getter);
- core_->Start();
-}
-
const GURL& URLFetcherImpl::GetOriginalURL() const {
return core_->original_url_;
}

Powered by Google App Engine
This is Rietveld 408576698