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