summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-27 13:43:42 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-27 13:43:42 +0000
commitc144060968bce7873e4079bd2293272fe03b520f (patch)
tree6d1f7cc551e53d2626ff522ec46adb18da6c991c /chrome/browser/notifications
parent78d4939cf2732a79ff823a0b00938e6aef77cf97 (diff)
downloadchromium_src-c144060968bce7873e4079bd2293272fe03b520f.zip
chromium_src-c144060968bce7873e4079bd2293272fe03b520f.tar.gz
chromium_src-c144060968bce7873e4079bd2293272fe03b520f.tar.bz2
Delegating the "are images allowed" decision to renderer.
This enables making the decision based on both image url and the page url. E.g., blocking third-party images. BUG=81179 TEST=RenderViewTest.ImagesBlockedByDefault, RenderViewTest.ImagesAllowedByDefault Review URL: http://codereview.chromium.org/7831075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc3
-rw-r--r--chrome/browser/notifications/desktop_notification_service.h4
-rw-r--r--chrome/browser/notifications/desktop_notification_service_unittest.cc23
3 files changed, 14 insertions, 16 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index ca4857d..4a43f94 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_pattern.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -292,7 +293,7 @@ void DesktopNotificationService::ResetToDefaultContentSetting() {
}
void DesktopNotificationService::GetNotificationsSettings(
- HostContentSettingsMap::SettingsForOneType* settings) {
+ ContentSettingsForOneType* settings) {
profile_->GetHostContentSettingsMap()->GetSettingsForOneType(
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
NO_RESOURCE_IDENTIFIER,
diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h
index 8ab6b4c..eed1167 100644
--- a/chrome/browser/notifications/desktop_notification_service.h
+++ b/chrome/browser/notifications/desktop_notification_service.h
@@ -14,7 +14,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/common/content_settings.h"
#include "content/public/browser/notification_observer.h"
@@ -107,8 +106,7 @@ class DesktopNotificationService : public content::NotificationObserver,
// Returns all notifications settings. |settings| is cleared before
// notifications setting are passed to it.
- void GetNotificationsSettings(
- HostContentSettingsMap::SettingsForOneType* settings);
+ void GetNotificationsSettings(ContentSettingsForOneType* settings);
// Clears the notifications setting for the given pattern.
void ClearSetting(const ContentSettingsPattern& pattern);
diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc
index c60e627..008589f 100644
--- a/chrome/browser/notifications/desktop_notification_service_unittest.cc
+++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc
@@ -8,7 +8,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/synchronization/waitable_event.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
@@ -162,33 +161,33 @@ TEST_F(DesktopNotificationServiceTest, GetNotificationsSettings) {
service_->DenyPermission(GURL("http://denied2.com"));
service_->DenyPermission(GURL("http://denied.com"));
- HostContentSettingsMap::SettingsForOneType settings;
+ ContentSettingsForOneType settings;
service_->GetNotificationsSettings(&settings);
// |settings| contains the default setting and 4 exceptions.
ASSERT_EQ(5u, settings.size());
EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
GURL("http://allowed.com")),
- settings[0].a);
+ settings[0].primary_pattern);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- settings[0].c);
+ settings[0].setting);
EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
GURL("http://allowed2.com")),
- settings[1].a);
+ settings[1].primary_pattern);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- settings[1].c);
+ settings[1].setting);
EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
GURL("http://denied.com")),
- settings[2].a);
+ settings[2].primary_pattern);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- settings[2].c);
+ settings[2].setting);
EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(
GURL("http://denied2.com")),
- settings[3].a);
+ settings[3].primary_pattern);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- settings[3].c);
+ settings[3].setting);
EXPECT_EQ(ContentSettingsPattern::Wildcard(),
- settings[4].a);
+ settings[4].primary_pattern);
EXPECT_EQ(CONTENT_SETTING_ASK,
- settings[4].c);
+ settings[4].setting);
}