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 | |
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
34 files changed, 112 insertions, 501 deletions
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc deleted file mode 100644 index 142aedd..0000000 --- a/chrome/browser/net/chrome_cookie_policy.cc +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/net/chrome_cookie_policy.h" - -#include "base/command_line.h" -#include "base/string_util.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/common/chrome_switches.h" -#include "content/browser/browser_thread.h" -#include "net/base/net_errors.h" -#include "net/base/static_cookie_policy.h" - -// ---------------------------------------------------------------------------- - -ChromeCookiePolicy::ChromeCookiePolicy(HostContentSettingsMap* map) - : host_content_settings_map_(map), - strict_third_party_blocking_( - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kBlockReadingThirdPartyCookies)) {} - -ChromeCookiePolicy::~ChromeCookiePolicy() {} - -int ChromeCookiePolicy::CanGetCookies(const GURL& url, - const GURL& first_party) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - if (host_content_settings_map_->BlockThirdPartyCookies()) { - net::StaticCookiePolicy policy(strict_third_party_blocking_ ? - net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES : - net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); - int rv = policy.CanGetCookies(url, first_party); - DCHECK_NE(net::ERR_IO_PENDING, rv); - if (rv != net::OK) - return rv; - } - - int policy = CheckPolicy(url); - if (policy == net::OK_FOR_SESSION_ONLY) - policy = net::OK; - DCHECK_NE(net::ERR_IO_PENDING, policy); - return policy; -} - -int ChromeCookiePolicy::CanSetCookie(const GURL& url, - const GURL& first_party, - const std::string& cookie_line) const { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - if (host_content_settings_map_->BlockThirdPartyCookies()) { - net::StaticCookiePolicy policy(strict_third_party_blocking_ ? - net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES : - net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); - int rv = policy.CanSetCookie(url, first_party, cookie_line); - if (rv != net::OK) - return rv; - } - - int policy = CheckPolicy(url); - DCHECK_NE(net::ERR_IO_PENDING, policy); - return policy; -} - -int ChromeCookiePolicy::CheckPolicy(const GURL& url) const { - ContentSetting setting = host_content_settings_map_->GetContentSetting( - url, CONTENT_SETTINGS_TYPE_COOKIES, ""); - if (setting == CONTENT_SETTING_BLOCK) - return net::ERR_ACCESS_DENIED; - if (setting == CONTENT_SETTING_ALLOW) - return net::OK; - if (setting == CONTENT_SETTING_SESSION_ONLY) - return net::OK_FOR_SESSION_ONLY; - NOTREACHED(); - return net::ERR_ACCESS_DENIED; -} diff --git a/chrome/browser/net/chrome_cookie_policy.h b/chrome/browser/net/chrome_cookie_policy.h deleted file mode 100644 index 907fb5e..0000000 --- a/chrome/browser/net/chrome_cookie_policy.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ -#define CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ -#pragma once - -#include <map> -#include <string> -#include <vector> - -#include "base/memory/ref_counted.h" -#include "googleurl/src/gurl.h" -#include "net/base/cookie_policy.h" - -class HostContentSettingsMap; - -// Implements CookiePolicy that uses HostContentSettingsMap and -// net::StaticCookiePolicy to decide if the cookie should be blocked. -class ChromeCookiePolicy : public net::CookiePolicy { - public: - explicit ChromeCookiePolicy(HostContentSettingsMap* map); - virtual ~ChromeCookiePolicy(); - - // CookiePolicy methods: - virtual int CanGetCookies(const GURL& url, const GURL& first_party) const; - virtual int CanSetCookie(const GURL& url, - const GURL& first_party, - const std::string& cookie_line) const; - - private: - int CheckPolicy(const GURL& url) const; - - const scoped_refptr<HostContentSettingsMap> host_content_settings_map_; - - // True if blocking third-party cookies also applies to reading them. - bool strict_third_party_blocking_; - - friend class ChromeCookiePolicyTest; - DISALLOW_COPY_AND_ASSIGN(ChromeCookiePolicy); -}; - -#endif // CHROME_BROWSER_NET_CHROME_COOKIE_POLICY_H_ diff --git a/chrome/browser/net/chrome_cookie_policy_unittest.cc b/chrome/browser/net/chrome_cookie_policy_unittest.cc deleted file mode 100644 index 4721076..0000000 --- a/chrome/browser/net/chrome_cookie_policy_unittest.cc +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/net/chrome_cookie_policy.h" - -#include "chrome/browser/content_settings/content_settings_pattern.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/common/content_settings.h" -#include "chrome/common/content_settings_types.h" -#include "chrome/test/testing_profile.h" -#include "content/browser/browser_thread.h" -#include "googleurl/src/gurl.h" -#include "net/base/net_errors.h" -#include "testing/gtest/include/gtest/gtest.h" - -static const GURL kBlockedSite = GURL("http://ads.thirdparty.com"); -static const GURL kAllowedSite = GURL("http://good.allays.com"); -static const GURL kFirstPartySite = GURL("http://cool.things.com"); - -class ChromeCookiePolicyTest : public testing::Test { - public: - ChromeCookiePolicyTest() - : ui_thread_(BrowserThread::UI, &message_loop_), - io_thread_(BrowserThread::IO, &message_loop_), - cookie_policy_(settings()) { - } - - TestingProfile* profile() { return &profile_; } - - HostContentSettingsMap* settings() { - return profile()->GetHostContentSettingsMap(); - } - - ChromeCookiePolicy* policy() { return &cookie_policy_; } - - void set_strict_third_party_blocking(bool flag) { - policy()->strict_third_party_blocking_ = flag; - } - - void SetException(const GURL& url, ContentSetting setting) { - settings()->AddExceptionForURL(url, CONTENT_SETTINGS_TYPE_COOKIES, "", - setting); - } - - private: - // HostContentSettingsMap can only operate and be deleted on the UI thread. - // Give it a fake one. - MessageLoop message_loop_; - BrowserThread ui_thread_; - BrowserThread io_thread_; - - TestingProfile profile_; - ChromeCookiePolicy cookie_policy_; -}; - -namespace { - -TEST_F(ChromeCookiePolicyTest, BlockSingle) { - SetException(kBlockedSite, CONTENT_SETTING_BLOCK); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kBlockedSite, kBlockedSite)); -} - -TEST_F(ChromeCookiePolicyTest, BlockThirdParty) { - settings()->SetBlockThirdPartyCookies(true); - EXPECT_EQ(net::OK, - policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kBlockedSite, kFirstPartySite, "")); - - set_strict_third_party_blocking(true); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); -} - -TEST_F(ChromeCookiePolicyTest, AllowThirdParty) { - settings()->SetBlockThirdPartyCookies(false); - EXPECT_EQ(net::OK, policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); - EXPECT_EQ(net::OK, policy()->CanSetCookie(kBlockedSite, kFirstPartySite, "")); -} - -TEST_F(ChromeCookiePolicyTest, ExplicitBlockSingleThirdParty) { - SetException(kBlockedSite, CONTENT_SETTING_BLOCK); - settings()->SetBlockThirdPartyCookies(false); - - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kBlockedSite, kFirstPartySite, "")); - EXPECT_EQ(net::OK, - policy()->CanSetCookie(kAllowedSite, kFirstPartySite, "")); -} - -TEST_F(ChromeCookiePolicyTest, ExplicitSessionOnly) { - SetException(kBlockedSite, CONTENT_SETTING_SESSION_ONLY); - - settings()->SetBlockThirdPartyCookies(false); - EXPECT_EQ(net::OK, policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); - EXPECT_EQ(net::OK_FOR_SESSION_ONLY, - policy()->CanSetCookie(kBlockedSite, kFirstPartySite, "")); - - settings()->SetBlockThirdPartyCookies(true); - EXPECT_EQ(net::OK, policy()->CanGetCookies(kBlockedSite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kBlockedSite, kFirstPartySite, "")); -} - -TEST_F(ChromeCookiePolicyTest, ThirdPartyAlwaysBlocked) { - SetException(kAllowedSite, CONTENT_SETTING_ALLOW); - - settings()->SetBlockThirdPartyCookies(true); - EXPECT_EQ(net::OK, - policy()->CanGetCookies(kAllowedSite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kAllowedSite, kFirstPartySite, "")); - - set_strict_third_party_blocking(true); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kAllowedSite, kFirstPartySite)); -} - -TEST_F(ChromeCookiePolicyTest, BlockEverything) { - settings()->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, - CONTENT_SETTING_BLOCK); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kFirstPartySite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kFirstPartySite, kFirstPartySite, "")); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kAllowedSite, kFirstPartySite, "")); -} - -TEST_F(ChromeCookiePolicyTest, BlockEverythingExceptAllowed) { - settings()->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, - CONTENT_SETTING_BLOCK); - SetException(kAllowedSite, CONTENT_SETTING_ALLOW); - - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanGetCookies(kFirstPartySite, kFirstPartySite)); - EXPECT_EQ(net::ERR_ACCESS_DENIED, - policy()->CanSetCookie(kFirstPartySite, kFirstPartySite, "")); - EXPECT_EQ(net::OK, policy()->CanGetCookies(kAllowedSite, kFirstPartySite)); - EXPECT_EQ(net::OK, policy()->CanSetCookie(kAllowedSite, kFirstPartySite, "")); - EXPECT_EQ(net::OK, policy()->CanGetCookies(kAllowedSite, kAllowedSite)); - EXPECT_EQ(net::OK, policy()->CanSetCookie(kAllowedSite, kAllowedSite, "")); -} - -} diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 9273ba8..0216f81 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -410,11 +410,6 @@ ChromeURLRequestContext::~ChromeURLRequestContext() { NotificationType::URL_REQUEST_CONTEXT_RELEASED, Source<net::URLRequestContext>(this), NotificationService::NoDetails()); - - // cookie_policy_'s lifetime is auto-managed by chrome_cookie_policy_. We - // null this out here to avoid a dangling reference to chrome_cookie_policy_ - // when ~net::URLRequestContext runs. - set_cookie_policy(NULL); } const std::string& ChromeURLRequestContext::GetUserAgent( diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index 7b2c287..bb9d72e 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -20,7 +20,6 @@ #include "content/browser/chrome_blob_storage_context.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "net/base/cookie_policy.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "webkit/fileapi/file_system_context.h" diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index a2d5a99..644dbfe 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc @@ -129,9 +129,6 @@ void OffTheRecordProfileIOData::LazyInitializeInternal( ApplyProfileParamsToContext(main_context); ApplyProfileParamsToContext(extensions_context); - main_context->set_cookie_policy(cookie_policy()); - extensions_context->set_cookie_policy(cookie_policy()); - main_context->set_net_log(io_thread->net_log()); extensions_context->set_net_log(io_thread->net_log()); diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index b295fc2..33bd8b8 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -182,10 +182,6 @@ void ProfileImplIOData::LazyInitializeInternal( ApplyProfileParamsToContext(media_request_context_); ApplyProfileParamsToContext(extensions_context); - main_context->set_cookie_policy(cookie_policy()); - media_request_context_->set_cookie_policy(cookie_policy()); - extensions_context->set_cookie_policy(cookie_policy()); - main_context->set_net_log(io_thread->net_log()); media_request_context_->set_net_log(io_thread->net_log()); extensions_context->set_net_log(io_thread->net_log()); diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index efdb752..e12daa4 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -18,7 +18,6 @@ #include "chrome/browser/extensions/user_script_master.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/net/chrome_cookie_notification_details.h" -#include "chrome/browser/net/chrome_cookie_policy.h" #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/net/chrome_network_delegate.h" @@ -292,10 +291,6 @@ void ProfileIOData::LazyInitialize() const { profile_params_->appcache_service->set_request_context(main_request_context_); - // Create objects pointed to by URLRequestContext. - cookie_policy_.reset( - new ChromeCookiePolicy(profile_params_->host_content_settings_map)); - network_delegate_.reset(new ChromeNetworkDelegate( io_thread_globals->extension_event_router_forwarder.get(), profile_params_->profile_id, diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index addee5b..a46d142 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h @@ -157,10 +157,6 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { return proxy_service_.get(); } - net::CookiePolicy* cookie_policy() const { - return cookie_policy_.get(); - } - ChromeURLRequestContext* main_request_context() const { return main_request_context_; } @@ -218,7 +214,6 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { mutable scoped_ptr<net::NetworkDelegate> network_delegate_; mutable scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_; mutable scoped_ptr<net::ProxyService> proxy_service_; - mutable scoped_ptr<net::CookiePolicy> cookie_policy_; // Pointed to by ResourceContext. mutable scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 240bcf0..cb03148 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -124,7 +124,6 @@ #include "net/base/cookie_monster.h" #include "net/base/net_util.h" #include "net/base/registry_controlled_domain.h" -#include "net/base/static_cookie_policy.h" #include "net/url_request/url_request_context.h" #include "ui/base/animation/animation.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 20ef26a..edd0a82 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1314,8 +1314,6 @@ 'browser/net/browser_url_util.cc', 'browser/net/browser_url_util.h', 'browser/net/chrome_cookie_notification_details.h', - 'browser/net/chrome_cookie_policy.cc', - 'browser/net/chrome_cookie_policy.h', 'browser/net/chrome_dns_cert_provenance_checker.cc', 'browser/net/chrome_dns_cert_provenance_checker.h', 'browser/net/chrome_dns_cert_provenance_checker_factory.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index c5f9599..9c64759 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1395,7 +1395,6 @@ 'browser/mock_keychain_mac.h', 'browser/mock_plugin_exceptions_table_model.cc', 'browser/mock_plugin_exceptions_table_model.h', - 'browser/net/chrome_cookie_policy_unittest.cc', 'browser/net/chrome_net_log_unittest.cc', 'browser/net/connection_tester_unittest.cc', 'browser/net/gaia/token_service_unittest.cc', diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index 577d2b2..b17b3b5 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -16,7 +16,6 @@ #include "chrome/service/service_process.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" -#include "net/base/cookie_policy.h" #include "net/base/dnsrr_resolver.h" #include "net/base/host_resolver.h" #include "net/base/ssl_config_service_defaults.h" diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h index 5cb896d..1b13f5a 100644 --- a/chrome/service/net/service_url_request_context.h +++ b/chrome/service/net/service_url_request_context.h @@ -10,7 +10,6 @@ #include "base/memory/scoped_ptr.h" #include "net/base/cookie_monster.h" -#include "net/base/cookie_policy.h" #include "net/base/host_resolver.h" #include "net/base/ssl_config_service_defaults.h" #include "net/disk_cache/disk_cache.h" 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); } diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h deleted file mode 100644 index 59ec7ef..0000000 --- a/net/base/cookie_policy.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NET_BASE_COOKIE_POLICY_H_ -#define NET_BASE_COOKIE_POLICY_H_ -#pragma once - -#include <string> - -#include "net/base/completion_callback.h" - -class GURL; - -namespace net { - -// Alternative success codes for CookiePolicy::Can{Get,Set}Cookie(s). -enum { - OK_FOR_SESSION_ONLY = 1, // The cookie may be set but not persisted. -}; - -class CookiePolicy { - public: - virtual ~CookiePolicy() {} - - // Determines if the URL's cookies may be read. - // - // Returns: - // OK - if allowed to read cookies - // ERR_ACCESS_DENIED - if not allowed to read cookies - virtual int CanGetCookies(const GURL& url, - const GURL& first_party_for_cookies) const = 0; - - // Determines if the URL's cookies may be written. - // - // Returns: - // OK - if allowed to write cookies - // OK_FOR_SESSION_ONLY - if allowed to write cookies, but forces them to - // be stored as session cookies - // ERR_ACCESS_DENIED - if not allowed to write cookies - virtual int CanSetCookie(const GURL& url, - const GURL& first_party_for_cookies, - const std::string& cookie_line) const = 0; -}; - -} // namespace net - -#endif // NET_BASE_COOKIE_POLICY_H_ diff --git a/net/base/static_cookie_policy.h b/net/base/static_cookie_policy.h index 77a62e8..12a78cd 100644 --- a/net/base/static_cookie_policy.h +++ b/net/base/static_cookie_policy.h @@ -9,7 +9,6 @@ #include <string> #include "base/basictypes.h" -#include "net/base/cookie_policy.h" class GURL; @@ -17,11 +16,7 @@ namespace net { // The StaticCookiePolicy class implements a static cookie policy that supports // three modes: allow all, deny all, or block third-party cookies. -// -// NOTE: This CookiePolicy implementation always completes synchronously. The -// callback parameter will be ignored if specified. Just pass NULL. -// -class StaticCookiePolicy : public CookiePolicy { +class StaticCookiePolicy { public: // Do not change the order of these types as they are persisted in // preferences. @@ -49,18 +44,15 @@ class StaticCookiePolicy : public CookiePolicy { void set_type(Type type) { type_ = type; } Type type() const { return type_; } - // CookiePolicy methods: - // Consults the user's third-party cookie blocking preferences to determine // whether the URL's cookies can be read. - virtual int CanGetCookies(const GURL& url, - const GURL& first_party_for_cookies) const; + int CanGetCookies(const GURL& url, const GURL& first_party_for_cookies) const; // Consults the user's third-party cookie blocking preferences to determine // whether the URL's cookies can be set. - virtual int CanSetCookie(const GURL& url, - const GURL& first_party_for_cookies, - const std::string& cookie_line) const; + int CanSetCookie(const GURL& url, + const GURL& first_party_for_cookies, + const std::string& cookie_line) const; private: Type type_; diff --git a/net/net.gyp b/net/net.gyp index 8eb2b65..cca149e 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -58,7 +58,6 @@ 'base/cookie_monster.cc', 'base/cookie_monster.h', 'base/cookie_options.h', - 'base/cookie_policy.h', 'base/cookie_store.cc', 'base/cookie_store.h', 'base/crypto_module.h', diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index 08d840c..b41777f 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -32,6 +32,7 @@ namespace net { class AuthChallengeInfo; class ClientSocketFactory; +class CookieOptions; class HostResolver; class HttpAuthHandlerFactory; class SSLConfigService; @@ -95,6 +96,21 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { // This is only for error reporting to the delegate. // |error| is net::Error. virtual void OnError(const SocketStream* socket, int error) {} + + // Called when reading cookies to allow the delegate to block access to the + // cookie. + virtual bool CanGetCookies(SocketStream* socket, const GURL& url) { + return true; + } + + // Called when a cookie is set to allow the delegate to block access to the + // cookie. + virtual bool CanSetCookie(SocketStream* request, + const GURL& url, + const std::string& cookie_line, + CookieOptions* options) { + return true; + } }; SocketStream(const GURL& url, Delegate* delegate); diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc index 7e02641..c197ebe 100644 --- a/net/url_request/url_request_context.cc +++ b/net/url_request/url_request_context.cc @@ -21,7 +21,6 @@ URLRequestContext::URLRequestContext() dns_cert_checker_(NULL), http_auth_handler_factory_(NULL), network_delegate_(NULL), - cookie_policy_(NULL), transport_security_state_(NULL), http_transaction_factory_(NULL), ftp_transaction_factory_(NULL) { @@ -40,7 +39,6 @@ void URLRequestContext::CopyFrom(URLRequestContext* other) { set_ssl_config_service(other->ssl_config_service()); set_network_delegate(other->network_delegate()); set_cookie_store(other->cookie_store()); - set_cookie_policy(other->cookie_policy()); set_transport_security_state(other->transport_security_state()); // FTPAuthCache is unique per context. set_accept_language(other->accept_language()); diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index ae09f4d..bc74459 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -21,7 +21,6 @@ namespace net { class CertVerifier; -class CookiePolicy; class CookieStore; class DnsCertProvenanceChecker; class DnsRRResolver; @@ -133,13 +132,6 @@ class URLRequestContext CookieStore* cookie_store() const { return cookie_store_.get(); } void set_cookie_store(CookieStore* cookie_store); - // Gets the cookie policy for this context (may be null, in which case - // cookies are allowed). - CookiePolicy* cookie_policy() const { return cookie_policy_; } - void set_cookie_policy(CookiePolicy* cookie_policy) { - cookie_policy_ = cookie_policy; - } - TransportSecurityState* transport_security_state() const { return transport_security_state_; } @@ -206,7 +198,6 @@ class URLRequestContext scoped_refptr<SSLConfigService> ssl_config_service_; NetworkDelegate* network_delegate_; scoped_refptr<CookieStore> cookie_store_; - CookiePolicy* cookie_policy_; scoped_refptr<TransportSecurityState> transport_security_state_; FtpAuthCache ftp_auth_cache_; std::string accept_language_; diff --git a/net/url_request/url_request_context_storage.cc b/net/url_request/url_request_context_storage.cc index c2b9be7..d54614a 100644 --- a/net/url_request/url_request_context_storage.cc +++ b/net/url_request/url_request_context_storage.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "net/base/cert_verifier.h" -#include "net/base/cookie_policy.h" #include "net/base/cookie_store.h" #include "net/base/dnsrr_resolver.h" #include "net/base/host_resolver.h" @@ -82,11 +81,6 @@ void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) { cookie_store_ = cookie_store; } -void URLRequestContextStorage::set_cookie_policy(CookiePolicy* cookie_policy) { - context_->set_cookie_policy(cookie_policy); - cookie_policy_.reset(cookie_policy); -} - void URLRequestContextStorage::set_transport_security_state( TransportSecurityState* transport_security_state) { context_->set_transport_security_state(transport_security_state); diff --git a/net/url_request/url_request_context_storage.h b/net/url_request/url_request_context_storage.h index 5397981..ccb042e 100644 --- a/net/url_request/url_request_context_storage.h +++ b/net/url_request/url_request_context_storage.h @@ -13,7 +13,6 @@ namespace net { class CertVerifier; -class CookiePolicy; class CookieStore; class DnsCertProvenanceChecker; class DnsRRResolver; @@ -52,7 +51,6 @@ class URLRequestContextStorage { void set_ssl_config_service(SSLConfigService* ssl_config_service); void set_network_delegate(NetworkDelegate* network_delegate); void set_cookie_store(CookieStore* cookie_store); - void set_cookie_policy(CookiePolicy* cookie_policy); void set_transport_security_state( TransportSecurityState* transport_security_state); void set_http_transaction_factory( @@ -78,7 +76,6 @@ class URLRequestContextStorage { scoped_refptr<SSLConfigService> ssl_config_service_; scoped_ptr<NetworkDelegate> network_delegate_; scoped_refptr<CookieStore> cookie_store_; - scoped_ptr<CookiePolicy> cookie_policy_; scoped_refptr<TransportSecurityState> transport_security_state_; scoped_ptr<HttpTransactionFactory> http_transaction_factory_; diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index e6b07e8c..55f6028 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -437,7 +437,23 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() { allow = false; } - OnCanGetCookiesCompleted(allow); + if (request_->context()->cookie_store() && allow) { + CookieOptions options; + options.set_include_httponly(); + std::string cookies = + request_->context()->cookie_store()->GetCookiesWithOptions( + request_->url(), options); + if (!cookies.empty()) { + request_info_.extra_headers.SetHeader( + HttpRequestHeaders::kCookie, cookies); + } + } + // We may have been canceled within CanGetCookies. + if (GetStatus().is_success()) { + StartTransaction(); + } else { + NotifyCanceled(); + } } void URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete() { @@ -484,7 +500,13 @@ void URLRequestHttpJob::SaveNextCookie() { } } - OnCanSetCookieCompleted(); + response_cookies_save_index_++; + // We may have been canceled within OnSetCookie. + if (GetStatus().is_success()) { + SaveNextCookie(); + } else { + NotifyCanceled(); + } } void URLRequestHttpJob::FetchResponseCookies( @@ -588,36 +610,6 @@ void URLRequestHttpJob::ProcessStrictTransportSecurityHeader() { } } -void URLRequestHttpJob::OnCanGetCookiesCompleted(bool allow) { - if (request_->context()->cookie_store() && allow) { - CookieOptions options; - options.set_include_httponly(); - std::string cookies = - request_->context()->cookie_store()->GetCookiesWithOptions( - request_->url(), options); - if (!cookies.empty()) { - request_info_.extra_headers.SetHeader( - HttpRequestHeaders::kCookie, cookies); - } - } - // We may have been canceled within CanGetCookies. - if (GetStatus().is_success()) { - StartTransaction(); - } else { - NotifyCanceled(); - } -} - -void URLRequestHttpJob::OnCanSetCookieCompleted() { - response_cookies_save_index_++; - // We may have been canceled within OnSetCookie. - if (GetStatus().is_success()) { - SaveNextCookie(); - } else { - NotifyCanceled(); - } -} - void URLRequestHttpJob::OnStartCompleted(int result) { RecordTimer(); diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index 960db8e..9620457 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h @@ -53,8 +53,6 @@ class URLRequestHttpJob : public URLRequestJob { // Process the Strict-Transport-Security header, if one exists. void ProcessStrictTransportSecurityHeader(); - void OnCanGetCookiesCompleted(bool allow); - void OnCanSetCookieCompleted(); void OnStartCompleted(int result); void OnReadCompleted(int result); diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index ba6de05..31bea3b 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -23,7 +23,6 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "net/base/cookie_monster.h" -#include "net/base/cookie_policy.h" #include "net/base/load_flags.h" #include "net/base/mock_host_resolver.h" #include "net/base/net_errors.h" diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index d0d3910..95060c6 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -11,7 +11,6 @@ #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" -#include "net/base/cookie_policy.h" #include "net/base/cookie_store.h" #include "net/base/io_buffer.h" #include "net/http/http_util.h" @@ -279,22 +278,14 @@ bool WebSocketJob::SendHandshakeRequest(const char* data, int len) { } void WebSocketJob::AddCookieHeaderAndSend() { - int policy = OK; - if (socket_->context()->cookie_policy()) { - GURL url_for_cookies = GetURLForCookies(); - policy = socket_->context()->cookie_policy()->CanGetCookies( - url_for_cookies, - url_for_cookies); - } - DCHECK_NE(ERR_IO_PENDING, policy); - OnCanGetCookiesCompleted(policy); -} + bool allow = true; + if (delegate_ && !delegate_->CanGetCookies(socket_, GetURLForCookies())) + allow = false; -void WebSocketJob::OnCanGetCookiesCompleted(int policy) { if (socket_ && delegate_ && state_ == CONNECTING) { handshake_request_->RemoveHeaders( kCookieHeaders, arraysize(kCookieHeaders)); - if (policy == OK) { + if (allow) { // Add cookies, including HttpOnly cookies. if (socket_->context()->cookie_store()) { CookieOptions cookie_options; @@ -407,31 +398,18 @@ void WebSocketJob::SaveNextCookie() { return; } - int policy = OK; - if (socket_->context()->cookie_policy()) { - GURL url_for_cookies = GetURLForCookies(); - policy = socket_->context()->cookie_policy()->CanSetCookie( - url_for_cookies, - url_for_cookies, - response_cookies_[response_cookies_save_index_]); - } - - DCHECK_NE(ERR_IO_PENDING, policy); - OnCanSetCookieCompleted(policy); -} + bool allow = true; + CookieOptions options; + GURL url = GetURLForCookies(); + std::string cookie = response_cookies_[response_cookies_save_index_]; + if (delegate_ && !delegate_->CanSetCookie(socket_, url, cookie, &options)) + allow = false; -void WebSocketJob::OnCanSetCookieCompleted(int policy) { if (socket_ && delegate_ && state_ == CONNECTING) { - if ((policy == OK || policy == OK_FOR_SESSION_ONLY) && - socket_->context()->cookie_store()) { - CookieOptions options; + if (allow && socket_->context()->cookie_store()) { options.set_include_httponly(); - if (policy == OK_FOR_SESSION_ONLY) - options.set_force_session(); - GURL url_for_cookies = GetURLForCookies(); socket_->context()->cookie_store()->SetCookieWithOptions( - url_for_cookies, response_cookies_[response_cookies_save_index_], - options); + url, cookie, options); } response_cookies_save_index_++; SaveNextCookie(); diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h index 1de1c1d..ae527ce 100644 --- a/net/websockets/websocket_job.h +++ b/net/websockets/websocket_job.h @@ -75,14 +75,12 @@ class WebSocketJob : public SocketStreamJob, public SocketStream::Delegate { bool SendHandshakeRequest(const char* data, int len); void AddCookieHeaderAndSend(); - void OnCanGetCookiesCompleted(int policy); void OnSentHandshakeRequest(SocketStream* socket, int amount_sent); void OnReceivedHandshakeResponse( SocketStream* socket, const char* data, int len); void SaveCookiesAndNotifyHeaderComplete(); void SaveNextCookie(); - void OnCanSetCookieCompleted(int policy); GURL GetURLForCookies() const; diff --git a/net/websockets/websocket_job_unittest.cc b/net/websockets/websocket_job_unittest.cc index 0a77bc3..e8f629a 100644 --- a/net/websockets/websocket_job_unittest.cc +++ b/net/websockets/websocket_job_unittest.cc @@ -9,7 +9,6 @@ #include "base/string_split.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" -#include "net/base/cookie_policy.h" #include "net/base/cookie_store.h" #include "net/base/net_errors.h" #include "net/base/sys_addrinfo.h" @@ -54,7 +53,10 @@ class MockSocketStream : public SocketStream { class MockSocketStreamDelegate : public SocketStream::Delegate { public: MockSocketStreamDelegate() - : amount_sent_(0) {} + : amount_sent_(0), allow_all_cookies_(true) {} + void set_allow_all_cookies(bool allow_all_cookies) { + allow_all_cookies_ = allow_all_cookies; + } virtual ~MockSocketStreamDelegate() {} virtual void OnConnected(SocketStream* socket, int max_pending_send_allowed) { @@ -68,12 +70,22 @@ class MockSocketStreamDelegate : public SocketStream::Delegate { } virtual void OnClose(SocketStream* socket) { } + virtual bool CanGetCookies(SocketStream* socket, const GURL& url) { + return allow_all_cookies_; + } + virtual bool CanSetCookie(SocketStream* request, + const GURL& url, + const std::string& cookie_line, + CookieOptions* options) { + return allow_all_cookies_; + } size_t amount_sent() const { return amount_sent_; } const std::string& received_data() const { return received_data_; } private: int amount_sent_; + bool allow_all_cookies_; std::string received_data_; }; @@ -123,40 +135,10 @@ class MockCookieStore : public CookieStore { std::vector<Entry> entries_; }; -class MockCookiePolicy : public CookiePolicy { - public: - MockCookiePolicy() : allow_all_cookies_(true) {} - virtual ~MockCookiePolicy() {} - - void set_allow_all_cookies(bool allow_all_cookies) { - allow_all_cookies_ = allow_all_cookies; - } - - virtual int CanGetCookies(const GURL& url, - const GURL& first_party_for_cookies) const { - if (allow_all_cookies_) - return OK; - return ERR_ACCESS_DENIED; - } - - virtual int CanSetCookie(const GURL& url, - const GURL& first_party_for_cookies, - const std::string& cookie_line) const { - if (allow_all_cookies_) - return OK; - return ERR_ACCESS_DENIED; - } - - private: - bool allow_all_cookies_; -}; - class MockURLRequestContext : public URLRequestContext { public: - MockURLRequestContext(CookieStore* cookie_store, - CookiePolicy* cookie_policy) { + explicit MockURLRequestContext(CookieStore* cookie_store) { set_cookie_store(cookie_store); - set_cookie_policy(cookie_policy); transport_security_state_ = new TransportSecurityState(std::string()); set_transport_security_state(transport_security_state_.get()); TransportSecurityState::DomainState state; @@ -175,13 +157,10 @@ class WebSocketJobTest : public PlatformTest { public: virtual void SetUp() { cookie_store_ = new MockCookieStore; - cookie_policy_.reset(new MockCookiePolicy); - context_ = new MockURLRequestContext( - cookie_store_.get(), cookie_policy_.get()); + context_ = new MockURLRequestContext(cookie_store_.get()); } virtual void TearDown() { cookie_store_ = NULL; - cookie_policy_.reset(); context_ = NULL; websocket_ = NULL; socket_ = NULL; @@ -222,7 +201,6 @@ class WebSocketJobTest : public PlatformTest { } scoped_refptr<MockCookieStore> cookie_store_; - scoped_ptr<MockCookiePolicy> cookie_policy_; scoped_refptr<MockURLRequestContext> context_; scoped_refptr<WebSocketJob> websocket_; scoped_refptr<MockSocketStream> socket_; @@ -429,9 +407,9 @@ TEST_F(WebSocketJobTest, HandshakeWithCookieButNotAllowed) { cookie_options.set_include_httponly(); cookie_store_->SetCookieWithOptions( cookieUrl, "CR-test-httponly=1", cookie_options); - cookie_policy_->set_allow_all_cookies(false); MockSocketStreamDelegate delegate; + delegate.set_allow_all_cookies(false); InitWebSocketJob(url, &delegate); static const char* kHandshakeRequestMessage = diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 1a1cc71..5f4cd4d 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -488,7 +488,7 @@ class RequestProxy : public net::URLRequest::Delegate, StaticCookiePolicy::ALLOW_ALL_COOKIES : StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; - net::StaticCookiePolicy policy(policy_type); + StaticCookiePolicy policy(policy_type); int rv = policy.CanGetCookies( request->url(), request->first_party_for_cookies()); return rv == net::OK; @@ -501,7 +501,7 @@ class RequestProxy : public net::URLRequest::Delegate, StaticCookiePolicy::ALLOW_ALL_COOKIES : StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; - net::StaticCookiePolicy policy(policy_type); + StaticCookiePolicy policy(policy_type); int rv = policy.CanSetCookie( request->url(), request->first_party_for_cookies(), cookie_line); return rv == net::OK; diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc index 932d8c6..fa072dc 100644 --- a/webkit/tools/test_shell/test_shell_request_context.cc +++ b/webkit/tools/test_shell/test_shell_request_context.cc @@ -12,7 +12,6 @@ #include "net/base/cookie_monster.h" #include "net/base/host_resolver.h" #include "net/base/ssl_config_service.h" -#include "net/base/static_cookie_policy.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_auth_handler_factory.h" #include "net/proxy/proxy_config_service.h" @@ -44,7 +43,6 @@ void TestShellRequestContext::Init( net::HttpCache::Mode cache_mode, bool no_proxy) { storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); - storage_.set_cookie_policy(new net::StaticCookiePolicy()); // hard-code A-L and A-C for test shells set_accept_language("en-us,en"); |