diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-02 17:12:10 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-02 17:12:10 +0000 |
commit | d7e1411c5b38df6ed9f97a6abe7698706d518881 (patch) | |
tree | cb0b33aa81fa74d9171296a53088384c971d4baf /chrome/browser/content_settings | |
parent | 5351db9c07d0b6961ff7e60db9df2c9a3bfa4d03 (diff) | |
download | chromium_src-d7e1411c5b38df6ed9f97a6abe7698706d518881.zip chromium_src-d7e1411c5b38df6ed9f97a6abe7698706d518881.tar.gz chromium_src-d7e1411c5b38df6ed9f97a6abe7698706d518881.tar.bz2 |
Fixed the problem that cookie blocking notification bubble is not displayed in the omnibox.
We can have multiple cookies of different blocked statuses, that means OnContentAllowed() can still be called while the cookies content setting is set to block.
And we need to show the blocking cookie icon if any of the cookie is blocked.
Also, except for media, other content setting types need reloading the page to have the new setting kick in.
BUG=224557
TEST=unit_tests --gtest_filter="*TabSpecificContentSettingsTest*"
manual test:
1.Launch chrome and go to settings > content settings
2.Under cookies select the option "Block third party cookies and site data"
3.Login to facebook.com and Go to www.latimes.com.
4.Observe the cookie blocking notification bubble in the omnibox.
Review URL: https://chromiumcodereview.appspot.com/13375004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_settings')
-rw-r--r-- | chrome/browser/content_settings/tab_specific_content_settings.cc | 18 | ||||
-rw-r--r-- | chrome/browser/content_settings/tab_specific_content_settings_unittest.cc | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index 74a7ea9..a9ac352 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -264,7 +264,13 @@ void TabSpecificContentSettings::OnContentBlocked( if (type < 0 || type >= CONTENT_SETTINGS_NUM_TYPES) return; - content_allowed_[type] = false; + // Media is different from other content setting types since it allows new + // setting to kick in without reloading the page, and the UI for media is + // always reflecting the newest permission setting. + if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) + content_allowed_[type] = false; + else + content_allowed_[type] = true; // Unless UI for resource content settings is enabled, ignore the resource // identifier. @@ -303,9 +309,13 @@ void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) << "Geolocation settings handled by OnGeolocationPermissionSet"; bool access_changed = false; - if (content_blocked_[type]) { - content_blocked_[type] = false; - access_changed = true; + if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) { + // The setting for media is overwritten here because media does not need to + // reload the page to have the new setting kick in. See issue/175993. + if (content_blocked_[type]) { + content_blocked_[type] = false; + access_changed = true; + } } if (!content_allowed_[type]) { 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 664faac..9dd833a 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc @@ -187,7 +187,7 @@ TEST_F(TabSpecificContentSettingsTest, AllowedContent) { "C=D", options, true); - ASSERT_FALSE( + ASSERT_TRUE( content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES)); ASSERT_TRUE( content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |