RESOLVED FIXED 78783
Bring notifications support to WK1 mac
https://bugs.webkit.org/show_bug.cgi?id=78783
Summary Bring notifications support to WK1 mac
Jon Lee
Reported 2012-02-16 00:38:55 PST
Attachments
Bring notifications support to WK1 mac (1.19 KB, patch)
2012-02-16 02:38 PST, Jon Lee
andersca: review+
Source/WebKit/mac: (Prep work for) Bring notifications support to WK1 mac (11.74 KB, patch)
2012-02-16 02:39 PST, Jon Lee
andersca: review+
Source/WebKit: Bring notifications support to WK1 mac (28.47 KB, patch)
2012-02-16 02:39 PST, Jon Lee
no flags
Bring notifications support to WK1 mac: permission requests (6.95 KB, patch)
2012-02-16 02:39 PST, Jon Lee
andersca: review+
Bring notifications support to WK1 mac: showing, canceling, removing notifications (30.88 KB, patch)
2012-02-16 10:54 PST, Jon Lee
no flags
Bring notifications support to WK1 mac: showing, canceling, removing notifications (31.01 KB, patch)
2012-02-16 23:47 PST, Jon Lee
no flags
Bring notifications support to WK1 mac: showing, canceling, removing notifications (30.47 KB, patch)
2012-02-21 14:10 PST, Jon Lee
andersca: review+
Jon Lee
Comment 1 2012-02-16 02:38:57 PST
Created attachment 127338 [details] Bring notifications support to WK1 mac
Jon Lee
Comment 2 2012-02-16 02:39:00 PST
Created attachment 127339 [details] Source/WebKit/mac: (Prep work for) Bring notifications support to WK1 mac
Jon Lee
Comment 3 2012-02-16 02:39:03 PST
Created attachment 127340 [details] Source/WebKit: Bring notifications support to WK1 mac
Jon Lee
Comment 4 2012-02-16 02:39:06 PST
Created attachment 127341 [details] Bring notifications support to WK1 mac: permission requests
Jon Lee
Comment 5 2012-02-16 10:54:35 PST
Created attachment 127410 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications
Jon Lee
Comment 6 2012-02-16 10:56:12 PST
Comment on attachment 127340 [details] Source/WebKit: Bring notifications support to WK1 mac Missing code. Replacement patch has been posted.
Jon Lee
Comment 7 2012-02-16 23:47:55 PST
Created attachment 127534 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications
Anders Carlsson
Comment 8 2012-02-17 09:29:02 PST
Comment on attachment 127534 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications View in context: https://bugs.webkit.org/attachment.cgi?id=127534&action=review > Source/WebKit/mac/WebView/WebNotification.mm:45 > + WebNotificationInternal *_internal; Can't this just be a RefPtr<Notification> instead? Then you wouldn't have to worry about the lifecycle management and casting between WebNotificationInternal and WebCore::Notification. > Source/WebKit/mac/WebView/WebViewPrivate.h:2 > - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. > + * Copyright (C) 2005-2012 Apple Inc. All rights reserved. I don't think we're supposed to use ranges for copyright years.
Jon Lee
Comment 9 2012-02-17 09:40:33 PST
Comment on attachment 127534 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications View in context: https://bugs.webkit.org/attachment.cgi?id=127534&action=review >> Source/WebKit/mac/WebView/WebNotification.mm:45 >> + WebNotificationInternal *_internal; > > Can't this just be a RefPtr<Notification> instead? Then you wouldn't have to worry about the lifecycle management and casting between WebNotificationInternal and WebCore::Notification. Sure. I was originally basing this on other code that do something similar. But it's easy to convert this to a RefPtr. >> Source/WebKit/mac/WebView/WebViewPrivate.h:2 >> + * Copyright (C) 2005-2012 Apple Inc. All rights reserved. > > I don't think we're supposed to use ranges for copyright years. Whoops, this change slipped by. It wouldn't be correct, anyway.
Jon Lee
Comment 10 2012-02-21 14:10:32 PST
Created attachment 128042 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications
Anders Carlsson
Comment 11 2012-02-21 14:17:01 PST
Comment on attachment 128042 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications View in context: https://bugs.webkit.org/attachment.cgi?id=128042&action=review > Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm:73 > + NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext()); > + if (it == m_notificationContextMap.end()) { > + pair<NotificationContextMap::iterator, bool> addedPair = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<RetainPtr<WebNotification> >()); > + it = addedPair.first; > + } > + it->second.append(webNotification); I think you can simplify this to always call add: NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<RetainPtr<WebNotification> >()).first(); addedPair.append(webNotification); > Source/WebKit/mac/WebView/WebNotification.mm:73 > +- (id)init Please add an extra newline before the method definition.
Jon Lee
Comment 12 2012-02-21 14:25:19 PST
Comment on attachment 128042 [details] Bring notifications support to WK1 mac: showing, canceling, removing notifications View in context: https://bugs.webkit.org/attachment.cgi?id=128042&action=review >> Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm:73 >> + it->second.append(webNotification); > > I think you can simplify this to always call add: > > NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<RetainPtr<WebNotification> >()).first(); > addedPair.append(webNotification); Done. >> Source/WebKit/mac/WebView/WebNotification.mm:73 >> +- (id)init > > Please add an extra newline before the method definition. Done.
Anders Carlsson
Comment 13 2012-02-21 15:05:21 PST
Comment on attachment 127341 [details] Bring notifications support to WK1 mac: permission requests View in context: https://bugs.webkit.org/attachment.cgi?id=127341&action=review > Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm:136 > + // execute callback I don't understand this comment. Should the callback be executed or not? :)
Anders Carlsson
Comment 14 2012-02-21 15:13:01 PST
Comment on attachment 127339 [details] Source/WebKit/mac: (Prep work for) Bring notifications support to WK1 mac View in context: https://bugs.webkit.org/attachment.cgi?id=127339&action=review > Source/WebKit/mac/WebView/WebPreferences.h:443 > +/*! > + @method setNotificationsEnabled > + @param flag > +*/ > +- (void)setNotificationsEnabled:(BOOL)flag; > +/*! > + @method notificationsEnabled > + @param flag > +*/ > +- (BOOL)notificationsEnabled; These need to go in WebPreferencesPrivate.h
Jon Lee
Comment 15 2012-02-21 16:00:42 PST
Note You need to log in before you can comment on or make changes to this bug.