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 | 9 |
11 #if defined(ENABLE_MESSAGE_CENTER) | 10 #if defined(ENABLE_MESSAGE_CENTER) |
12 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/notifications/message_center_notification_manager.h" | 12 #include "chrome/browser/notifications/message_center_notification_manager.h" |
| 13 #include "ui/message_center/message_center_switches.h" |
14 #endif | 14 #endif |
15 | 15 |
16 // static | 16 // static |
17 bool NotificationUIManager::DelegatesToMessageCenter() { | 17 bool NotificationUIManager::DelegatesToMessageCenter() { |
18 // MessageCenterNotificationManager doesn't work quite well with Ash | 18 // MessageCenterNotificationManager doesn't work quite well with Ash |
19 // right now. Until it matures in ChromeOS, delegating to message center will | 19 // right now. Until it matures in ChromeOS, delegating to message center will |
20 // be done by BalloonCollectionImplAsh through BalloonNotificationUIManager. | 20 // be done by BalloonCollectionImplAsh through BalloonNotificationUIManager. |
21 // TODO(mukai): remove this #if when that's no problem. | 21 // TODO(mukai): remove this |&& !defined(USE_ASH)| when that's no problem. |
22 #if !defined(USE_ASH) | 22 #if defined(ENABLE_MESSAGE_CENTER) && !defined(USE_ASH) |
23 return CommandLine::ForCurrentProcess()->HasSwitch( | 23 return CommandLine::ForCurrentProcess()->HasSwitch( |
24 switches::kEnableRichNotifications); | 24 message_center::switches::kEnableRichNotifications); |
25 #endif | 25 #endif |
26 return false; | 26 return false; |
27 } | 27 } |
28 | 28 |
29 #if !defined(OS_MACOSX) | 29 #if !defined(OS_MACOSX) |
30 // static | 30 // static |
31 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { | 31 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { |
32 #if defined(ENABLE_MESSAGE_CENTER) | 32 #if defined(ENABLE_MESSAGE_CENTER) |
33 if (DelegatesToMessageCenter()) | 33 if (DelegatesToMessageCenter()) |
34 return new MessageCenterNotificationManager( | 34 return new MessageCenterNotificationManager( |
35 g_browser_process->message_center()); | 35 g_browser_process->message_center()); |
36 #endif | 36 #endif |
37 BalloonNotificationUIManager* balloon_manager = | 37 BalloonNotificationUIManager* balloon_manager = |
38 new BalloonNotificationUIManager(local_state); | 38 new BalloonNotificationUIManager(local_state); |
39 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); | 39 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); |
40 return balloon_manager; | 40 return balloon_manager; |
41 } | 41 } |
42 #endif | 42 #endif |
43 | 43 |
OLD | NEW |