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/message_center_notification_manager.h" | 5 #include "chrome/browser/notifications/message_center_notification_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/notifications/desktop_notification_service.h" | 12 #include "chrome/browser/notifications/desktop_notification_service.h" |
12 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
13 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" | 14 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" |
14 #include "chrome/browser/notifications/message_center_settings_controller.h" | 15 #include "chrome/browser/notifications/message_center_settings_controller.h" |
15 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
16 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" | 17 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #endif | 84 #endif |
84 registrar_.Add(this, | 85 registrar_.Add(this, |
85 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 86 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
86 content::NotificationService::AllSources()); | 87 content::NotificationService::AllSources()); |
87 } | 88 } |
88 | 89 |
89 MessageCenterNotificationManager::~MessageCenterNotificationManager() { | 90 MessageCenterNotificationManager::~MessageCenterNotificationManager() { |
90 message_center_->RemoveObserver(this); | 91 message_center_->RemoveObserver(this); |
91 } | 92 } |
92 | 93 |
| 94 void MessageCenterNotificationManager::RegisterPrefs( |
| 95 PrefRegistrySimple* registry) { |
| 96 registry->RegisterBooleanPref(prefs::kMessageCenterShowedFirstRunBalloon, |
| 97 false); |
| 98 } |
| 99 |
93 //////////////////////////////////////////////////////////////////////////////// | 100 //////////////////////////////////////////////////////////////////////////////// |
94 // NotificationUIManager | 101 // NotificationUIManager |
95 | 102 |
96 void MessageCenterNotificationManager::Add(const Notification& notification, | 103 void MessageCenterNotificationManager::Add(const Notification& notification, |
97 Profile* profile) { | 104 Profile* profile) { |
98 if (Update(notification, profile)) | 105 if (Update(notification, profile)) |
99 return; | 106 return; |
100 | 107 |
101 DesktopNotificationServiceFactory::GetForProfile(profile)-> | 108 DesktopNotificationServiceFactory::GetForProfile(profile)-> |
102 ShowWelcomeNotificationIfNecessary(notification); | 109 ShowWelcomeNotificationIfNecessary(notification); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 497 |
491 MessageCenterNotificationManager::ProfileNotification* | 498 MessageCenterNotificationManager::ProfileNotification* |
492 MessageCenterNotificationManager::FindProfileNotification( | 499 MessageCenterNotificationManager::FindProfileNotification( |
493 const std::string& id) const { | 500 const std::string& id) const { |
494 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 501 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
495 if (iter == profile_notifications_.end()) | 502 if (iter == profile_notifications_.end()) |
496 return NULL; | 503 return NULL; |
497 | 504 |
498 return (*iter).second; | 505 return (*iter).second; |
499 } | 506 } |
OLD | NEW |