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

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

Issue 2574583005: Remove stl_util's deletion function use from message center notifier settings. (Closed)
Patch Set: nits Created 4 years 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
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 48fd5296f88efc4d128fd1d3efdcd2e2f1e96093..ec12eae7b404f1d99c84a5a8ffcc92f180df6bf0 100644
--- a/chrome/browser/notifications/message_center_settings_controller.cc
+++ b/chrome/browser/notifications/message_center_settings_controller.cc
@@ -77,7 +77,8 @@ class NotifierComparator {
public:
explicit NotifierComparator(icu::Collator* collator) : collator_(collator) {}
- bool operator() (Notifier* n1, Notifier* n2) {
+ bool operator()(const std::unique_ptr<Notifier>& n1,
+ const std::unique_ptr<Notifier>& n2) {
if (n1->notifier_id.type != n2->notifier_id.type)
return n1->notifier_id.type < n2->notifier_id.type;
@@ -187,7 +188,7 @@ void MessageCenterSettingsController::SwitchToNotifierGroup(size_t index) {
}
void MessageCenterSettingsController::GetNotifierList(
- std::vector<Notifier*>* notifiers) {
+ std::vector<std::unique_ptr<Notifier>>* notifiers) {
DCHECK(notifiers);
if (notifier_groups_.size() <= current_notifier_group_)
return;
@@ -198,16 +199,15 @@ void MessageCenterSettingsController::GetNotifierList(
for (auto& source : sources_) {
auto source_notifiers = source.second->GetNotifierList(profile);
for (auto& notifier : source_notifiers) {
- notifiers->push_back(notifier.release());
+ notifiers->push_back(std::move(notifier));
}
}
UErrorCode error = U_ZERO_ERROR;
std::unique_ptr<icu::Collator> collator(icu::Collator::createInstance(error));
- std::unique_ptr<NotifierComparator> comparator(
- new NotifierComparator(U_SUCCESS(error) ? collator.get() : NULL));
+ NotifierComparator comparator(U_SUCCESS(error) ? collator.get() : NULL);
- std::sort(notifiers->begin(), notifiers->end(), *comparator);
+ std::sort(notifiers->begin(), notifiers->end(), comparator);
}
void MessageCenterSettingsController::SetNotifierEnabled(

Powered by Google App Engine
This is Rietveld 408576698