Index: ui/message_center/message_view.cc |
diff --git a/ui/message_center/message_view.cc b/ui/message_center/message_view.cc |
index 27535b74c1d54e27c9cdf0e5283cc3e019407858..203cc5089ffd4a898c5963983b6f8c19fe351698 100644 |
--- a/ui/message_center/message_view.cc |
+++ b/ui/message_center/message_view.cc |
@@ -144,20 +144,20 @@ class WebNotificationMenuModel : public ui::SimpleMenuModel, |
public ui::SimpleMenuModel::Delegate { |
public: |
WebNotificationMenuModel(NotificationList::Delegate* list_delegate, |
- const Notification& notification) |
+ Notification* notification) |
: ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
list_delegate_(list_delegate), |
notification_(notification) { |
// Add 'disable notifications' menu item. |
- if (!notification.extension_id.empty()) { |
+ if (!notification->extension_id().empty()) { |
AddItem(kToggleExtensionCommand, |
GetLabelForCommandId(kToggleExtensionCommand)); |
- } else if (!notification.display_source.empty()) { |
+ } else if (!notification->display_source().empty()) { |
AddItem(kTogglePermissionCommand, |
GetLabelForCommandId(kTogglePermissionCommand)); |
} |
// Add settings menu item. |
- if (!notification.display_source.empty()) { |
+ if (!notification->display_source().empty()) { |
AddItem(kShowSettingsCommand, |
GetLabelForCommandId(kShowSettingsCommand)); |
} |
@@ -173,7 +173,7 @@ class WebNotificationMenuModel : public ui::SimpleMenuModel, |
return l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_EXTENSIONS_DISABLE); |
case kTogglePermissionCommand: |
return l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_SITE_DISABLE, |
- notification_.display_source); |
+ notification_->display_source()); |
case kShowSettingsCommand: |
return l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS); |
default: |
@@ -200,13 +200,13 @@ class WebNotificationMenuModel : public ui::SimpleMenuModel, |
virtual void ExecuteCommand(int command_id) OVERRIDE { |
switch (command_id) { |
case kToggleExtensionCommand: |
- list_delegate_->DisableNotificationByExtension(notification_.id); |
+ list_delegate_->DisableNotificationByExtension(notification_->id()); |
break; |
case kTogglePermissionCommand: |
- list_delegate_->DisableNotificationByUrl(notification_.id); |
+ list_delegate_->DisableNotificationByUrl(notification_->id()); |
break; |
case kShowSettingsCommand: |
- list_delegate_->ShowNotificationSettings(notification_.id); |
+ list_delegate_->ShowNotificationSettings(notification_->id()); |
break; |
default: |
NOTREACHED(); |
@@ -214,15 +214,15 @@ class WebNotificationMenuModel : public ui::SimpleMenuModel, |
} |
private: |
- NotificationList::Delegate* list_delegate_; |
- Notification notification_; |
+ NotificationList::Delegate* list_delegate_; // Weak, global MessageCenter |
+ Notification* notification_; // Weak, owned by NotificationList |
DISALLOW_COPY_AND_ASSIGN(WebNotificationMenuModel); |
}; |
MessageView::MessageView( |
NotificationList::Delegate* list_delegate, |
- const Notification& notification) |
+ Notification* notification) |
: list_delegate_(list_delegate), |
notification_(notification), |
scroller_(NULL) { |
@@ -245,13 +245,13 @@ bool MessageView::OnMousePressed(const ui::MouseEvent& event) { |
ShowMenu(event.location()); |
return true; |
} |
- list_delegate_->OnNotificationClicked(notification_.id); |
+ list_delegate_->OnNotificationClicked(notification_->id()); |
return true; |
} |
void MessageView::OnGestureEvent(ui::GestureEvent* event) { |
if (event->type() == ui::ET_GESTURE_TAP) { |
- list_delegate_->OnNotificationClicked(notification_.id); |
+ list_delegate_->OnNotificationClicked(notification_->id()); |
event->SetHandled(); |
return; |
} |
@@ -278,7 +278,7 @@ void MessageView::OnGestureEvent(ui::GestureEvent* event) { |
void MessageView::ButtonPressed(views::Button* sender, |
const ui::Event& event) { |
if (sender == close_button()) |
- list_delegate_->SendRemoveNotification(notification_.id); |
+ list_delegate_->SendRemoveNotification(notification_->id()); |
} |
void MessageView::ShowMenu(gfx::Point screen_location) { |
@@ -299,7 +299,7 @@ void MessageView::ShowMenu(gfx::Point screen_location) { |
} |
void MessageView::OnSlideOut() { |
- list_delegate_->SendRemoveNotification(notification_.id); |
+ list_delegate_->SendRemoveNotification(notification_->id()); |
} |
} // namespace message_center |