| 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 "chrome/browser/browser_process.h" |
| 7 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 8 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
| 8 | |
| 9 #if defined(ENABLE_MESSAGE_CENTER) | |
| 10 #include "chrome/browser/browser_process.h" | |
| 11 #include "chrome/browser/notifications/message_center_notification_manager.h" | 9 #include "chrome/browser/notifications/message_center_notification_manager.h" |
| 12 #include "ui/message_center/message_center_util.h" | 10 #include "ui/message_center/message_center_util.h" |
| 13 #endif | |
| 14 | 11 |
| 15 // static | 12 // static |
| 16 bool NotificationUIManager::DelegatesToMessageCenter() { | 13 bool NotificationUIManager::DelegatesToMessageCenter() { |
| 17 // In ChromeOS, it always uses MessageCenterNotificationManager. The flag of | 14 // In ChromeOS, it always uses MessageCenterNotificationManager. The flag of |
| 18 // --enable-rich-notifications switches the contents and behaviors inside of | 15 // --enable-rich-notifications switches the contents and behaviors inside of |
| 19 // the message center. | 16 // the message center. |
| 20 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 21 return true; | 18 return true; |
| 22 #elif defined(ENABLE_MESSAGE_CENTER) | 19 #endif |
| 23 return message_center::IsRichNotificationEnabled(); | 20 return message_center::IsRichNotificationEnabled(); |
| 24 #endif | |
| 25 return false; | |
| 26 } | 21 } |
| 27 | 22 |
| 28 #if !defined(OS_MACOSX) | 23 #if !defined(OS_MACOSX) |
| 29 // static | 24 // static |
| 30 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { | 25 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { |
| 31 #if defined(ENABLE_MESSAGE_CENTER) | |
| 32 if (DelegatesToMessageCenter()) | 26 if (DelegatesToMessageCenter()) |
| 33 return new MessageCenterNotificationManager( | 27 return new MessageCenterNotificationManager( |
| 34 g_browser_process->message_center()); | 28 g_browser_process->message_center()); |
| 35 #endif | 29 |
| 36 BalloonNotificationUIManager* balloon_manager = | 30 BalloonNotificationUIManager* balloon_manager = |
| 37 new BalloonNotificationUIManager(local_state); | 31 new BalloonNotificationUIManager(local_state); |
| 38 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); | 32 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); |
| 39 return balloon_manager; | 33 return balloon_manager; |
| 40 } | 34 } |
| 41 #endif | 35 #endif |
| OLD | NEW |