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/notification_ui_manager.h" | 5 #include "chrome/browser/notifications/notification_ui_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 8 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 | 10 |
11 #if defined(ENABLE_MESSAGE_CENTER) | 11 #if defined(ENABLE_MESSAGE_CENTER) |
| 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/notifications/message_center_notification_manager.h" | 13 #include "chrome/browser/notifications/message_center_notification_manager.h" |
13 #endif | 14 #endif |
14 | 15 |
15 // static | 16 // static |
16 bool NotificationUIManager::DelegatesToMessageCenter() { | 17 bool NotificationUIManager::DelegatesToMessageCenter() { |
17 #if defined(ENABLE_MESSAGE_CENTER) | |
18 return CommandLine::ForCurrentProcess()->HasSwitch( | 18 return CommandLine::ForCurrentProcess()->HasSwitch( |
19 switches::kEnableRichNotifications); | 19 switches::kEnableRichNotifications); |
20 #else | |
21 return false; | 20 return false; |
22 #endif | |
23 } | 21 } |
24 | 22 |
25 #if !defined(OS_MACOSX) | 23 #if !defined(OS_MACOSX) |
26 // static | 24 // static |
27 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { | 25 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { |
28 #if defined(ENABLE_MESSAGE_CENTER) | 26 #if defined(ENABLE_MESSAGE_CENTER) |
29 if (DelegatesToMessageCenter()) | 27 if (DelegatesToMessageCenter()) |
30 return new MessageCenterNotificationManager(); | 28 return new MessageCenterNotificationManager( |
| 29 g_browser_process->message_center()); |
31 #endif | 30 #endif |
32 BalloonNotificationUIManager* balloon_manager = | 31 BalloonNotificationUIManager* balloon_manager = |
33 new BalloonNotificationUIManager(local_state); | 32 new BalloonNotificationUIManager(local_state); |
34 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); | 33 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); |
35 return balloon_manager; | 34 return balloon_manager; |
36 } | 35 } |
37 #endif | 36 #endif |
38 | 37 |
OLD | NEW |