OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 #include "content/renderer/render_thread_impl.h" | 41 #include "content/renderer/render_thread_impl.h" |
42 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 42 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
43 #include "content/renderer/service_worker/service_worker_type_util.h" | 43 #include "content/renderer/service_worker/service_worker_type_util.h" |
44 #include "ipc/ipc_message.h" | 44 #include "ipc/ipc_message.h" |
45 #include "ipc/ipc_message_macros.h" | 45 #include "ipc/ipc_message_macros.h" |
46 #include "third_party/WebKit/public/platform/URLConversion.h" | 46 #include "third_party/WebKit/public/platform/URLConversion.h" |
47 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 47 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
48 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 48 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
49 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" | 49 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" |
50 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 50 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 51 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
51 #include "third_party/WebKit/public/platform/WebString.h" | 52 #include "third_party/WebKit/public/platform/WebString.h" |
52 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" | 53 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
53 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 54 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
54 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" | 55 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" |
55 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" | 56 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" |
56 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" | 57 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" |
57 #include "third_party/WebKit/public/web/WebDataSource.h" | 58 #include "third_party/WebKit/public/web/WebDataSource.h" |
58 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextClient.h" | 59 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextClient.h" |
59 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" | 60 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" |
60 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerNe
tworkProvider.h" | 61 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerNe
tworkProvider.h" |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } | 667 } |
667 | 668 |
668 void ServiceWorkerContextClient::claim( | 669 void ServiceWorkerContextClient::claim( |
669 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { | 670 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { |
670 DCHECK(callbacks); | 671 DCHECK(callbacks); |
671 int request_id = context_->claim_clients_callbacks.Add(callbacks); | 672 int request_id = context_->claim_clients_callbacks.Add(callbacks); |
672 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); | 673 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); |
673 } | 674 } |
674 | 675 |
675 void ServiceWorkerContextClient::registerForeignFetchScopes( | 676 void ServiceWorkerContextClient::registerForeignFetchScopes( |
676 const blink::WebVector<blink::WebURL>& sub_scopes) { | 677 const blink::WebVector<blink::WebURL>& sub_scopes, |
| 678 const blink::WebVector<blink::WebSecurityOrigin>& origins) { |
677 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( | 679 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( |
678 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()))); | 680 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()), |
| 681 std::vector<url::Origin>(origins.begin(), origins.end()))); |
679 } | 682 } |
680 | 683 |
681 void ServiceWorkerContextClient::DispatchSyncEvent( | 684 void ServiceWorkerContextClient::DispatchSyncEvent( |
682 const blink::WebSyncRegistration& registration, | 685 const blink::WebSyncRegistration& registration, |
683 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, | 686 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, |
684 const SyncCallback& callback) { | 687 const SyncCallback& callback) { |
685 TRACE_EVENT0("ServiceWorker", | 688 TRACE_EVENT0("ServiceWorker", |
686 "ServiceWorkerContextClient::DispatchSyncEvent"); | 689 "ServiceWorkerContextClient::DispatchSyncEvent"); |
687 int request_id = | 690 int request_id = |
688 context_->sync_event_callbacks.Add(new SyncCallback(callback)); | 691 context_->sync_event_callbacks.Add(new SyncCallback(callback)); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 } | 1040 } |
1038 | 1041 |
1039 base::WeakPtr<ServiceWorkerContextClient> | 1042 base::WeakPtr<ServiceWorkerContextClient> |
1040 ServiceWorkerContextClient::GetWeakPtr() { | 1043 ServiceWorkerContextClient::GetWeakPtr() { |
1041 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1044 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1042 DCHECK(context_); | 1045 DCHECK(context_); |
1043 return context_->weak_factory.GetWeakPtr(); | 1046 return context_->weak_factory.GetWeakPtr(); |
1044 } | 1047 } |
1045 | 1048 |
1046 } // namespace content | 1049 } // namespace content |
OLD | NEW |