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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trivial rebase Created 4 years, 10 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { 139 {
140 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope( ), webChannels); 140 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope( ), webChannels);
141 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 141 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
142 workerGlobalScope()->dispatchEvent(MessageEvent::create(ports, value)); 142 workerGlobalScope()->dispatchEvent(MessageEvent::create(ports, value));
143 } 143 }
144 144
145 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex) 145 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex)
146 { 146 {
147 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClick, eventID); 147 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClick, eventID);
148 NotificationEventInit eventInit; 148 NotificationEventInit eventInit;
149 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica tionID, data)); 149 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica tionID, data, true /* showing */));
150 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) 150 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size()))
151 eventInit.setAction(data.actions[actionIndex].action); 151 eventInit.setAction(data.actions[actionIndex].action);
152 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no tificationclick, eventInit, observer)); 152 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no tificationclick, eventInit, observer));
153 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); 153 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
154 } 154 }
155 155
156 void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID, int64_t notificationID, const WebNotificationData& data)
157 {
158 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClose, eventID);
159 NotificationEventInit eventInit;
160 eventInit.setAction(WTF::String());
Peter Beverloo 2016/01/28 16:14:23 Yes, a comment would be useful. In-line would be
Nina 2016/02/01 17:59:06 Done.
161 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica tionID, data, false /* showing */));
162 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no tificationclose, eventInit, observer));
163 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
164 }
165
156 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri ng& data) 166 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri ng& data)
157 { 167 {
158 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Push, eventID); 168 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Push, eventID);
159 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push MessageData::create(data), observer)); 169 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push MessageData::create(data), observer));
160 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); 170 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
161 } 171 }
162 172
163 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID) 173 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString& origin, WebServicePortID portID)
164 { 174 {
165 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback s); 175 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback s);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return *m_document; 279 return *m_document;
270 } 280 }
271 281
272 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st 282 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st
273 { 283 {
274 ASSERT(m_workerGlobalScope); 284 ASSERT(m_workerGlobalScope);
275 return m_workerGlobalScope; 285 return m_workerGlobalScope;
276 } 286 }
277 287
278 } // namespace blink 288 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698