Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.mm

Issue 2418183002: Revert of Implement support for closing mac native notifications (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac .h" 5 #import "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac .h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h" 8 #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h"
9 9
10 namespace { 10 namespace {
(...skipping 28 matching lines...) Expand all
39 NSString* profileId = [[notification userInfo] 39 NSString* profileId = [[notification userInfo]
40 objectForKey:notification_constants::kNotificationProfileId]; 40 objectForKey:notification_constants::kNotificationProfileId];
41 41
42 DCHECK([[notification userInfo] 42 DCHECK([[notification userInfo]
43 objectForKey:notification_constants::kNotificationIncognito]); 43 objectForKey:notification_constants::kNotificationIncognito]);
44 NSNumber* incognito = [[notification userInfo] 44 NSNumber* incognito = [[notification userInfo]
45 objectForKey:notification_constants::kNotificationIncognito]; 45 objectForKey:notification_constants::kNotificationIncognito];
46 NSNumber* notificationType = [[notification userInfo] 46 NSNumber* notificationType = [[notification userInfo]
47 objectForKey:notification_constants::kNotificationType]; 47 objectForKey:notification_constants::kNotificationType];
48 48
49 // Closed notifications are not activated. 49 // Initialize operation and button index for the case where the
50 NotificationOperation operation = 50 // notification itself was clicked.
51 notification.activationType == NSUserNotificationActivationTypeNone 51 NotificationOperation operation = NOTIFICATION_CLICK;
52 ? NOTIFICATION_CLOSE
53 : NOTIFICATION_CLICK;
54 int buttonIndex = -1; 52 int buttonIndex = -1;
55 53
56 // Determine whether the user clicked on a button, and if they did, whether it 54 // Determine whether the user clicked on a button, and if they did, whether it
57 // was a developer-provided button or the mandatory Settings button. 55 // was a developer-provided button or the mandatory Settings button.
58 if (notification.activationType == 56 if (notification.activationType ==
59 NSUserNotificationActivationTypeActionButtonClicked) { 57 NSUserNotificationActivationTypeActionButtonClicked) {
60 NSArray* alternateButtons = @[]; 58 NSArray* alternateButtons = @[];
61 if ([notification 59 if ([notification
62 respondsToSelector:@selector(_alternateActionButtonTitles)]) { 60 respondsToSelector:@selector(_alternateActionButtonTitles)]) {
63 alternateButtons = 61 alternateButtons =
(...skipping 30 matching lines...) Expand all
94 notification_constants::kNotificationIncognito : incognito, 92 notification_constants::kNotificationIncognito : incognito,
95 notification_constants::kNotificationType : notificationType, 93 notification_constants::kNotificationType : notificationType,
96 notification_constants:: 94 notification_constants::
97 kNotificationOperation : [NSNumber numberWithInt:operation], 95 kNotificationOperation : [NSNumber numberWithInt:operation],
98 notification_constants:: 96 notification_constants::
99 kNotificationButtonIndex : [NSNumber numberWithInt:buttonIndex], 97 kNotificationButtonIndex : [NSNumber numberWithInt:buttonIndex],
100 }; 98 };
101 } 99 }
102 100
103 @end 101 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698