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

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

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: most unittests pass Created 7 years, 5 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 3f2f100b8499855513647252b14a970f008b2de1..d06c8f948d1b57c433e6a8286aa5c501970e9d7e 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -38,6 +38,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/cookie_store_map.h"
#include "content/public/browser/download_save_info.h"
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/browser/resource_context.h"
@@ -294,6 +295,7 @@ RenderMessageFilter::RenderMessageFilter(
PluginServiceImpl* plugin_service,
BrowserContext* browser_context,
net::URLRequestContextGetter* request_context,
+ const CookieStoreMap& cookie_store_map,
RenderWidgetHelper* render_widget_helper,
media::AudioManager* audio_manager,
MediaInternals* media_internals,
@@ -302,6 +304,7 @@ RenderMessageFilter::RenderMessageFilter(
plugin_service_(plugin_service),
profile_data_directory_(browser_context->GetPath()),
request_context_(request_context),
+ cookie_store_map_(cookie_store_map.Clone()),
resource_context_(browser_context->GetResourceContext()),
render_widget_helper_(render_widget_helper),
incognito_(browser_context->IsOffTheRecord()),
@@ -541,9 +544,10 @@ void RenderMessageFilter::OnSetCookie(const IPC::Message& message,
url, first_party_for_cookies, cookie,
resource_context_, render_process_id_, message.routing_id(),
&options)) {
- net::URLRequestContext* context = GetRequestContextForURL(url);
// Pass a null callback since we don't care about when the 'set' completes.
- context->cookie_store()->SetCookieWithOptionsAsync(
+ net::CookieStore* cookie_store =
+ cookie_store_map_->GetForScheme(url.scheme());
+ cookie_store->SetCookieWithOptionsAsync(
url, cookie, options, net::CookieMonster::SetCookiesCallback());
}
}
@@ -564,9 +568,8 @@ void RenderMessageFilter::OnGetCookies(const GURL& url,
base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
base::debug::Alias(url_buf);
- net::URLRequestContext* context = GetRequestContextForURL(url);
net::CookieMonster* cookie_monster =
- context->cookie_store()->GetCookieMonster();
+ cookie_store_map_->GetForScheme(url.scheme())->GetCookieMonster();
cookie_monster->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::CheckPolicyForCookies, this, url,
first_party_for_cookies, reply_msg));
@@ -591,9 +594,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::URLRequestContext* context = GetRequestContextForURL(url);
net::CookieMonster* cookie_monster =
- context->cookie_store()->GetCookieMonster();
+ cookie_store_map_->GetForScheme(url.scheme())->GetCookieMonster();
cookie_monster->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::SendGetRawCookiesResponse,
this, reply_msg));
@@ -606,8 +608,9 @@ void RenderMessageFilter::OnDeleteCookie(const GURL& url,
if (!policy->CanAccessCookiesForOrigin(render_process_id_, url))
return;
- net::URLRequestContext* context = GetRequestContextForURL(url);
- context->cookie_store()->DeleteCookieAsync(url, cookie_name, base::Closure());
+ net::CookieStore* cookie_store =
+ cookie_store_map_->GetForScheme(url.scheme());
+ cookie_store->DeleteCookieAsync(url, cookie_name, base::Closure());
}
void RenderMessageFilter::OnCookiesEnabled(
@@ -867,19 +870,6 @@ void RenderMessageFilter::OnAllocateSharedMemory(
buffer_size, PeerHandle(), handle);
}
-net::URLRequestContext* RenderMessageFilter::GetRequestContextForURL(
- const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- net::URLRequestContext* context =
- GetContentClient()->browser()->OverrideRequestContextForURL(
- url, resource_context_);
- if (!context)
- context = request_context_->GetURLRequestContext();
-
- return context;
-}
-
#if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
void RenderMessageFilter::OnAllocTransportDIB(
uint32 size, bool cache_in_browser, TransportDIB::Handle* handle) {
@@ -1038,14 +1028,15 @@ void RenderMessageFilter::CheckPolicyForCookies(
const GURL& first_party_for_cookies,
IPC::Message* reply_msg,
const net::CookieList& cookie_list) {
- 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_, reply_msg->routing_id())) {
+ net::CookieStore* cookie_store =
+ cookie_store_map_->GetForScheme(url.scheme());
// Gets the cookies from cookie store if allowed.
- context->cookie_store()->GetCookiesWithOptionsAsync(
+ cookie_store->GetCookiesWithOptionsAsync(
url, net::CookieOptions(),
base::Bind(&RenderMessageFilter::SendGetCookiesResponse,
this, reply_msg));

Powered by Google App Engine
This is Rietveld 408576698