Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/notifications/message_center_notification_manager.h" | 5 #include "chrome/browser/notifications/message_center_notification_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/extensions/extension_set.h" | 13 #include "chrome/common/extensions/extension_set.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "ui/message_center/message_center_tray.h" | |
| 15 | 16 |
| 16 MessageCenterNotificationManager::MessageCenterNotificationManager( | 17 MessageCenterNotificationManager::MessageCenterNotificationManager( |
| 17 message_center::MessageCenter* message_center) | 18 message_center::MessageCenter* message_center) |
| 18 : message_center_(message_center) { | 19 : message_center_(message_center) { |
| 19 message_center_->SetDelegate(this); | 20 message_center_->SetDelegate(this); |
| 21 | |
| 22 // On Windows, the notification manager owns the tray icon and views. Other | |
| 23 // platforms have global ownership and Create will return NULL. | |
| 24 tray_.reset(ui::MessageCenterTrayDelegate::CreateForPlatform()); | |
|
stevenjb
2013/01/23 23:14:18
I think this should use #if USE_ASH... relying on
dewittj
2013/01/25 00:49:04
Since on ChromeOS the Shell has the scoped pointer
| |
| 20 } | 25 } |
| 21 | 26 |
| 22 MessageCenterNotificationManager::~MessageCenterNotificationManager() { | 27 MessageCenterNotificationManager::~MessageCenterNotificationManager() { |
| 23 } | 28 } |
| 24 | 29 |
| 25 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 26 // NotificationUIManager | 31 // NotificationUIManager |
| 27 | 32 |
| 28 bool MessageCenterNotificationManager::CancelById(const std::string& id) { | 33 bool MessageCenterNotificationManager::CancelById(const std::string& id) { |
| 29 // See if this ID hasn't been shown yet. | 34 // See if this ID hasn't been shown yet. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 } | 209 } |
| 205 | 210 |
| 206 void MessageCenterNotificationManager::RemoveProfileNotification( | 211 void MessageCenterNotificationManager::RemoveProfileNotification( |
| 207 ProfileNotification* profile_notification) { | 212 ProfileNotification* profile_notification) { |
| 208 profile_notification->notification().Close(false); // Not by user. | 213 profile_notification->notification().Close(false); // Not by user. |
| 209 std::string id = profile_notification->notification().notification_id(); | 214 std::string id = profile_notification->notification().notification_id(); |
| 210 message_center_->RemoveNotification(id); | 215 message_center_->RemoveNotification(id); |
| 211 profile_notifications_.erase(id); | 216 profile_notifications_.erase(id); |
| 212 delete profile_notification; | 217 delete profile_notification; |
| 213 } | 218 } |
| OLD | NEW |