Index: ui/message_center/message_center_impl.cc |
diff --git a/ui/message_center/message_center_impl.cc b/ui/message_center/message_center_impl.cc |
index fc93cf2b16d14a09b9d8d6d3cfa7ca5cb624d734..c8a01ab9e49c79ba74a70aad909ac83d5f0faabb 100644 |
--- a/ui/message_center/message_center_impl.cc |
+++ b/ui/message_center/message_center_impl.cc |
@@ -6,6 +6,7 @@ |
#include <algorithm> |
#include <deque> |
+#include <utility> |
#include "base/command_line.h" |
#include "base/memory/scoped_vector.h" |
@@ -138,7 +139,7 @@ ChangeQueue::Change::Change(ChangeType type, |
: type_(type), |
notification_list_id_(id), |
by_user_(false), |
- notification_(notification.Pass()) { |
+ notification_(std::move(notification)) { |
DCHECK(!id.empty()); |
DCHECK(type != CHANGE_TYPE_DELETE || notification_.get() == NULL); |
@@ -148,7 +149,7 @@ ChangeQueue::Change::Change(ChangeType type, |
ChangeQueue::Change::~Change() {} |
scoped_ptr<Notification> ChangeQueue::Change::PassNotification() { |
- return notification_.Pass(); |
+ return std::move(notification_); |
} |
void ChangeQueue::Change::ReplaceNotification( |
@@ -171,7 +172,7 @@ void ChangeQueue::ApplyChanges(MessageCenterImpl* message_center) { |
scoped_ptr<Change> change(*iter); |
// TODO(dewittj): Replace changes_ with a deque. |
changes_.weak_erase(iter); |
- ApplyChangeInternal(message_center, change.Pass()); |
+ ApplyChangeInternal(message_center, std::move(change)); |
} |
} |
@@ -204,8 +205,7 @@ void ChangeQueue::ApplyChangesForId(MessageCenterImpl* message_center, |
void ChangeQueue::AddNotification(scoped_ptr<Notification> notification) { |
std::string id = notification->id(); |
- changes_.push_back( |
- new Change(CHANGE_TYPE_ADD, id, notification.Pass())); |
+ changes_.push_back(new Change(CHANGE_TYPE_ADD, id, std::move(notification))); |
} |
void ChangeQueue::UpdateNotification(const std::string& old_id, |
@@ -214,7 +214,7 @@ void ChangeQueue::UpdateNotification(const std::string& old_id, |
std::find_if(changes_.rbegin(), changes_.rend(), ChangeFinder(old_id)); |
if (iter == changes_.rend()) { |
changes_.push_back( |
- new Change(CHANGE_TYPE_UPDATE, old_id, notification.Pass())); |
+ new Change(CHANGE_TYPE_UPDATE, old_id, std::move(notification))); |
return; |
} |
@@ -227,29 +227,29 @@ void ChangeQueue::UpdateNotification(const std::string& old_id, |
// (eg. Add A, Update B->C, and This update A->B). |
changes_.erase(--(iter.base())); |
changes_.push_back( |
- new Change(CHANGE_TYPE_ADD, id, notification.Pass())); |
+ new Change(CHANGE_TYPE_ADD, id, std::move(notification))); |
break; |
} |
case CHANGE_TYPE_UPDATE: |
if (notification->id() == old_id) { |
// Safe to place the change at the previous place. |
- change->ReplaceNotification(notification.Pass()); |
+ change->ReplaceNotification(std::move(notification)); |
} else if (change->id() == change->notification_list_id()) { |
std::string id = notification->id(); |
// Safe to place the change at the last. |
changes_.erase(--(iter.base())); |
- changes_.push_back(new Change( |
- CHANGE_TYPE_ADD, id, notification.Pass())); |
+ changes_.push_back( |
+ new Change(CHANGE_TYPE_ADD, id, std::move(notification))); |
} else { |
// Complex case: gives up to optimize. |
changes_.push_back( |
- new Change(CHANGE_TYPE_UPDATE, old_id, notification.Pass())); |
+ new Change(CHANGE_TYPE_UPDATE, old_id, std::move(notification))); |
} |
break; |
case CHANGE_TYPE_DELETE: |
// DELETE -> UPDATE. Something is wrong. Treats the UPDATE as ADD. |
changes_.push_back( |
- new Change(CHANGE_TYPE_ADD, old_id, notification.Pass())); |
+ new Change(CHANGE_TYPE_ADD, old_id, std::move(notification))); |
break; |
default: |
NOTREACHED(); |
@@ -262,7 +262,7 @@ void ChangeQueue::EraseNotification(const std::string& id, bool by_user) { |
if (iter == changes_.rend()) { |
scoped_ptr<Change> change(new Change(CHANGE_TYPE_DELETE, id, nullptr)); |
change->set_by_user(by_user); |
- changes_.push_back(change.Pass()); |
+ changes_.push_back(std::move(change)); |
return; |
} |
@@ -514,11 +514,11 @@ void MessageCenterImpl::AddNotification(scoped_ptr<Notification> notification) { |
if (notification_queue_ && |
notification_list_->is_message_center_visible()) { |
- notification_queue_->AddNotification(notification.Pass()); |
+ notification_queue_->AddNotification(std::move(notification)); |
return; |
} |
- AddNotificationImmediately(notification.Pass()); |
+ AddNotificationImmediately(std::move(notification)); |
} |
void MessageCenterImpl::AddNotificationImmediately( |
@@ -529,7 +529,7 @@ void MessageCenterImpl::AddNotificationImmediately( |
// |notification_list| will replace the notification instead of adding new. |
// This is essentially an update rather than addition. |
bool already_exists = (notification_list_->GetNotificationById(id) != NULL); |
- notification_list_->AddNotification(notification.Pass()); |
+ notification_list_->AddNotification(std::move(notification)); |
notification_cache_.Rebuild( |
notification_list_->GetVisibleNotifications(blockers_)); |
@@ -567,12 +567,13 @@ void MessageCenterImpl::UpdateNotification( |
NOTIFICATION_TYPE_PROGRESS); |
if (!update_keeps_progress_type) { |
// Updates are allowed only for progress notifications. |
- notification_queue_->UpdateNotification(old_id, new_notification.Pass()); |
+ notification_queue_->UpdateNotification(old_id, |
+ std::move(new_notification)); |
return; |
} |
} |
- UpdateNotificationImmediately(old_id, new_notification.Pass()); |
+ UpdateNotificationImmediately(old_id, std::move(new_notification)); |
} |
void MessageCenterImpl::UpdateNotificationImmediately( |
@@ -580,7 +581,7 @@ void MessageCenterImpl::UpdateNotificationImmediately( |
scoped_ptr<Notification> new_notification) { |
std::string new_id = new_notification->id(); |
notification_list_->UpdateNotificationMessage(old_id, |
- new_notification.Pass()); |
+ std::move(new_notification)); |
notification_cache_.Rebuild( |
notification_list_->GetVisibleNotifications(blockers_)); |
if (old_id == new_id) { |