Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5252)

Unified Diff: chrome/browser/notifications/message_center_settings_controller.cc

Issue 12879016: Keep the obtained url patterns for notification settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/notifications/message_center_settings_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 05cd5d55db6d755a13112d911d091e51d71c8959..2d126d511428c943422fdcfd59ca8f55d5e7c5f5 100644
--- a/chrome/browser/notifications/message_center_settings_controller.cc
+++ b/chrome/browser/notifications/message_center_settings_controller.cc
@@ -61,6 +61,7 @@ void MessageCenterSettingsController::GetNotifierList(
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS);
favicon_tracker_.reset(new CancelableTaskTracker());
+ patterns_.clear();
for (ContentSettingsForOneType::const_iterator iter = settings.begin();
iter != settings.end(); ++iter) {
if (iter->primary_pattern == ContentSettingsPattern::Wildcard() &&
@@ -70,11 +71,13 @@ void MessageCenterSettingsController::GetNotifierList(
}
std::string url_pattern = iter->primary_pattern.ToString();
+ string16 name = UTF8ToUTF16(url_pattern);
GURL url(url_pattern);
notifiers->push_back(new message_center::Notifier(
url,
- UTF8ToUTF16(url_pattern),
+ name,
notification_service->GetContentSetting(url) == CONTENT_SETTING_ALLOW));
+ patterns_[name] = iter->primary_pattern;
FaviconService::FaviconForURLParams favicon_params(
profile, url, history::FAVICON | history::TOUCH_ICON,
message_center::kSettingsIconSize);
@@ -118,12 +121,13 @@ void MessageCenterSettingsController::SetNotifierEnabled(
LOG(ERROR) << "Invalid url pattern: " << notifier.url.spec();
}
} else {
- ContentSettingsPattern pattern =
- ContentSettingsPattern::FromURL(notifier.url);
- if (pattern.IsValid())
- notification_service->ClearSetting(pattern);
- else
+ std::map<string16, ContentSettingsPattern>::const_iterator iter =
+ patterns_.find(notifier.name);
+ if (iter != patterns_.end()) {
+ notification_service->ClearSetting(iter->second);
+ } else {
LOG(ERROR) << "Invalid url pattern: " << notifier.url.spec();
+ }
}
break;
}
@@ -134,6 +138,7 @@ void MessageCenterSettingsController::OnNotifierSettingsClosing() {
delegate_ = NULL;
DCHECK(favicon_tracker_.get());
favicon_tracker_->TryCancelAll();
+ patterns_.clear();
}
void MessageCenterSettingsController::OnFaviconLoaded(
« no previous file with comments | « chrome/browser/notifications/message_center_settings_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698