}
bool MessageCenterImpl::HasClickedListener(const std::string& id) {
- NotificationDelegate* delegate =
+ scoped_refptr<NotificationDelegate> delegate =
notification_list_->GetNotificationDelegate(id);
- return delegate && delegate->HasClickedListener();
+ return delegate.get() && delegate->HasClickedListener();
}
const NotificationList::Notifications&
if (!HasNotification(id))
return;
- NotificationDelegate* delegate =
+ scoped_refptr<NotificationDelegate> delegate =
notification_list_->GetNotificationDelegate(id);
- if (delegate)
+ if (delegate.get())
delegate->Close(by_user);
// In many cases |id| is a reference to an existing notification instance
for (NotificationList::Notifications::const_iterator iter =
notifications.begin(); iter != notifications.end(); ++iter) {
ids.insert((*iter)->id());
- NotificationDelegate* delegate = (*iter)->delegate();
- if (delegate)
+ scoped_refptr<NotificationDelegate> delegate = (*iter)->delegate();
+ if (delegate.get())
delegate->Close(by_user);
notification_list_->RemoveNotification((*iter)->id());
}
}
}
-void MessageCenterImpl::ExpandNotification(const std::string& id) {
- if (!HasNotification(id))
- return;
- notification_list_->MarkNotificationAsExpanded(id);
- FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
- OnNotificationUpdated(id));
-}
-
void MessageCenterImpl::ClickOnNotification(const std::string& id) {
if (!HasNotification(id))
return;
if (HasPopupNotifications())
MarkSinglePopupAsShown(id, true);
- NotificationDelegate* delegate =
+ scoped_refptr<NotificationDelegate> delegate =
notification_list_->GetNotificationDelegate(id);
- if (delegate)
+ if (delegate.get())
delegate->Click();
FOR_EACH_OBSERVER(
MessageCenterObserver, observer_list_, OnNotificationClicked(id));
return;
if (HasPopupNotifications())
MarkSinglePopupAsShown(id, true);
- NotificationDelegate* delegate =
+ scoped_refptr<NotificationDelegate> delegate =
notification_list_->GetNotificationDelegate(id);
- if (delegate)
+ if (delegate.get())
delegate->ButtonClick(button_index);
FOR_EACH_OBSERVER(
MessageCenterObserver, observer_list_, OnNotificationButtonClicked(
if (HasPopupNotifications())
notification_list_->MarkSinglePopupAsDisplayed(id);
notification_cache_.RecountUnread();
- NotificationDelegate* delegate =
+ scoped_refptr<NotificationDelegate> delegate =
notification_list_->GetNotificationDelegate(id);
- if (delegate)
+ if (delegate.get())
delegate->Display();
FOR_EACH_OBSERVER(
MessageCenterObserver, observer_list_, OnNotificationDisplayed(id));