| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_platform_bridge_mac.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/notifications/notification.h" | 14 #include "chrome/browser/notifications/notification.h" |
| 15 #include "chrome/browser/notifications/notification_common.h" |
| 15 #include "chrome/browser/notifications/notification_display_service_factory.h" | 16 #include "chrome/browser/notifications/notification_display_service_factory.h" |
| 16 #include "chrome/browser/notifications/persistent_notification_delegate.h" | 17 #include "chrome/browser/notifications/persistent_notification_delegate.h" |
| 17 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 18 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h" | 21 #include "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h" |
| 21 #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h" | 22 #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h" |
| 22 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac
.h" | 23 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac
.h" |
| 23 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| 24 #include "components/url_formatter/elide_url.h" | 25 #include "components/url_formatter/elide_url.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 211 } |
| 211 std::string profileId = base::SysNSStringToUTF8( | 212 std::string profileId = base::SysNSStringToUTF8( |
| 212 [response objectForKey:notification_constants::kNotificationProfileId]); | 213 [response objectForKey:notification_constants::kNotificationProfileId]); |
| 213 NSNumber* isIncognito = | 214 NSNumber* isIncognito = |
| 214 [response objectForKey:notification_constants::kNotificationIncognito]; | 215 [response objectForKey:notification_constants::kNotificationIncognito]; |
| 215 | 216 |
| 216 GURL origin(notificationOrigin); | 217 GURL origin(notificationOrigin); |
| 217 | 218 |
| 218 PlatformNotificationServiceImpl::GetInstance() | 219 PlatformNotificationServiceImpl::GetInstance() |
| 219 ->ProcessPersistentNotificationOperation( | 220 ->ProcessPersistentNotificationOperation( |
| 220 static_cast<PlatformNotificationServiceImpl::NotificationOperation>( | 221 static_cast<NotificationCommon::Operation>(operation.intValue), |
| 221 operation.intValue), | |
| 222 profileId, [isIncognito boolValue], origin, persistentId, | 222 profileId, [isIncognito boolValue], origin, persistentId, |
| 223 buttonIndex.intValue); | 223 buttonIndex.intValue); |
| 224 } | 224 } |
| 225 | 225 |
| 226 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center | 226 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center |
| 227 shouldPresentNotification:(NSUserNotification*)nsNotification { | 227 shouldPresentNotification:(NSUserNotification*)nsNotification { |
| 228 // Always display notifications, regardless of whether the app is foreground. | 228 // Always display notifications, regardless of whether the app is foreground. |
| 229 return YES; | 229 return YES; |
| 230 } | 230 } |
| 231 | 231 |
| 232 @end | 232 @end |
| OLD | NEW |