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

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

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 5 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 25 matching lines...) Expand all
36 36
37 DCHECK([[notification userInfo] 37 DCHECK([[notification userInfo]
38 objectForKey:notification_constants::kNotificationProfileId]); 38 objectForKey:notification_constants::kNotificationProfileId]);
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]
47 objectForKey:notification_constants::kNotificationType];
46 48
47 // Initialize operation and button index for the case where the 49 // Initialize operation and button index for the case where the
48 // notification itself was clicked. 50 // notification itself was clicked.
49 NotificationOperation operation = NOTIFICATION_CLICK; 51 NotificationOperation operation = NOTIFICATION_CLICK;
50 int buttonIndex = -1; 52 int buttonIndex = -1;
51 53
52 // 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
53 // was a developer-provided button or the mandatory Settings button. 55 // was a developer-provided button or the mandatory Settings button.
54 if (notification.activationType == 56 if (notification.activationType ==
55 NSUserNotificationActivationTypeActionButtonClicked) { 57 NSUserNotificationActivationTypeActionButtonClicked) {
(...skipping 25 matching lines...) Expand all
81 ? -1 83 ? -1
82 : actionIndex.intValue; 84 : actionIndex.intValue;
83 } 85 }
84 } 86 }
85 87
86 return @{ 88 return @{
87 notification_constants::kNotificationOrigin : origin, 89 notification_constants::kNotificationOrigin : origin,
88 notification_constants::kNotificationId : notificationId, 90 notification_constants::kNotificationId : notificationId,
89 notification_constants::kNotificationProfileId : profileId, 91 notification_constants::kNotificationProfileId : profileId,
90 notification_constants::kNotificationIncognito : incognito, 92 notification_constants::kNotificationIncognito : incognito,
91 notification_constants::kNotificationOperation : 93 notification_constants::kNotificationType : notificationType,
92 [NSNumber numberWithInt:operation], 94 notification_constants::
95 kNotificationOperation : [NSNumber numberWithInt:operation],
Peter Beverloo 2016/07/05 23:44:18 indent += 4?
Miguel Garcia 2016/07/07 11:02:29 Done.
93 notification_constants:: 96 notification_constants::
94 kNotificationButtonIndex : [NSNumber numberWithInt:buttonIndex], 97 kNotificationButtonIndex : [NSNumber numberWithInt:buttonIndex],
95 }; 98 };
96 } 99 }
97 100
98 @end 101 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698