| Index: chrome/browser/notifications/message_center_settings_controller.cc
|
| diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc
|
| index 69e9ca9a6a39969b1e1c1b12b9e8f40656992793..00672f543f838d6ae1f57b4e2f4086ee353abe84 100644
|
| --- a/chrome/browser/notifications/message_center_settings_controller.cc
|
| +++ b/chrome/browser/notifications/message_center_settings_controller.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/task/cancelable_task_tracker.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| +#include "chrome/browser/content_settings/host_content_settings_map.h"
|
| #include "chrome/browser/extensions/app_icon_loader_impl.h"
|
| #include "chrome/browser/extensions/extension_util.h"
|
| #include "chrome/browser/favicon/favicon_service.h"
|
| @@ -324,17 +325,23 @@ void MessageCenterSettingsController::SetNotifierEnabled(
|
| // since it has the exact URL pattern.
|
| // TODO(mukai): fix this.
|
| ContentSetting default_setting =
|
| - notification_service->GetDefaultContentSetting(NULL);
|
| + profile->GetHostContentSettingsMap()->GetDefaultContentSetting(
|
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS, NULL);
|
| +
|
| DCHECK(default_setting == CONTENT_SETTING_ALLOW ||
|
| default_setting == CONTENT_SETTING_BLOCK ||
|
| default_setting == CONTENT_SETTING_ASK);
|
| if ((enabled && default_setting != CONTENT_SETTING_ALLOW) ||
|
| (!enabled && default_setting == CONTENT_SETTING_ALLOW)) {
|
| if (notifier.notifier_id.url.is_valid()) {
|
| - if (enabled)
|
| - notification_service->GrantPermission(notifier.notifier_id.url);
|
| - else
|
| - notification_service->DenyPermission(notifier.notifier_id.url);
|
| + ContentSettingsPattern primary_pattern =
|
| + ContentSettingsPattern::FromURLNoWildcard(notifier.notifier_id.url);
|
| + profile->GetHostContentSettingsMap()->SetContentSetting(
|
| + primary_pattern,
|
| + ContentSettingsPattern::Wildcard(),
|
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
|
| + NO_RESOURCE_IDENTIFIER,
|
| + enabled ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
|
| } else {
|
| LOG(ERROR) << "Invalid url pattern: "
|
| << notifier.notifier_id.url.spec();
|
| @@ -343,7 +350,12 @@ void MessageCenterSettingsController::SetNotifierEnabled(
|
| std::map<base::string16, ContentSettingsPattern>::const_iterator iter =
|
| patterns_.find(notifier.name);
|
| if (iter != patterns_.end()) {
|
| - notification_service->ClearSetting(iter->second);
|
| + profile->GetHostContentSettingsMap()->SetContentSetting(
|
| + iter->second,
|
| + ContentSettingsPattern::Wildcard(),
|
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
|
| + NO_RESOURCE_IDENTIFIER,
|
| + CONTENT_SETTING_DEFAULT);
|
| } else {
|
| LOG(ERROR) << "Invalid url pattern: "
|
| << notifier.notifier_id.url.spec();
|
|
|