OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "content/child/notifications/notification_data_conversions.h" | 10 #include "content/child/notifications/notification_data_conversions.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; | 485 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; |
486 if (!client.IsEmpty()) { | 486 if (!client.IsEmpty()) { |
487 DCHECK(client.IsValid()); | 487 DCHECK(client.IsValid()); |
488 web_client.reset(new blink::WebServiceWorkerClientInfo( | 488 web_client.reset(new blink::WebServiceWorkerClientInfo( |
489 ToWebServiceWorkerClientInfo(client))); | 489 ToWebServiceWorkerClientInfo(client))); |
490 } | 490 } |
491 callbacks->onSuccess(web_client.release()); | 491 callbacks->onSuccess(web_client.release()); |
492 pending_client_callbacks_.Remove(request_id); | 492 pending_client_callbacks_.Remove(request_id); |
493 } | 493 } |
494 | 494 |
495 void ServiceWorkerScriptContext::OnOpenWindowError(int request_id) { | 495 void ServiceWorkerScriptContext::OnOpenWindowError( |
| 496 int request_id, |
| 497 const std::string& message) { |
496 TRACE_EVENT0("ServiceWorker", | 498 TRACE_EVENT0("ServiceWorker", |
497 "ServiceWorkerScriptContext::OnOpenWindowError"); | 499 "ServiceWorkerScriptContext::OnOpenWindowError"); |
498 blink::WebServiceWorkerClientCallbacks* callbacks = | 500 blink::WebServiceWorkerClientCallbacks* callbacks = |
499 pending_client_callbacks_.Lookup(request_id); | 501 pending_client_callbacks_.Lookup(request_id); |
500 if (!callbacks) { | 502 if (!callbacks) { |
501 NOTREACHED() << "Got stray response: " << request_id; | 503 NOTREACHED() << "Got stray response: " << request_id; |
502 return; | 504 return; |
503 } | 505 } |
504 scoped_ptr<blink::WebServiceWorkerError> error( | 506 scoped_ptr<blink::WebServiceWorkerError> error( |
505 new blink::WebServiceWorkerError( | 507 new blink::WebServiceWorkerError( |
506 blink::WebServiceWorkerError::ErrorTypeUnknown, | 508 blink::WebServiceWorkerError::ErrorTypeUnknown, |
507 "Something went wrong while trying to open the window.")); | 509 blink::WebString::fromUTF8(message))); |
508 callbacks->onError(error.release()); | 510 callbacks->onError(error.release()); |
509 pending_client_callbacks_.Remove(request_id); | 511 pending_client_callbacks_.Remove(request_id); |
510 } | 512 } |
511 | 513 |
512 void ServiceWorkerScriptContext::OnFocusClientResponse( | 514 void ServiceWorkerScriptContext::OnFocusClientResponse( |
513 int request_id, const ServiceWorkerClientInfo& client) { | 515 int request_id, const ServiceWorkerClientInfo& client) { |
514 TRACE_EVENT0("ServiceWorker", | 516 TRACE_EVENT0("ServiceWorker", |
515 "ServiceWorkerScriptContext::OnFocusClientResponse"); | 517 "ServiceWorkerScriptContext::OnFocusClientResponse"); |
516 blink::WebServiceWorkerClientCallbacks* callback = | 518 blink::WebServiceWorkerClientCallbacks* callback = |
517 pending_client_callbacks_.Lookup(request_id); | 519 pending_client_callbacks_.Lookup(request_id); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 new blink::WebServiceWorkerError(error_type, message)); | 580 new blink::WebServiceWorkerError(error_type, message)); |
579 callbacks->onError(error.release()); | 581 callbacks->onError(error.release()); |
580 pending_claim_clients_callbacks_.Remove(request_id); | 582 pending_claim_clients_callbacks_.Remove(request_id); |
581 } | 583 } |
582 | 584 |
583 void ServiceWorkerScriptContext::OnPing() { | 585 void ServiceWorkerScriptContext::OnPing() { |
584 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); | 586 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); |
585 } | 587 } |
586 | 588 |
587 } // namespace content | 589 } // namespace content |
OLD | NEW |