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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.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/notifications/message_center_settings_controller.h" | 10 #include "chrome/browser/notifications/message_center_settings_controller.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 bool NotificationUIManager::DelegatesToMessageCenter() { | 21 bool NotificationUIManager::DelegatesToMessageCenter() { |
22 // In ChromeOS, it always uses MessageCenterNotificationManager. The flag of | 22 // In ChromeOS, it always uses MessageCenterNotificationManager. The flag of |
23 // --enable-rich-notifications switches the contents and behaviors inside of | 23 // --enable-rich-notifications switches the contents and behaviors inside of |
24 // the message center. | 24 // the message center. |
25 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
26 return true; | 26 return true; |
27 #endif | 27 #endif |
28 return message_center::IsRichNotificationEnabled(); | 28 return message_center::IsRichNotificationEnabled(); |
29 } | 29 } |
30 | 30 |
31 #if !defined(OS_MACOSX) | |
32 // static | 31 // static |
33 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { | 32 NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { |
34 if (DelegatesToMessageCenter()) { | 33 if (DelegatesToMessageCenter()) { |
35 ProfileInfoCache* profile_info_cache = | 34 ProfileInfoCache* profile_info_cache = |
36 &g_browser_process->profile_manager()->GetProfileInfoCache(); | 35 &g_browser_process->profile_manager()->GetProfileInfoCache(); |
37 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider( | 36 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider( |
38 new MessageCenterSettingsController(profile_info_cache)); | 37 new MessageCenterSettingsController(profile_info_cache)); |
39 return new MessageCenterNotificationManager( | 38 return new MessageCenterNotificationManager( |
40 g_browser_process->message_center(), | 39 g_browser_process->message_center(), |
41 local_state, | 40 local_state, |
42 settings_provider.Pass()); | 41 settings_provider.Pass()); |
43 } | 42 } |
44 | 43 |
45 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
46 // Since we can't reach here for CrOS (see above), no point compiling all | 45 // Since we can't reach here for CrOS (see above), no point compiling all |
47 // the dependent classes there. | 46 // the dependent classes there. |
48 CHECK(false); | 47 CHECK(false); |
49 return NULL; | 48 return NULL; |
| 49 #elif defined(OS_MACOSX) || defined(USE_AURA) |
| 50 // IsRichNotificationEnabled() always returns true in this case. |
| 51 CHECK(false); |
| 52 return NULL; |
50 #else | 53 #else |
51 BalloonNotificationUIManager* balloon_manager = | 54 BalloonNotificationUIManager* balloon_manager = |
52 new BalloonNotificationUIManager(local_state); | 55 new BalloonNotificationUIManager(local_state); |
53 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); | 56 balloon_manager->SetBalloonCollection(BalloonCollection::Create()); |
54 return balloon_manager; | 57 return balloon_manager; |
55 #endif | 58 #endif |
56 } | 59 } |
57 #endif | |
OLD | NEW |