| Index: chrome/browser/renderer_host/resource_message_filter.cc
|
| diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
|
| index 34520fe1e8c75c7aa4b544f8b495634803b63016..bde98fd7fc95ab27d72f249d955135c3a239446a 100644
|
| --- a/chrome/browser/renderer_host/resource_message_filter.cc
|
| +++ b/chrome/browser/renderer_host/resource_message_filter.cc
|
| @@ -26,6 +26,7 @@
|
| #include "chrome/browser/notifications/notifications_prefs_cache.h"
|
| #include "chrome/browser/plugin_service.h"
|
| #include "chrome/browser/privacy_blacklist/blacklist.h"
|
| +#include "chrome/browser/privacy_blacklist/blacklist_manager.h"
|
| #include "chrome/browser/privacy_blacklist/blacklist_ui.h"
|
| #include "chrome/browser/profile.h"
|
| #include "chrome/browser/renderer_host/audio_renderer_host.h"
|
| @@ -142,6 +143,16 @@ void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
|
| #endif
|
| }
|
|
|
| +Blacklist::Match* GetPrivacyBlacklistMatchForURL(
|
| + const GURL& url, ChromeURLRequestContext* context) {
|
| + BlacklistManager* blacklist_manager = context->GetBlacklistManager();
|
| + // TODO(phajdan.jr): DCHECK(blacklist_manager) when blacklists are stable.
|
| + if (!blacklist_manager)
|
| + return NULL;
|
| + const Blacklist* blacklist = blacklist_manager->GetCompiledBlacklist();
|
| + return blacklist->findMatch(url);
|
| +}
|
| +
|
| } // namespace
|
|
|
| ResourceMessageFilter::ResourceMessageFilter(
|
| @@ -465,22 +476,20 @@ void ResourceMessageFilter::OnSetCookie(const GURL& url,
|
| const std::string& cookie) {
|
| ChromeURLRequestContext* context = GetRequestContextForURL(url);
|
|
|
| - if (context->cookie_policy()->CanSetCookie(url, first_party_for_cookies)) {
|
| - const Blacklist* blacklist = context->GetBlacklist();
|
| - if (blacklist) {
|
| - scoped_ptr<Blacklist::Match> match(blacklist->findMatch(url));
|
| - if (match.get()) {
|
| - if (match->attributes() & Blacklist::kDontPersistCookies) {
|
| - context->cookie_store()->SetCookie(url,
|
| - Blacklist::StripCookieExpiry(cookie));
|
| - } else if (!(match->attributes() & Blacklist::kDontStoreCookies)) {
|
| - context->cookie_store()->SetCookie(url, cookie);
|
| - }
|
| - return;
|
| - }
|
| + if (!context->cookie_policy()->CanSetCookie(url, first_party_for_cookies))
|
| + return;
|
| + scoped_ptr<Blacklist::Match> match(
|
| + GetPrivacyBlacklistMatchForURL(url, context));
|
| + if (match.get()) {
|
| + if (match->attributes() & Blacklist::kDontPersistCookies) {
|
| + context->cookie_store()->SetCookie(url,
|
| + Blacklist::StripCookieExpiry(cookie));
|
| + } else if (!(match->attributes() & Blacklist::kDontStoreCookies)) {
|
| + context->cookie_store()->SetCookie(url, cookie);
|
| }
|
| - context->cookie_store()->SetCookie(url, cookie);
|
| + return;
|
| }
|
| + context->cookie_store()->SetCookie(url, cookie);
|
| }
|
|
|
| void ResourceMessageFilter::OnGetCookies(const GURL& url,
|
|
|