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_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
12 #include "chrome/browser/notifications/desktop_notification_service.h" | 12 #include "chrome/browser/notifications/desktop_notification_service.h" |
13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
14 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" | 14 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" |
15 #include "chrome/browser/notifications/message_center_settings_controller.h" | 15 #include "chrome/browser/notifications/message_center_settings_controller.h" |
16 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
17 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" | 17 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
22 #include "chrome/common/extensions/extension_set.h" | |
23 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
26 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
27 #include "extensions/browser/info_map.h" | 26 #include "extensions/browser/info_map.h" |
| 27 #include "extensions/common/extension_set.h" |
28 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
29 #include "ui/message_center/message_center_style.h" | 29 #include "ui/message_center/message_center_style.h" |
30 #include "ui/message_center/message_center_tray.h" | 30 #include "ui/message_center/message_center_tray.h" |
31 #include "ui/message_center/message_center_types.h" | 31 #include "ui/message_center/message_center_types.h" |
32 #include "ui/message_center/notifier_settings.h" | 32 #include "ui/message_center/notifier_settings.h" |
33 | 33 |
34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
35 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" | 35 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" |
36 #include "chrome/browser/notifications/multi_user_notification_blocker_chromeos.
h" | 36 #include "chrome/browser/notifications/multi_user_notification_blocker_chromeos.
h" |
37 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 37 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 void | 422 void |
423 MessageCenterNotificationManager::ProfileNotification::OnDownloadsCompleted() { | 423 MessageCenterNotificationManager::ProfileNotification::OnDownloadsCompleted() { |
424 notification_.DoneRendering(); | 424 notification_.DoneRendering(); |
425 } | 425 } |
426 | 426 |
427 std::string | 427 std::string |
428 MessageCenterNotificationManager::ProfileNotification::GetExtensionId() { | 428 MessageCenterNotificationManager::ProfileNotification::GetExtensionId() { |
429 extensions::InfoMap* extension_info_map = | 429 extensions::InfoMap* extension_info_map = |
430 extensions::ExtensionSystem::Get(profile())->info_map(); | 430 extensions::ExtensionSystem::Get(profile())->info_map(); |
431 ExtensionSet extensions; | 431 extensions::ExtensionSet extensions; |
432 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 432 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
433 notification().origin_url(), notification().process_id(), | 433 notification().origin_url(), notification().process_id(), |
434 extensions::APIPermission::kNotification, &extensions); | 434 extensions::APIPermission::kNotification, &extensions); |
435 | 435 |
436 DesktopNotificationService* desktop_service = | 436 DesktopNotificationService* desktop_service = |
437 DesktopNotificationServiceFactory::GetForProfile(profile()); | 437 DesktopNotificationServiceFactory::GetForProfile(profile()); |
438 for (ExtensionSet::const_iterator iter = extensions.begin(); | 438 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
439 iter != extensions.end(); ++iter) { | 439 iter != extensions.end(); ++iter) { |
440 if (desktop_service->IsNotifierEnabled(message_center::NotifierId( | 440 if (desktop_service->IsNotifierEnabled(message_center::NotifierId( |
441 message_center::NotifierId::APPLICATION, (*iter)->id()))) { | 441 message_center::NotifierId::APPLICATION, (*iter)->id()))) { |
442 return (*iter)->id(); | 442 return (*iter)->id(); |
443 } | 443 } |
444 } | 444 } |
445 return std::string(); | 445 return std::string(); |
446 } | 446 } |
447 | 447 |
448 //////////////////////////////////////////////////////////////////////////////// | 448 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 24 matching lines...) Expand all Loading... |
473 | 473 |
474 MessageCenterNotificationManager::ProfileNotification* | 474 MessageCenterNotificationManager::ProfileNotification* |
475 MessageCenterNotificationManager::FindProfileNotification( | 475 MessageCenterNotificationManager::FindProfileNotification( |
476 const std::string& id) const { | 476 const std::string& id) const { |
477 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 477 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
478 if (iter == profile_notifications_.end()) | 478 if (iter == profile_notifications_.end()) |
479 return NULL; | 479 return NULL; |
480 | 480 |
481 return (*iter).second; | 481 return (*iter).second; |
482 } | 482 } |
OLD | NEW |