| 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_info_map.h" | |
| 12 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/notifications/desktop_notification_service.h" | 12 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 14 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 15 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" | 14 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" |
| 16 #include "chrome/browser/notifications/message_center_settings_controller.h" | 15 #include "chrome/browser/notifications/message_center_settings_controller.h" |
| 17 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
| 18 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" | 17 #include "chrome/browser/notifications/screen_lock_notification_blocker.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 22 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
| 23 #include "chrome/common/extensions/extension_set.h" | 22 #include "chrome/common/extensions/extension_set.h" |
| 24 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 25 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
| 27 #include "extensions/browser/info_map.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 #endif | 36 #endif |
| 37 | 37 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 downloads_->StartDownloads(notification_); | 413 downloads_->StartDownloads(notification_); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void | 416 void |
| 417 MessageCenterNotificationManager::ProfileNotification::OnDownloadsCompleted() { | 417 MessageCenterNotificationManager::ProfileNotification::OnDownloadsCompleted() { |
| 418 notification_.DoneRendering(); | 418 notification_.DoneRendering(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 std::string | 421 std::string |
| 422 MessageCenterNotificationManager::ProfileNotification::GetExtensionId() { | 422 MessageCenterNotificationManager::ProfileNotification::GetExtensionId() { |
| 423 ExtensionInfoMap* extension_info_map = | 423 extensions::InfoMap* extension_info_map = |
| 424 extensions::ExtensionSystem::Get(profile())->info_map(); | 424 extensions::ExtensionSystem::Get(profile())->info_map(); |
| 425 ExtensionSet extensions; | 425 ExtensionSet extensions; |
| 426 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 426 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
| 427 notification().origin_url(), notification().process_id(), | 427 notification().origin_url(), notification().process_id(), |
| 428 extensions::APIPermission::kNotification, &extensions); | 428 extensions::APIPermission::kNotification, &extensions); |
| 429 | 429 |
| 430 DesktopNotificationService* desktop_service = | 430 DesktopNotificationService* desktop_service = |
| 431 DesktopNotificationServiceFactory::GetForProfile(profile()); | 431 DesktopNotificationServiceFactory::GetForProfile(profile()); |
| 432 for (ExtensionSet::const_iterator iter = extensions.begin(); | 432 for (ExtensionSet::const_iterator iter = extensions.begin(); |
| 433 iter != extensions.end(); ++iter) { | 433 iter != extensions.end(); ++iter) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 MessageCenterNotificationManager::ProfileNotification* | 468 MessageCenterNotificationManager::ProfileNotification* |
| 469 MessageCenterNotificationManager::FindProfileNotification( | 469 MessageCenterNotificationManager::FindProfileNotification( |
| 470 const std::string& id) const { | 470 const std::string& id) const { |
| 471 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 471 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
| 472 if (iter == profile_notifications_.end()) | 472 if (iter == profile_notifications_.end()) |
| 473 return NULL; | 473 return NULL; |
| 474 | 474 |
| 475 return (*iter).second; | 475 return (*iter).second; |
| 476 } | 476 } |
| OLD | NEW |