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