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

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.cc

Issue 1636483002: Update the PushEvent to have a nullable PushMessageData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/renderer/service_worker/service_worker_context_client.h" 5 #include "content/renderer/service_worker/service_worker_context_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/child/service_worker/web_service_worker_provider_impl.h" 25 #include "content/child/service_worker/web_service_worker_provider_impl.h"
26 #include "content/child/service_worker/web_service_worker_registration_impl.h" 26 #include "content/child/service_worker/web_service_worker_registration_impl.h"
27 #include "content/child/thread_safe_sender.h" 27 #include "content/child/thread_safe_sender.h"
28 #include "content/child/webmessageportchannel_impl.h" 28 #include "content/child/webmessageportchannel_impl.h"
29 #include "content/common/devtools_messages.h" 29 #include "content/common/devtools_messages.h"
30 #include "content/common/geofencing_messages.h" 30 #include "content/common/geofencing_messages.h"
31 #include "content/common/message_port_messages.h" 31 #include "content/common/message_port_messages.h"
32 #include "content/common/mojo/service_registry_impl.h" 32 #include "content/common/mojo/service_registry_impl.h"
33 #include "content/common/service_worker/embedded_worker_messages.h" 33 #include "content/common/service_worker/embedded_worker_messages.h"
34 #include "content/common/service_worker/service_worker_messages.h" 34 #include "content/common/service_worker/service_worker_messages.h"
35 #include "content/public/common/push_event_payload.h"
35 #include "content/public/common/referrer.h" 36 #include "content/public/common/referrer.h"
36 #include "content/public/renderer/content_renderer_client.h" 37 #include "content/public/renderer/content_renderer_client.h"
37 #include "content/public/renderer/document_state.h" 38 #include "content/public/renderer/document_state.h"
38 #include "content/renderer/background_sync/background_sync_client_impl.h" 39 #include "content/renderer/background_sync/background_sync_client_impl.h"
39 #include "content/renderer/devtools/devtools_agent.h" 40 #include "content/renderer/devtools/devtools_agent.h"
40 #include "content/renderer/render_thread_impl.h" 41 #include "content/renderer/render_thread_impl.h"
41 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" 42 #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
42 #include "content/renderer/service_worker/service_worker_type_util.h" 43 #include "content/renderer/service_worker/service_worker_type_util.h"
43 #include "ipc/ipc_message.h" 44 #include "ipc/ipc_message.h"
44 #include "ipc/ipc_message_macros.h" 45 #include "ipc/ipc_message_macros.h"
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 int action_index) { 754 int action_index) {
754 TRACE_EVENT0("ServiceWorker", 755 TRACE_EVENT0("ServiceWorker",
755 "ServiceWorkerContextClient::OnNotificationClickEvent"); 756 "ServiceWorkerContextClient::OnNotificationClickEvent");
756 proxy_->dispatchNotificationClickEvent( 757 proxy_->dispatchNotificationClickEvent(
757 request_id, 758 request_id,
758 persistent_notification_id, 759 persistent_notification_id,
759 ToWebNotificationData(notification_data), 760 ToWebNotificationData(notification_data),
760 action_index); 761 action_index);
761 } 762 }
762 763
763 void ServiceWorkerContextClient::OnPushEvent(int request_id, 764 void ServiceWorkerContextClient::OnPushEvent(
764 const std::string& data) { 765 int request_id,
766 const content::PushEventPayload& payload) {
Peter Beverloo 2016/01/26 12:35:18 s/content:://
harkness 2016/01/26 14:49:20 Done.
765 TRACE_EVENT0("ServiceWorker", 767 TRACE_EVENT0("ServiceWorker",
766 "ServiceWorkerContextClient::OnPushEvent"); 768 "ServiceWorkerContextClient::OnPushEvent");
767 proxy_->dispatchPushEvent(request_id, blink::WebString::fromUTF8(data)); 769 // Only set data to be a valid string if the payload had decrypted data.
770 blink::WebString data;
771 if (!payload.is_null_)
772 data.assign(blink::WebString::fromUTF8(payload.data_));
773 proxy_->dispatchPushEvent(request_id, data);
768 } 774 }
769 775
770 void ServiceWorkerContextClient::OnGeofencingEvent( 776 void ServiceWorkerContextClient::OnGeofencingEvent(
771 int request_id, 777 int request_id,
772 blink::WebGeofencingEventType event_type, 778 blink::WebGeofencingEventType event_type,
773 const std::string& region_id, 779 const std::string& region_id,
774 const blink::WebCircularGeofencingRegion& region) { 780 const blink::WebCircularGeofencingRegion& region) {
775 TRACE_EVENT0("ServiceWorker", 781 TRACE_EVENT0("ServiceWorker",
776 "ServiceWorkerContextClient::OnGeofencingEvent"); 782 "ServiceWorkerContextClient::OnGeofencingEvent");
777 proxy_->dispatchGeofencingEvent( 783 proxy_->dispatchGeofencingEvent(
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } 993 }
988 994
989 base::WeakPtr<ServiceWorkerContextClient> 995 base::WeakPtr<ServiceWorkerContextClient>
990 ServiceWorkerContextClient::GetWeakPtr() { 996 ServiceWorkerContextClient::GetWeakPtr() {
991 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 997 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
992 DCHECK(context_); 998 DCHECK(context_);
993 return context_->weak_factory.GetWeakPtr(); 999 return context_->weak_factory.GetWeakPtr();
994 } 1000 }
995 1001
996 } // namespace content 1002 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698