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

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

Issue 1264403002: Test that NotificationEvent.action is set correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@click_actions1
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels) 127 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag e, const WebMessagePortChannelArray& webChannels)
128 { 128 {
129 ASSERT(m_workerGlobalScope); 129 ASSERT(m_workerGlobalScope);
130 130
131 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels); 131 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels);
132 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 132 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
133 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports, value)); 133 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports, value));
134 } 134 }
135 135
136 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data)
137 {
138 dispatchNotificationClickEvent(eventID, notificationID, data, -1 /* actionIn dex */);
139 }
140
141 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex) 136 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex)
142 { 137 {
143 ASSERT(m_workerGlobalScope); 138 ASSERT(m_workerGlobalScope);
144 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::NotificationClick, eventID); 139 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::NotificationClick, eventID);
145 NotificationEventInit eventInit; 140 NotificationEventInit eventInit;
146 eventInit.setNotification(Notification::create(m_workerGlobalScope, notifica tionID, data)); 141 eventInit.setNotification(Notification::create(m_workerGlobalScope, notifica tionID, data));
147 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) 142 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size()))
148 eventInit.setAction(data.actions[actionIndex].action); 143 eventInit.setAction(data.actions[actionIndex].action);
149 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no tificationclick, eventInit, observer)); 144 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no tificationclick, eventInit, observer));
150 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); 145 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 229
235 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 230 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
236 : m_embeddedWorker(embeddedWorker) 231 : m_embeddedWorker(embeddedWorker)
237 , m_document(document) 232 , m_document(document)
238 , m_client(client) 233 , m_client(client)
239 , m_workerGlobalScope(0) 234 , m_workerGlobalScope(0)
240 { 235 {
241 } 236 }
242 237
243 } // namespace blink 238 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/web/WebServiceWorkerContextProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698