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/notification_ui_manager_mac.h" | 5 #include "chrome/browser/notifications/notification_ui_manager_mac.h" |
6 | 6 |
7 #include "base/mac/cocoa_protocols.h" | 7 #include "base/mac/cocoa_protocols.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 // Owned by ControllerNotification. | 140 // Owned by ControllerNotification. |
141 id<CrUserNotification> ns_notification = | 141 id<CrUserNotification> ns_notification = |
142 [[NSClassFromString(@"NSUserNotification") alloc] init]; | 142 [[NSClassFromString(@"NSUserNotification") alloc] init]; |
143 | 143 |
144 ns_notification.title = base::SysUTF16ToNSString(notification.title()); | 144 ns_notification.title = base::SysUTF16ToNSString(notification.title()); |
145 ns_notification.subtitle = | 145 ns_notification.subtitle = |
146 base::SysUTF16ToNSString(notification.display_source()); | 146 base::SysUTF16ToNSString(notification.display_source()); |
147 ns_notification.informativeText = | 147 ns_notification.informativeText = |
148 base::SysUTF16ToNSString(notification.body()); | 148 base::SysUTF16ToNSString(notification.message()); |
149 ns_notification.userInfo = | 149 ns_notification.userInfo = |
150 [NSDictionary dictionaryWithObject:base::SysUTF8ToNSString( | 150 [NSDictionary dictionaryWithObject:base::SysUTF8ToNSString( |
151 notification.notification_id()) | 151 notification.notification_id()) |
152 forKey:kNotificationIDKey]; | 152 forKey:kNotificationIDKey]; |
153 ns_notification.hasActionButton = NO; | 153 ns_notification.hasActionButton = NO; |
154 | 154 |
155 notification_map_.insert(std::make_pair( | 155 notification_map_.insert(std::make_pair( |
156 notification.notification_id(), | 156 notification.notification_id(), |
157 new ControllerNotification(profile, | 157 new ControllerNotification(profile, |
158 ns_notification, | 158 ns_notification, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 notification->Click(); | 327 notification->Click(); |
328 } | 328 } |
329 | 329 |
330 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center | 330 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center |
331 shouldPresentNotification:(id<CrUserNotification>)nsNotification { | 331 shouldPresentNotification:(id<CrUserNotification>)nsNotification { |
332 // Always display notifications, regardless of whether the app is foreground. | 332 // Always display notifications, regardless of whether the app is foreground. |
333 return YES; | 333 return YES; |
334 } | 334 } |
335 | 335 |
336 @end | 336 @end |
OLD | NEW |