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 6459b29413eb660d927b6d4820444bf96c0d1872..b320bb2eb815ec6925537be8a790c329c1be085d 100644 |
--- a/chrome/browser/notifications/message_center_settings_controller.cc |
+++ b/chrome/browser/notifications/message_center_settings_controller.cc |
@@ -247,7 +247,6 @@ void MessageCenterSettingsController::GetNotifierList( |
FaviconServiceFactory::GetForProfile(profile, |
ServiceAccessType::EXPLICIT_ACCESS); |
favicon_tracker_.reset(new base::CancelableTaskTracker()); |
- patterns_.clear(); |
for (ContentSettingsForOneType::const_iterator iter = settings.begin(); |
iter != settings.end(); ++iter) { |
if (iter->primary_pattern == ContentSettingsPattern::Wildcard() && |
@@ -264,7 +263,6 @@ void MessageCenterSettingsController::GetNotifierList( |
notifier_id, |
name, |
notifier_state_tracker->IsNotifierEnabled(notifier_id))); |
- patterns_[name] = iter->primary_pattern; |
// Note that favicon service obtains the favicon from history. This means |
// that it will fail to obtain the image if there are no history data for |
// that URL. |
@@ -324,8 +322,11 @@ void MessageCenterSettingsController::SetNotifierEnabled( |
(default_setting != CONTENT_SETTING_ALLOW && enabled) || |
(default_setting == CONTENT_SETTING_ALLOW && !enabled); |
+ if (!notifier.notifier_id.url.is_valid()) { |
+ LOG(ERROR) << "Invalid url pattern: " << notifier.notifier_id.url.spec(); |
+ } |
+ |
if (differs_from_default_value) { |
- if (notifier.notifier_id.url.is_valid()) { |
if (enabled) { |
DesktopNotificationProfileUtil::GrantPermission( |
profile, notifier.notifier_id.url); |
@@ -333,26 +334,9 @@ void MessageCenterSettingsController::SetNotifierEnabled( |
DesktopNotificationProfileUtil::DenyPermission( |
profile, notifier.notifier_id.url); |
} |
- } else { |
- LOG(ERROR) << "Invalid url pattern: " |
- << notifier.notifier_id.url.spec(); |
- } |
} else { |
- ContentSettingsPattern pattern; |
- |
- const auto& iter = patterns_.find(notifier.name); |
- if (iter != patterns_.end()) { |
- pattern = iter->second; |
- } else if (notifier.notifier_id.url.is_valid()) { |
- pattern = |
- ContentSettingsPattern::FromURLNoWildcard(notifier.notifier_id.url); |
- } else { |
- LOG(ERROR) << "Invalid url pattern: " |
- << notifier.notifier_id.url.spec(); |
- } |
- |
- if (pattern.IsValid()) |
- DesktopNotificationProfileUtil::ClearSetting(profile, pattern); |
raymes
2016/03/09 06:53:48
Hey Liu, I don't fully understand this code but it
|
+ DesktopNotificationProfileUtil::ClearSetting(profile, |
+ notifier.notifier_id.url); |
} |
} else { |
NotifierStateTrackerFactory::GetForProfile(profile) |
@@ -366,7 +350,6 @@ void MessageCenterSettingsController::SetNotifierEnabled( |
void MessageCenterSettingsController::OnNotifierSettingsClosing() { |
DCHECK(favicon_tracker_.get()); |
favicon_tracker_->TryCancelAll(); |
- patterns_.clear(); |
} |
bool MessageCenterSettingsController::NotifierHasAdvancedSettings( |