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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/child/notifications/notification_data_conversions.h" | 10 #include "content/child/notifications/notification_data_conversions.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 blink::WebServiceWorkerClientsCallbacks* callbacks = | 411 blink::WebServiceWorkerClientsCallbacks* callbacks = |
412 pending_clients_callbacks_.Lookup(request_id); | 412 pending_clients_callbacks_.Lookup(request_id); |
413 if (!callbacks) { | 413 if (!callbacks) { |
414 NOTREACHED() << "Got stray response: " << request_id; | 414 NOTREACHED() << "Got stray response: " << request_id; |
415 return; | 415 return; |
416 } | 416 } |
417 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( | 417 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( |
418 new blink::WebServiceWorkerClientsInfo); | 418 new blink::WebServiceWorkerClientsInfo); |
419 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients( | 419 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients( |
420 clients.size()); | 420 clients.size()); |
421 for (size_t i = 0; i < clients.size(); ++i) { | 421 for (size_t i = 0; i < clients.size(); ++i) |
422 convertedClients[i].clientID = clients[i].client_id; | 422 convertedClients[i] = clients[i]; |
423 convertedClients[i].pageVisibilityState = clients[i].page_visibility_state; | |
424 convertedClients[i].isFocused = clients[i].is_focused; | |
425 convertedClients[i].url = clients[i].url; | |
426 convertedClients[i].frameType = | |
427 static_cast<blink::WebURLRequest::FrameType>(clients[i].frame_type); | |
428 } | |
429 info->clients.swap(convertedClients); | 423 info->clients.swap(convertedClients); |
430 callbacks->onSuccess(info.release()); | 424 callbacks->onSuccess(info.release()); |
431 pending_clients_callbacks_.Remove(request_id); | 425 pending_clients_callbacks_.Remove(request_id); |
432 } | 426 } |
433 | 427 |
434 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id, | 428 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id, |
435 bool result) { | 429 bool result) { |
436 TRACE_EVENT0("ServiceWorker", | 430 TRACE_EVENT0("ServiceWorker", |
437 "ServiceWorkerScriptContext::OnFocusClientResponse"); | 431 "ServiceWorkerScriptContext::OnFocusClientResponse"); |
438 blink::WebServiceWorkerClientFocusCallback* callback = | 432 blink::WebServiceWorkerClientFocusCallback* callback = |
(...skipping 13 matching lines...) Expand all Loading... |
452 pending_skip_waiting_callbacks_.Lookup(request_id); | 446 pending_skip_waiting_callbacks_.Lookup(request_id); |
453 if (!callbacks) { | 447 if (!callbacks) { |
454 NOTREACHED() << "Got stray response: " << request_id; | 448 NOTREACHED() << "Got stray response: " << request_id; |
455 return; | 449 return; |
456 } | 450 } |
457 callbacks->onSuccess(); | 451 callbacks->onSuccess(); |
458 pending_skip_waiting_callbacks_.Remove(request_id); | 452 pending_skip_waiting_callbacks_.Remove(request_id); |
459 } | 453 } |
460 | 454 |
461 } // namespace content | 455 } // namespace content |
OLD | NEW |