OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/notifications/message_center_notification_manager.h" | 11 #include "chrome/browser/notifications/message_center_notification_manager.h" |
12 #include "chrome/browser/notifications/message_center_settings_controller.h" | 12 #include "chrome/browser/notifications/message_center_settings_controller.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 | 15 |
16 // static | 16 // static |
17 NotificationUIManager* NotificationUIManager::Create() { | 17 NotificationUIManager* NotificationUIManager::Create() { |
18 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 18 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
19 if (!profile_manager) | 19 if (!profile_manager) |
20 return nullptr; | 20 return nullptr; |
| 21 if (!g_browser_process->message_center()) |
| 22 return nullptr; |
21 | 23 |
22 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider( | 24 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider( |
23 new MessageCenterSettingsController( | 25 new MessageCenterSettingsController( |
24 profile_manager->GetProfileAttributesStorage())); | 26 profile_manager->GetProfileAttributesStorage())); |
25 return new MessageCenterNotificationManager( | 27 return new MessageCenterNotificationManager( |
26 g_browser_process->message_center(), | 28 g_browser_process->message_center(), |
27 std::move(settings_provider)); | 29 std::move(settings_provider)); |
28 } | 30 } |
OLD | NEW |