Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 871013003: Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 blink::WebServiceWorkerClientsCallbacks* callbacks = 405 blink::WebServiceWorkerClientsCallbacks* callbacks =
406 pending_clients_callbacks_.Lookup(request_id); 406 pending_clients_callbacks_.Lookup(request_id);
407 if (!callbacks) { 407 if (!callbacks) {
408 NOTREACHED() << "Got stray response: " << request_id; 408 NOTREACHED() << "Got stray response: " << request_id;
409 return; 409 return;
410 } 410 }
411 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( 411 scoped_ptr<blink::WebServiceWorkerClientsInfo> info(
412 new blink::WebServiceWorkerClientsInfo); 412 new blink::WebServiceWorkerClientsInfo);
413 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients( 413 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients(
414 clients.size()); 414 clients.size());
415 for (size_t i = 0; i < clients.size(); ++i) { 415 for (size_t i = 0; i < clients.size(); ++i)
416 convertedClients[i].clientID = clients[i].client_id; 416 convertedClients[i] = clients[i];
417 convertedClients[i].pageVisibilityState = clients[i].page_visibility_state;
418 convertedClients[i].isFocused = clients[i].is_focused;
419 convertedClients[i].url = clients[i].url;
420 convertedClients[i].frameType =
421 static_cast<blink::WebURLRequest::FrameType>(clients[i].frame_type);
422 }
423 info->clients.swap(convertedClients); 417 info->clients.swap(convertedClients);
424 callbacks->onSuccess(info.release()); 418 callbacks->onSuccess(info.release());
425 pending_clients_callbacks_.Remove(request_id); 419 pending_clients_callbacks_.Remove(request_id);
426 } 420 }
427 421
428 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id, 422 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id,
429 bool result) { 423 bool result) {
430 TRACE_EVENT0("ServiceWorker", 424 TRACE_EVENT0("ServiceWorker",
431 "ServiceWorkerScriptContext::OnFocusClientResponse"); 425 "ServiceWorkerScriptContext::OnFocusClientResponse");
432 blink::WebServiceWorkerClientFocusCallback* callback = 426 blink::WebServiceWorkerClientFocusCallback* callback =
(...skipping 13 matching lines...) Expand all
446 pending_skip_waiting_callbacks_.Lookup(request_id); 440 pending_skip_waiting_callbacks_.Lookup(request_id);
447 if (!callbacks) { 441 if (!callbacks) {
448 NOTREACHED() << "Got stray response: " << request_id; 442 NOTREACHED() << "Got stray response: " << request_id;
449 return; 443 return;
450 } 444 }
451 callbacks->onSuccess(); 445 callbacks->onSuccess();
452 pending_skip_waiting_callbacks_.Remove(request_id); 446 pending_skip_waiting_callbacks_.Remove(request_id);
453 } 447 }
454 448
455 } // namespace content 449 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698