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

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 11684003: Make MessageCenter a singleton object and build on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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: ash/system/web_notification/web_notification_tray.cc
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index 5e7822fbb8d3c063863e94884f5916ff799a8a78..4c8d839ebb3d907b4f92c2c1123b6993ef47fd4a 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -83,7 +83,8 @@ WebNotificationTray::WebNotificationTray(
: internal::TrayBackgroundView(status_area_widget),
button_(NULL),
show_message_center_on_unlock_(false) {
- message_center_.reset(new message_center::MessageCenter(this));
+ message_center_ = message_center::MessageCenter::GetInstance();
+ message_center_->SetHost(this);
button_ = new views::ImageButton(this);
button_->set_triggerable_event_flags(
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON);
@@ -93,7 +94,7 @@ WebNotificationTray::WebNotificationTray(
WebNotificationTray::~WebNotificationTray() {
// message_center_ has a weak pointer to this; destroy it early.
- message_center_.reset();
+ message_center_->SetHost(NULL);
// Release any child views that might have back pointers before ~View().
message_center_bubble_.reset();
popup_bubble_.reset();
@@ -116,7 +117,7 @@ void WebNotificationTray::ShowMessageCenterBubble() {
UpdateTray();
HidePopupBubble();
message_center::MessageCenterBubble* bubble =
- new message_center::MessageCenterBubble(message_center_.get());
+ new message_center::MessageCenterBubble(message_center_);
message_center_bubble_.reset(
new internal::WebNotificationBubbleWrapper(this, bubble));
@@ -156,7 +157,7 @@ void WebNotificationTray::ShowPopupBubble() {
popup_bubble_.reset(
new internal::WebNotificationBubbleWrapper(
this, new message_center::MessagePopupBubble(
- message_center_.get())));
+ message_center_)));
}
}

Powered by Google App Engine
This is Rietveld 408576698