summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_content_browser_client.cc5
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings.cc13
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings.h4
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings_unittest.cc41
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc6
-rw-r--r--chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc7
6 files changed, 55 insertions, 21 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 0068ed8..2358763 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -891,7 +891,7 @@ bool ChromeContentBrowserClient::AllowGetCookie(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&TabSpecificContentSettings::CookiesRead, render_process_id,
- render_view_id, url, cookie_list, !allow));
+ render_view_id, url, first_party, cookie_list, !allow));
return allow;
}
@@ -914,7 +914,8 @@ bool ChromeContentBrowserClient::AllowSetCookie(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&TabSpecificContentSettings::CookieChanged, render_process_id,
- render_view_id, url, cookie_line, *options, !allow));
+ render_view_id, url, first_party, cookie_line, *options,
+ !allow));
return allow;
}
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index 80d9cfa..0badb8b 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -88,11 +88,14 @@ TabSpecificContentSettings* TabSpecificContentSettings::Get(
void TabSpecificContentSettings::CookiesRead(int render_process_id,
int render_view_id,
const GURL& url,
+ const GURL& first_party_url,
const net::CookieList& cookie_list,
bool blocked_by_policy) {
TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
- if (settings)
- settings->OnCookiesRead(url, cookie_list, blocked_by_policy);
+ if (settings) {
+ settings->OnCookiesRead(url, first_party_url, cookie_list,
+ blocked_by_policy);
+ }
}
// static
@@ -100,12 +103,14 @@ void TabSpecificContentSettings::CookieChanged(
int render_process_id,
int render_view_id,
const GURL& url,
+ const GURL& first_party_url,
const std::string& cookie_line,
const net::CookieOptions& options,
bool blocked_by_policy) {
TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
if (settings)
- settings->OnCookieChanged(url, cookie_line, options, blocked_by_policy);
+ settings->OnCookieChanged(url, first_party_url, cookie_line, options,
+ blocked_by_policy);
}
// static
@@ -250,6 +255,7 @@ void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) {
void TabSpecificContentSettings::OnCookiesRead(
const GURL& url,
+ const GURL& first_party_url,
const net::CookieList& cookie_list,
bool blocked_by_policy) {
if (cookie_list.empty())
@@ -267,6 +273,7 @@ void TabSpecificContentSettings::OnCookiesRead(
void TabSpecificContentSettings::OnCookieChanged(
const GURL& url,
+ const GURL& first_party_url,
const std::string& cookie_line,
const net::CookieOptions& options,
bool blocked_by_policy) {
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h
index 6a0fde0..5c2279f 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.h
+++ b/chrome/browser/content_settings/tab_specific_content_settings.h
@@ -51,6 +51,7 @@ class TabSpecificContentSettings : public content::WebContentsObserver,
static void CookiesRead(int render_process_id,
int render_view_id,
const GURL& url,
+ const GURL& first_party_url,
const net::CookieList& cookie_list,
bool blocked_by_policy);
@@ -61,6 +62,7 @@ class TabSpecificContentSettings : public content::WebContentsObserver,
static void CookieChanged(int render_process_id,
int render_view_id,
const GURL& url,
+ const GURL& first_party_url,
const std::string& cookie_line,
const net::CookieOptions& options,
bool blocked_by_policy);
@@ -182,9 +184,11 @@ class TabSpecificContentSettings : public content::WebContentsObserver,
// These methods are invoked on the UI thread by the static functions above.
// Public for testing.
void OnCookiesRead(const GURL& url,
+ const GURL& first_party_url,
const net::CookieList& cookie_list,
bool blocked_by_policy);
void OnCookieChanged(const GURL& url,
+ const GURL& first_party_url,
const std::string& cookie_line,
const net::CookieOptions& options,
bool blocked_by_policy);
diff --git a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
index 3c693c5..5e46aea 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
@@ -37,8 +37,11 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
EXPECT_FALSE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
// Set a cookie, block access to images, block a popup.
- content_settings.OnCookieChanged(
- GURL("http://google.com"), "A=B", options, false);
+ content_settings.OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "A=B",
+ options,
+ false);
content_settings.OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES,
std::string());
content_settings.SetPopupsBlocked(true);
@@ -52,12 +55,18 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
EXPECT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_TRUE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
- content_settings.OnCookieChanged(
- GURL("http://google.com"), "A=B", options, false);
+ content_settings.OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "A=B",
+ options,
+ false);
// Block a cookie.
- content_settings.OnCookieChanged(
- GURL("http://google.com"), "C=D", options, true);
+ content_settings.OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "C=D",
+ options,
+ true);
EXPECT_TRUE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
@@ -107,14 +116,20 @@ TEST_F(TabSpecificContentSettingsTest, AllowedContent) {
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
- content_settings.OnCookieChanged(
- GURL("http://google.com"), "A=B", options, false);
+ content_settings.OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "A=B",
+ options,
+ false);
ASSERT_TRUE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
- content_settings.OnCookieChanged(
- GURL("http://google.com"), "C=D", options, true);
+ content_settings.OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "C=D",
+ options,
+ true);
ASSERT_TRUE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_TRUE(
@@ -128,8 +143,10 @@ TEST_F(TabSpecificContentSettingsTest, EmptyCookieList) {
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
- content_settings.OnCookiesRead(
- GURL("http://google.com"), net::CookieList(), true);
+ content_settings.OnCookiesRead(GURL("http://google.com"),
+ GURL("http://google.com"),
+ net::CookieList(),
+ true);
ASSERT_FALSE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 6cb3a45..60f39a1 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -371,7 +371,8 @@ bool ChromeNetworkDelegate::CanGetCookies(
BrowserThread::UI, FROM_HERE,
base::Bind(&TabSpecificContentSettings::CookiesRead,
render_process_id, render_view_id,
- request->url(), cookie_list, !allow));
+ request->url(), request->first_party_for_cookies(),
+ cookie_list, !allow));
}
return allow;
@@ -399,7 +400,8 @@ bool ChromeNetworkDelegate::CanSetCookie(
BrowserThread::UI, FROM_HERE,
base::Bind(&TabSpecificContentSettings::CookieChanged,
render_process_id, render_view_id,
- request->url(), cookie_line, *options, !allow));
+ request->url(), request->first_party_for_cookies(),
+ cookie_line, *options, !allow));
}
return allow;
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
index 7158c04..0b88c0f 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -60,8 +60,11 @@ TEST_F(ContentSettingImageModelTest, CookieAccessed) {
EXPECT_TRUE(content_setting_image_model->get_tooltip().empty());
net::CookieOptions options;
- content_settings->OnCookieChanged(
- GURL("http://google.com"), "A=B", options, false);
+ content_settings->OnCookieChanged(GURL("http://google.com"),
+ GURL("http://google.com"),
+ "A=B",
+ options,
+ false);
content_setting_image_model->UpdateFromWebContents(contents());
EXPECT_TRUE(content_setting_image_model->is_visible());
EXPECT_NE(0, content_setting_image_model->get_icon());