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

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

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: Addressing comments from patch 7 Created 4 years, 2 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 const FetchCallback& callback) { 860 const FetchCallback& callback) {
861 blink::WebServiceWorkerRequest webRequest; 861 blink::WebServiceWorkerRequest webRequest;
862 TRACE_EVENT0("ServiceWorker", 862 TRACE_EVENT0("ServiceWorker",
863 "ServiceWorkerContextClient::DispatchFetchEvent"); 863 "ServiceWorkerContextClient::DispatchFetchEvent");
864 int event_finish_id = 864 int event_finish_id =
865 context_->fetch_event_callbacks.Add(new FetchCallback(callback)); 865 context_->fetch_event_callbacks.Add(new FetchCallback(callback));
866 866
867 webRequest.setURL(blink::WebURL(request.url)); 867 webRequest.setURL(blink::WebURL(request.url));
868 webRequest.setMethod(blink::WebString::fromUTF8(request.method)); 868 webRequest.setMethod(blink::WebString::fromUTF8(request.method));
869 for (ServiceWorkerHeaderMap::const_iterator it = request.headers.begin(); 869 for (ServiceWorkerHeaderMap::const_iterator it = request.headers.begin();
870 it != request.headers.end(); 870 it != request.headers.end(); ++it) {
871 ++it) {
872 webRequest.setHeader(blink::WebString::fromUTF8(it->first), 871 webRequest.setHeader(blink::WebString::fromUTF8(it->first),
873 blink::WebString::fromUTF8(it->second)); 872 blink::WebString::fromUTF8(it->second));
874 } 873 }
875 if (!request.blob_uuid.empty()) { 874 if (!request.blob_uuid.empty()) {
876 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), 875 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid),
877 request.blob_size); 876 request.blob_size);
878 } 877 }
879 webRequest.setReferrer( 878 webRequest.setReferrer(
880 blink::WebString::fromUTF8(request.referrer.url.spec()), 879 blink::WebString::fromUTF8(request.referrer.url.spec()),
881 request.referrer.policy); 880 request.referrer.policy);
(...skipping 11 matching lines...) Expand all
893 proxy_->dispatchForeignFetchEvent(response_id, event_finish_id, webRequest); 892 proxy_->dispatchForeignFetchEvent(response_id, event_finish_id, webRequest);
894 } else { 893 } else {
895 proxy_->dispatchFetchEvent(response_id, event_finish_id, webRequest); 894 proxy_->dispatchFetchEvent(response_id, event_finish_id, webRequest);
896 } 895 }
897 } 896 }
898 897
899 void ServiceWorkerContextClient::OnNotificationClickEvent( 898 void ServiceWorkerContextClient::OnNotificationClickEvent(
900 int request_id, 899 int request_id,
901 const std::string& notification_id, 900 const std::string& notification_id,
902 const PlatformNotificationData& notification_data, 901 const PlatformNotificationData& notification_data,
903 int action_index) { 902 int action_index,
903 const base::NullableString16& reply) {
904 TRACE_EVENT0("ServiceWorker", 904 TRACE_EVENT0("ServiceWorker",
905 "ServiceWorkerContextClient::OnNotificationClickEvent"); 905 "ServiceWorkerContextClient::OnNotificationClickEvent");
906 proxy_->dispatchNotificationClickEvent( 906 proxy_->dispatchNotificationClickEvent(
907 request_id, blink::WebString::fromUTF8(notification_id), 907 request_id, blink::WebString::fromUTF8(notification_id),
908 ToWebNotificationData(notification_data), action_index); 908 ToWebNotificationData(notification_data), action_index,
909 blink::WebString(reply));
909 } 910 }
910 911
911 void ServiceWorkerContextClient::OnNotificationCloseEvent( 912 void ServiceWorkerContextClient::OnNotificationCloseEvent(
912 int request_id, 913 int request_id,
913 const std::string& notification_id, 914 const std::string& notification_id,
914 const PlatformNotificationData& notification_data) { 915 const PlatformNotificationData& notification_data) {
915 TRACE_EVENT0("ServiceWorker", 916 TRACE_EVENT0("ServiceWorker",
916 "ServiceWorkerContextClient::OnNotificationCloseEvent"); 917 "ServiceWorkerContextClient::OnNotificationCloseEvent");
917 proxy_->dispatchNotificationCloseEvent( 918 proxy_->dispatchNotificationCloseEvent(
918 request_id, blink::WebString::fromUTF8(notification_id), 919 request_id, blink::WebString::fromUTF8(notification_id),
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1119 }
1119 1120
1120 base::WeakPtr<ServiceWorkerContextClient> 1121 base::WeakPtr<ServiceWorkerContextClient>
1121 ServiceWorkerContextClient::GetWeakPtr() { 1122 ServiceWorkerContextClient::GetWeakPtr() {
1122 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 1123 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
1123 DCHECK(context_); 1124 DCHECK(context_);
1124 return context_->weak_factory.GetWeakPtr(); 1125 return context_->weak_factory.GetWeakPtr();
1125 } 1126 }
1126 1127
1127 } // namespace content 1128 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698