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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "ash/system/web_notification/web_notification_tray.h" | 42 #include "ash/system/web_notification/web_notification_tray.h" |
43 #endif | 43 #endif |
44 | 44 |
45 MessageCenterNotificationManager::MessageCenterNotificationManager( | 45 MessageCenterNotificationManager::MessageCenterNotificationManager( |
46 message_center::MessageCenter* message_center, | 46 message_center::MessageCenter* message_center, |
47 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider) | 47 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider) |
48 : message_center_(message_center), | 48 : message_center_(message_center), |
49 settings_provider_(std::move(settings_provider)), | 49 settings_provider_(std::move(settings_provider)), |
50 system_observer_(this), | 50 system_observer_(this), |
51 stats_collector_(message_center), | 51 stats_collector_(message_center), |
52 google_now_stats_collector_(message_center) | 52 google_now_stats_collector_(message_center) { |
53 { | |
54 message_center_->AddObserver(this); | 53 message_center_->AddObserver(this); |
55 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); | 54 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); |
56 | 55 |
57 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
58 blockers_.push_back(make_scoped_ptr( | 57 blockers_.push_back(make_scoped_ptr( |
59 new LoginStateNotificationBlockerChromeOS(message_center))); | 58 new LoginStateNotificationBlockerChromeOS(message_center))); |
60 #else | 59 #else |
61 blockers_.push_back(make_scoped_ptr( | 60 blockers_.push_back(make_scoped_ptr( |
62 new ScreenLockNotificationBlocker(message_center))); | 61 new ScreenLockNotificationBlocker(message_center))); |
63 #endif | 62 #endif |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 removed = true; | 263 removed = true; |
265 } | 264 } |
266 } | 265 } |
267 return removed; | 266 return removed; |
268 } | 267 } |
269 | 268 |
270 void MessageCenterNotificationManager::CancelAll() { | 269 void MessageCenterNotificationManager::CancelAll() { |
271 message_center_->RemoveAllNotifications(/* by_user */ false); | 270 message_center_->RemoveAllNotifications(/* by_user */ false); |
272 } | 271 } |
273 | 272 |
| 273 bool MessageCenterNotificationManager::AcceptNativeNotifications() { |
| 274 return false; |
| 275 } |
| 276 |
274 //////////////////////////////////////////////////////////////////////////////// | 277 //////////////////////////////////////////////////////////////////////////////// |
275 // MessageCenter::Observer | 278 // MessageCenter::Observer |
276 void MessageCenterNotificationManager::OnNotificationRemoved( | 279 void MessageCenterNotificationManager::OnNotificationRemoved( |
277 const std::string& id, | 280 const std::string& id, |
278 bool by_user) { | 281 bool by_user) { |
279 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 282 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
280 if (iter != profile_notifications_.end()) | 283 if (iter != profile_notifications_.end()) |
281 RemoveProfileNotification(iter->second); | 284 RemoveProfileNotification(iter->second); |
282 } | 285 } |
283 | 286 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 it != registry->enabled_extensions().end(); | 378 it != registry->enabled_extensions().end(); |
376 ++it) { | 379 ++it) { |
377 if ((*it->get()).permissions_data()->HasAPIPermission( | 380 if ((*it->get()).permissions_data()->HasAPIPermission( |
378 extensions::APIPermission::ID::kNotificationProvider)) { | 381 extensions::APIPermission::ID::kNotificationProvider)) { |
379 extension_id = (*it->get()).id(); | 382 extension_id = (*it->get()).id(); |
380 return extension_id; | 383 return extension_id; |
381 } | 384 } |
382 } | 385 } |
383 return extension_id; | 386 return extension_id; |
384 } | 387 } |
OLD | NEW |