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" | |
10 | |
11 #if defined(ENABLE_MESSAGE_CENTER) | |
9 #include "chrome/browser/notifications/message_center_notification_manager.h" | 12 #include "chrome/browser/notifications/message_center_notification_manager.h" |
10 #include "chrome/common/chrome_switches.h" | 13 #endif |
11 | 14 |
12 // static | 15 // static |
13 bool NotificationUIManager::DelegatesToMessageCenter() { | 16 bool NotificationUIManager::DelegatesToMessageCenter() { |
14 #if defined(OS_WIN) || defined(OS_CHROMEOS) | 17 #if defined(ENABLE_MESSAGE_CENTER) |
15 return CommandLine::ForCurrentProcess()->HasSwitch( | 18 return CommandLine::ForCurrentProcess()->HasSwitch( |
16 switches::kEnableRichNotifications); | 19 switches::kEnableRichNotifications); |
17 #else | 20 #else |
18 return false; | 21 return false; |
19 #endif | 22 #endif |
20 } | 23 } |
21 | 24 |
22 #if !defined(OS_MACOSX) | 25 #if !defined(OS_MACOSX) |
23 // static | 26 // static |
24 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { | 27 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { |
25 if (DelegatesToMessageCenter()) { | 28 #if defined(ENABLE_MESSAGE_CENTER) |
stevenjb
2013/01/07 23:08:05
This #if isn't really necessary since DelegatesToM
dewittj
2013/01/08 23:50:01
This #if is required as the code is currently writ
stevenjb
2013/01/08 23:59:50
Ah, of course, Duh.
| |
29 if (DelegatesToMessageCenter()) | |
26 return new MessageCenterNotificationManager(); | 30 return new MessageCenterNotificationManager(); |
27 } else { | 31 #endif |
28 BalloonNotificationUIManager* balloon_manager = | 32 BalloonNotificationUIManager* balloon_manager = |
29 new BalloonNotificationUIManager(local_state); | 33 new BalloonNotificationUIManager(local_state); |
30 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); | 34 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); |
31 return balloon_manager; | 35 return balloon_manager; |
32 } | |
33 } | 36 } |
34 #endif | 37 #endif |
35 | 38 |
OLD | NEW |