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 4d00ff7aca8c7880ce116e9f4568aa5de9a66996..cf24a203ea5723e688997d4f44d0674163d01649 100644 |
--- a/content/renderer/service_worker/service_worker_script_context.cc |
+++ b/content/renderer/service_worker/service_worker_script_context.cc |
@@ -264,9 +264,9 @@ void ServiceWorkerScriptContext::PostCrossOriginMessageToClient( |
} |
void ServiceWorkerScriptContext::FocusClient( |
- int client_id, blink::WebServiceWorkerClientFocusCallback* callback) { |
+ int client_id, blink::WebServiceWorkerClientCallbacks* callback) { |
DCHECK(callback); |
- int request_id = pending_focus_client_callbacks_.Add(callback); |
+ int request_id = pending_client_callbacks_.Add(callback); |
Send(new ServiceWorkerHostMsg_FocusClient( |
GetRoutingID(), request_id, client_id)); |
} |
@@ -500,18 +500,31 @@ void ServiceWorkerScriptContext::OnOpenWindowError(int request_id) { |
pending_client_callbacks_.Remove(request_id); |
} |
-void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id, |
- bool result) { |
+void ServiceWorkerScriptContext::OnFocusClientResponse( |
+ int request_id, const ServiceWorkerClientInfo& client) { |
TRACE_EVENT0("ServiceWorker", |
"ServiceWorkerScriptContext::OnFocusClientResponse"); |
- blink::WebServiceWorkerClientFocusCallback* callback = |
- pending_focus_client_callbacks_.Lookup(request_id); |
+ blink::WebServiceWorkerClientCallbacks* callback = |
+ pending_client_callbacks_.Lookup(request_id); |
if (!callback) { |
NOTREACHED() << "Got stray response: " << request_id; |
return; |
} |
- callback->onSuccess(&result); |
- pending_focus_client_callbacks_.Remove(request_id); |
+ if (!client.IsEmpty()) { |
+ DCHECK(client.IsValid()); |
+ scoped_ptr<blink::WebServiceWorkerClientInfo> web_client ( |
+ new blink::WebServiceWorkerClientInfo( |
+ ToWebServiceWorkerClientInfo(client))); |
+ callback->onSuccess(web_client.release()); |
+ } else { |
+ scoped_ptr<blink::WebServiceWorkerError> error( |
+ new blink::WebServiceWorkerError( |
+ blink::WebServiceWorkerError::ErrorTypeNotFound, |
+ "The WindowClient was not found.")); |
+ callback->onError(error.release()); |
+ } |
+ |
+ pending_client_callbacks_.Remove(request_id); |
} |
void ServiceWorkerScriptContext::OnDidSkipWaiting(int request_id) { |