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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 1186803002: ServiceWorker: Route unregister() through WebServiceWorkerRegistration for refactoring (4) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@route_web_sw_reg_2
Patch Set: rebase Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index 9031354c2cc0ea18788d44a216ed3505778008b5..ab0d96f8fd3e95b1dea291d83023ed6613ad0f34 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -168,8 +168,6 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived(
OnRegisterServiceWorker)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_UpdateServiceWorker,
OnUpdateServiceWorker)
- IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_DeprecatedUnregisterServiceWorker,
- OnDeprecatedUnregisterServiceWorker)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_UnregisterServiceWorker,
OnUnregisterServiceWorker)
IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_GetRegistration,
@@ -426,80 +424,6 @@ void ServiceWorkerDispatcherHost::OnUpdateServiceWorker(int provider_id,
true /* force_bypass_cache */);
}
-void ServiceWorkerDispatcherHost::OnDeprecatedUnregisterServiceWorker(
- int thread_id,
- int request_id,
- int provider_id,
- const GURL& pattern) {
- TRACE_EVENT0("ServiceWorker",
- "ServiceWorkerDispatcherHost::OnUnregisterServiceWorker");
- if (!GetContext()) {
- Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
- thread_id,
- request_id,
- blink::WebServiceWorkerError::ErrorTypeAbort,
- base::ASCIIToUTF16(kShutdownErrorMessage)));
- return;
- }
- if (!pattern.is_valid()) {
- bad_message::ReceivedBadMessage(this, bad_message::SWDH_UNREGISTER_BAD_URL);
- return;
- }
-
- ServiceWorkerProviderHost* provider_host = GetContext()->GetProviderHost(
- render_process_id_, provider_id);
- if (!provider_host) {
- bad_message::ReceivedBadMessage(this, bad_message::SWDH_UNREGISTER_NO_HOST);
- return;
- }
- if (!provider_host->IsContextAlive()) {
- Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
- thread_id,
- request_id,
- blink::WebServiceWorkerError::ErrorTypeAbort,
- base::ASCIIToUTF16(kShutdownErrorMessage)));
- return;
- }
-
- // TODO(ksakamoto): This check can be removed once crbug.com/439697 is fixed.
- if (provider_host->document_url().is_empty()) {
- Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
- thread_id,
- request_id,
- WebServiceWorkerError::ErrorTypeSecurity,
- base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
- return;
- }
-
- if (!CanUnregisterServiceWorker(provider_host->document_url(), pattern)) {
- bad_message::ReceivedBadMessage(this, bad_message::SWDH_UNREGISTER_CANNOT);
- return;
- }
-
- if (!GetContentClient()->browser()->AllowServiceWorker(
- pattern, provider_host->topmost_frame_url(), resource_context_,
- render_process_id_, provider_host->frame_id())) {
- Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
- thread_id,
- request_id,
- WebServiceWorkerError::ErrorTypeUnknown,
- base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
- return;
- }
-
- TRACE_EVENT_ASYNC_BEGIN1(
- "ServiceWorker",
- "ServiceWorkerDispatcherHost::UnregisterServiceWorker",
- request_id,
- "Pattern", pattern.spec());
- GetContext()->UnregisterServiceWorker(
- pattern,
- base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete,
- this,
- thread_id,
- request_id));
-}
-
void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
int thread_id,
int request_id,

Powered by Google App Engine
This is Rietveld 408576698