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

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

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: comments Created 4 years, 3 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 webRequest.setIsReload(request.is_reload); 828 webRequest.setIsReload(request.is_reload);
829 if (request.fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) { 829 if (request.fetch_type == ServiceWorkerFetchType::FOREIGN_FETCH) {
830 proxy_->dispatchForeignFetchEvent(response_id, event_finish_id, webRequest); 830 proxy_->dispatchForeignFetchEvent(response_id, event_finish_id, webRequest);
831 } else { 831 } else {
832 proxy_->dispatchFetchEvent(response_id, event_finish_id, webRequest); 832 proxy_->dispatchFetchEvent(response_id, event_finish_id, webRequest);
833 } 833 }
834 } 834 }
835 835
836 void ServiceWorkerContextClient::OnNotificationClickEvent( 836 void ServiceWorkerContextClient::OnNotificationClickEvent(
837 int request_id, 837 int request_id,
838 int64_t persistent_notification_id, 838 const std::string& notification_id,
839 const PlatformNotificationData& notification_data, 839 const PlatformNotificationData& notification_data,
840 int action_index) { 840 int action_index) {
841 TRACE_EVENT0("ServiceWorker", 841 TRACE_EVENT0("ServiceWorker",
842 "ServiceWorkerContextClient::OnNotificationClickEvent"); 842 "ServiceWorkerContextClient::OnNotificationClickEvent");
843 proxy_->dispatchNotificationClickEvent( 843 proxy_->dispatchNotificationClickEvent(
844 request_id, 844 request_id, blink::WebString::fromUTF8(notification_id),
845 persistent_notification_id, 845 ToWebNotificationData(notification_data), action_index);
846 ToWebNotificationData(notification_data),
847 action_index);
848 } 846 }
849 847
850 void ServiceWorkerContextClient::OnNotificationCloseEvent( 848 void ServiceWorkerContextClient::OnNotificationCloseEvent(
851 int request_id, 849 int request_id,
852 int64_t persistent_notification_id, 850 const std::string& notification_id,
853 const PlatformNotificationData& notification_data) { 851 const PlatformNotificationData& notification_data) {
854 TRACE_EVENT0("ServiceWorker", 852 TRACE_EVENT0("ServiceWorker",
855 "ServiceWorkerContextClient::OnNotificationCloseEvent"); 853 "ServiceWorkerContextClient::OnNotificationCloseEvent");
856 proxy_->dispatchNotificationCloseEvent( 854 proxy_->dispatchNotificationCloseEvent(
857 request_id, persistent_notification_id, 855 request_id, blink::WebString::fromUTF8(notification_id),
858 ToWebNotificationData(notification_data)); 856 ToWebNotificationData(notification_data));
859 } 857 }
860 858
861 void ServiceWorkerContextClient::OnPushEvent(int request_id, 859 void ServiceWorkerContextClient::OnPushEvent(int request_id,
862 const PushEventPayload& payload) { 860 const PushEventPayload& payload) {
863 TRACE_EVENT0("ServiceWorker", 861 TRACE_EVENT0("ServiceWorker",
864 "ServiceWorkerContextClient::OnPushEvent"); 862 "ServiceWorkerContextClient::OnPushEvent");
865 // Only set data to be a valid string if the payload had decrypted data. 863 // Only set data to be a valid string if the payload had decrypted data.
866 blink::WebString data; 864 blink::WebString data;
867 if (!payload.is_null) 865 if (!payload.is_null)
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 } 1055 }
1058 1056
1059 base::WeakPtr<ServiceWorkerContextClient> 1057 base::WeakPtr<ServiceWorkerContextClient>
1060 ServiceWorkerContextClient::GetWeakPtr() { 1058 ServiceWorkerContextClient::GetWeakPtr() {
1061 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 1059 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
1062 DCHECK(context_); 1060 DCHECK(context_);
1063 return context_->weak_factory.GetWeakPtr(); 1061 return context_->weak_factory.GetWeakPtr();
1064 } 1062 }
1065 1063
1066 } // namespace content 1064 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698