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

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 11819048: Implement message center on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address miket comments. Created 7 years, 11 months 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 unified diff | Download patch
OLDNEW
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 #if !defined(OS_CHROMEOS)
23 // On Windows, the notification manager owns the tray icon and views. Other
24 // platforms have global ownership and Create will return NULL.
25 tray_.reset(message_center::CreateMessageCenterTray());
26 #endif
20 } 27 }
21 28
22 MessageCenterNotificationManager::~MessageCenterNotificationManager() { 29 MessageCenterNotificationManager::~MessageCenterNotificationManager() {
23 } 30 }
24 31
25 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
26 // NotificationUIManager 33 // NotificationUIManager
27 34
28 bool MessageCenterNotificationManager::CancelById(const std::string& id) { 35 bool MessageCenterNotificationManager::CancelById(const std::string& id) {
29 // See if this ID hasn't been shown yet. 36 // See if this ID hasn't been shown yet.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 211 }
205 212
206 void MessageCenterNotificationManager::RemoveProfileNotification( 213 void MessageCenterNotificationManager::RemoveProfileNotification(
207 ProfileNotification* profile_notification) { 214 ProfileNotification* profile_notification) {
208 profile_notification->notification().Close(false); // Not by user. 215 profile_notification->notification().Close(false); // Not by user.
209 std::string id = profile_notification->notification().notification_id(); 216 std::string id = profile_notification->notification().notification_id();
210 message_center_->RemoveNotification(id); 217 message_center_->RemoveNotification(id);
211 profile_notifications_.erase(id); 218 profile_notifications_.erase(id);
212 delete profile_notification; 219 delete profile_notification;
213 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698