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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 1002363002: Remove prerender cookie store, part 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prerender-revert-cookie-store-2
Patch Set: also remove hook from ContentBrowserClient Created 5 years, 9 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/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index ba1494683bebf36daf45d3f07303294ea05bd322..ce5427bde3f8245ca9cf34bc23f628c56584f35c 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -571,9 +571,9 @@ void RenderMessageFilter::OnSetCookie(int render_frame_id,
if (GetContentClient()->browser()->AllowSetCookie(
url, first_party_for_cookies, cookie, resource_context_,
render_process_id_, render_frame_id, &options)) {
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
+ net::URLRequestContext* context = GetRequestContextForURL(url);
// Pass a null callback since we don't care about when the 'set' completes.
- cookie_store->SetCookieWithOptionsAsync(
+ context->cookie_store()->SetCookieWithOptionsAsync(
url, cookie, options, net::CookieStore::SetCookiesCallback());
}
}
@@ -595,8 +595,8 @@ void RenderMessageFilter::OnGetCookies(int render_frame_id,
base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
base::debug::Alias(url_buf);
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- cookie_store->GetAllCookiesForURLAsync(
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ context->cookie_store()->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::CheckPolicyForCookies, this,
render_frame_id, url, first_party_for_cookies,
reply_msg));
@@ -621,8 +621,8 @@ void RenderMessageFilter::OnGetRawCookies(
// We check policy here to avoid sending back cookies that would not normally
// be applied to outbound requests for the given URL. Since this cookie info
// is visible in the developer tools, it is helpful to make it match reality.
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- cookie_store->GetAllCookiesForURLAsync(
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ context->cookie_store()->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::SendGetRawCookiesResponse,
this, reply_msg));
}
@@ -634,8 +634,8 @@ void RenderMessageFilter::OnDeleteCookie(const GURL& url,
if (!policy->CanAccessCookiesForOrigin(render_process_id_, url))
return;
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- cookie_store->DeleteCookieAsync(url, cookie_name, base::Closure());
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ context->cookie_store()->DeleteCookieAsync(url, cookie_name, base::Closure());
}
void RenderMessageFilter::OnCookiesEnabled(
@@ -862,15 +862,6 @@ void RenderMessageFilter::DownloadUrl(int render_view_id,
scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
save_info->suggested_name = suggested_name;
save_info->prompt_for_save_location = use_prompt;
-
- // There may be a special cookie store that we could use for this download,
- // rather than the default one. Since this feature is generally only used for
- // proper render views, and not downloads, we do not need to retrieve the
- // special cookie store here, but just initialize the request to use the
- // default cookie store.
- // TODO(tburkard): retrieve the appropriate special cookie store, if this
- // is ever to be used for downloads as well.
-
scoped_ptr<net::URLRequest> request(
resource_context_->GetRequestContext()->CreateRequest(
url, net::DEFAULT_PRIORITY, NULL, NULL));
@@ -1004,30 +995,17 @@ void RenderMessageFilter::OnDeletedDiscardableSharedMemory(
this, id));
}
-net::CookieStore* RenderMessageFilter::GetCookieStoreForURL(
+net::URLRequestContext* RenderMessageFilter::GetRequestContextForURL(
const GURL& url) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
net::URLRequestContext* context =
GetContentClient()->browser()->OverrideRequestContextForURL(
url, resource_context_);
+ if (!context)
+ context = request_context_->GetURLRequestContext();
- // If we should use a special URLRequestContext rather than the default one,
- // return the cookie store of that special URLRequestContext.
- if (context)
- return context->cookie_store();
-
- // Otherwise, if there is a special cookie store to be used for this process,
- // return that cookie store.
- net::CookieStore* cookie_store =
- GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
- render_process_id_);
- if (cookie_store)
- return cookie_store;
-
- // Otherwise, return the cookie store of the default request context used
- // for this renderer.
- return request_context_->GetURLRequestContext()->cookie_store();
+ return context;
}
void RenderMessageFilter::OnCacheableMetadataAvailable(
@@ -1121,14 +1099,14 @@ void RenderMessageFilter::CheckPolicyForCookies(
const GURL& first_party_for_cookies,
IPC::Message* reply_msg,
const net::CookieList& cookie_list) {
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
+ net::URLRequestContext* context = GetRequestContextForURL(url);
// Check the policy for get cookies, and pass cookie_list to the
// TabSpecificContentSetting for logging purpose.
if (GetContentClient()->browser()->AllowGetCookie(
url, first_party_for_cookies, cookie_list, resource_context_,
render_process_id_, render_frame_id)) {
// Gets the cookies from cookie store if allowed.
- cookie_store->GetCookiesWithOptionsAsync(
+ context->cookie_store()->GetCookiesWithOptionsAsync(
url, net::CookieOptions(),
base::Bind(&RenderMessageFilter::SendGetCookiesResponse,
this, reply_msg));
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698