| Index: content/renderer/service_worker/service_worker_script_context.cc
|
| diff --git a/content/renderer/service_worker/service_worker_script_context.cc b/content/renderer/service_worker/service_worker_script_context.cc
|
| index dd0d523b83710e5580cdf55f0dd1a68480c26eac..18f3458f6872d375341d1cc5d43389af3a2454a5 100644
|
| --- a/content/renderer/service_worker/service_worker_script_context.cc
|
| +++ b/content/renderer/service_worker/service_worker_script_context.cc
|
| @@ -104,6 +104,8 @@ void ServiceWorkerScriptContext::OnMessageReceived(
|
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse,
|
| OnFocusClientResponse)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting)
|
| + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients)
|
| + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -236,6 +238,13 @@ void ServiceWorkerScriptContext::FocusClient(
|
| GetRoutingID(), request_id, client_id));
|
| }
|
|
|
| +void ServiceWorkerScriptContext::ClaimClients(
|
| + blink::WebServiceWorkerClientsClaimCallbacks* callbacks) {
|
| + DCHECK(callbacks);
|
| + int request_id = pending_claim_clients_callbacks_.Add(callbacks);
|
| + Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id));
|
| +}
|
| +
|
| void ServiceWorkerScriptContext::SkipWaiting(
|
| blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) {
|
| DCHECK(callbacks);
|
| @@ -452,4 +461,35 @@ void ServiceWorkerScriptContext::OnDidSkipWaiting(int request_id) {
|
| pending_skip_waiting_callbacks_.Remove(request_id);
|
| }
|
|
|
| +void ServiceWorkerScriptContext::OnDidClaimClients(int request_id) {
|
| + TRACE_EVENT0("ServiceWorker",
|
| + "ServiceWorkerScriptContext::OnDidClaimClients");
|
| + blink::WebServiceWorkerClientsClaimCallbacks* callbacks =
|
| + pending_claim_clients_callbacks_.Lookup(request_id);
|
| + if (!callbacks) {
|
| + NOTREACHED() << "Got stray response: " << request_id;
|
| + return;
|
| + }
|
| + callbacks->onSuccess();
|
| + pending_claim_clients_callbacks_.Remove(request_id);
|
| +}
|
| +
|
| +void ServiceWorkerScriptContext::OnClaimClientsError(
|
| + int request_id,
|
| + blink::WebServiceWorkerError::ErrorType error_type,
|
| + const base::string16& message) {
|
| + TRACE_EVENT0("ServiceWorker",
|
| + "ServiceWorkerScriptContext::OnClaimClientsError");
|
| + blink::WebServiceWorkerClientsClaimCallbacks* callbacks =
|
| + pending_claim_clients_callbacks_.Lookup(request_id);
|
| + if (!callbacks) {
|
| + NOTREACHED() << "Got stray response: " << request_id;
|
| + return;
|
| + }
|
| + scoped_ptr<blink::WebServiceWorkerError> error(
|
| + new blink::WebServiceWorkerError(error_type, message));
|
| + callbacks->onError(error.release());
|
| + pending_claim_clients_callbacks_.Remove(request_id);
|
| +}
|
| +
|
| } // namespace content
|
|
|