diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 15:51:23 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 15:51:23 +0000 |
commit | 9025016cccf554e56096e0ba220cb6e38e9c57ce (patch) | |
tree | 830d15fa74ef752e787c3984eb23aee4c3bdc32c /content | |
parent | d91aaac40c25cbd3f289453191539834e5e97427 (diff) | |
download | chromium_src-9025016cccf554e56096e0ba220cb6e38e9c57ce.zip chromium_src-9025016cccf554e56096e0ba220cb6e38e9c57ce.tar.gz chromium_src-9025016cccf554e56096e0ba220cb6e38e9c57ce.tar.bz2 |
Get rid of net::CookiePolicy, now that all code that uses it (except WebSocketJob, which appears to be unused and which I updated in this cl) is switched over to use ContentBrowserClient.
BUG=76793
Review URL: http://codereview.chromium.org/6973011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
4 files changed, 36 insertions, 6 deletions
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc index ef90cd65..d0b4621 100644 --- a/content/browser/renderer_host/browser_render_process_host.cc +++ b/content/browser/renderer_host/browser_render_process_host.cc @@ -383,7 +383,8 @@ void BrowserRenderProcessHost::CreateMessageFilters() { SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( - new RendererURLRequestContextSelector(profile(), id())); + new RendererURLRequestContextSelector(profile(), id()), + &profile()->GetResourceContext()); channel_->AddFilter(socket_stream_dispatcher_host); channel_->AddFilter( diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc index 565e448..00f4d01 100644 --- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc @@ -6,17 +6,21 @@ #include "base/logging.h" #include "chrome/browser/profiles/profile.h" +#include "content/browser/content_browser_client.h" #include "content/browser/renderer_host/socket_stream_host.h" #include "content/common/socket_stream.h" #include "content/common/socket_stream_messages.h" #include "content/common/resource_messages.h" +#include "net/base/cookie_monster.h" #include "net/url_request/url_request_context_getter.h" #include "net/websockets/websocket_job.h" #include "net/websockets/websocket_throttle.h" SocketStreamDispatcherHost::SocketStreamDispatcherHost( - ResourceMessageFilter::URLRequestContextSelector* selector) - : url_request_context_selector_(selector) { + ResourceMessageFilter::URLRequestContextSelector* selector, + const content::ResourceContext* resource_context) + : url_request_context_selector_(selector), + resource_context_(resource_context) { DCHECK(selector); net::WebSocketJob::EnsureInit(); } @@ -103,6 +107,20 @@ void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { DeleteSocketStreamHost(socket_id); } +bool SocketStreamDispatcherHost::CanGetCookies(net::SocketStream* socket, + const GURL& url) { + return content::GetContentClient()->browser()->AllowGetCookie( + url, url, net::CookieList(), *resource_context_, 0, MSG_ROUTING_NONE); +} + +bool SocketStreamDispatcherHost::CanSetCookie(net::SocketStream* request, + const GURL& url, + const std::string& cookie_line, + net::CookieOptions* options) { + return content::GetContentClient()->browser()->AllowSetCookie( + url, url, cookie_line, *resource_context_, 0, MSG_ROUTING_NONE, options); +} + // Message handlers called by OnMessageReceived. void SocketStreamDispatcherHost::OnConnect(const GURL& url, int socket_id) { DVLOG(1) << "SocketStreamDispatcherHost::OnConnect url=" << url diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.h b/content/browser/renderer_host/socket_stream_dispatcher_host.h index 355edd11..fe7e349 100644 --- a/content/browser/renderer_host/socket_stream_dispatcher_host.h +++ b/content/browser/renderer_host/socket_stream_dispatcher_host.h @@ -16,14 +16,19 @@ class GURL; class SocketStreamHost; +namespace content { +class ResourceContext; +} + // Dispatches ViewHostMsg_SocketStream_* messages sent from renderer. // It also acts as SocketStream::Delegate so that it sends // ViewMsg_SocketStream_* messages back to renderer. class SocketStreamDispatcherHost : public BrowserMessageFilter, public net::SocketStream::Delegate { public: - explicit SocketStreamDispatcherHost( - ResourceMessageFilter::URLRequestContextSelector* selector); + SocketStreamDispatcherHost( + ResourceMessageFilter::URLRequestContextSelector* selector, + const content::ResourceContext* resource_context); virtual ~SocketStreamDispatcherHost(); // BrowserMessageFilter methods. @@ -40,6 +45,11 @@ class SocketStreamDispatcherHost : public BrowserMessageFilter, virtual void OnReceivedData(net::SocketStream* socket, const char* data, int len); virtual void OnClose(net::SocketStream* socket); + virtual bool CanGetCookies(net::SocketStream* socket, const GURL& url); + virtual bool CanSetCookie(net::SocketStream* request, + const GURL& url, + const std::string& cookie_line, + net::CookieOptions* options); private: // Message handlers called by OnMessageReceived. @@ -54,6 +64,7 @@ class SocketStreamDispatcherHost : public BrowserMessageFilter, IDMap<SocketStreamHost> hosts_; const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> url_request_context_selector_; + const content::ResourceContext* resource_context_; DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); }; diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index f6a805a..082e09c 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -240,7 +240,7 @@ void WorkerProcessHost::CreateMessageFilters(int render_process_id) { SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( - new URLRequestContextSelector(request_context)); + new URLRequestContextSelector(request_context), resource_context_); AddFilter(socket_stream_dispatcher_host); } |