Chromium Code Reviews| Index: content/child/service_worker/service_worker_dispatcher.cc |
| diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc |
| index 7e38a3efd8e6f8a411de0fcc08fb688bc54b7b34..3927a2eab87281b130b3dc18451346419b579b1c 100644 |
| --- a/content/child/service_worker/service_worker_dispatcher.cc |
| +++ b/content/child/service_worker/service_worker_dispatcher.cc |
| @@ -18,6 +18,7 @@ |
| #include "content/child/webmessageportchannel_impl.h" |
| #include "content/common/service_worker/service_worker_messages.h" |
| #include "content/public/common/url_utils.h" |
| +#include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" |
| #include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h" |
| #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| @@ -79,6 +80,8 @@ void ServiceWorkerDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| OnSetControllerServiceWorker) |
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_MessageToDocument, |
| OnPostMessage) |
| + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_GetClientInfo, |
| + OnGetClientInfo) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| DCHECK(handled) << "Unhandled message:" << msg.type(); |
| @@ -688,6 +691,28 @@ void ServiceWorkerDispatcher::OnPostMessage( |
| found->second->dispatchMessageEvent(message, ports); |
| } |
| +void ServiceWorkerDispatcher::OnGetClientInfo(int thread_id, |
| + int embedded_worker_id, |
| + int request_id, |
| + int provider_id) { |
| + blink::WebServiceWorkerClientInfo info; |
| + ScriptClientMap::iterator found = script_clients_.find(provider_id); |
| + if (found != script_clients_.end() && found->second->getClientInfo(&info)) { |
| + ServiceWorkerClientInfo result; |
| + result.client_id = info.clientID; |
| + result.visibility_state = info.visibilityState.utf8(); |
| + result.is_focused = info.isFocused; |
| + result.url = info.url; |
| + result.frame_type = static_cast<RequestContextFrameType>(info.frameType); |
|
mlamouri (slow - plz ping)
2014/12/08 10:56:28
Now that ServiceWorkerProviderHost is aware of the
Kunihiko Sakamoto
2014/12/09 02:05:43
We have URL in browser process, and it'd be easy t
dcheng
2014/12/10 06:37:52
re focused:
We definitely don't have enough browse
Kunihiko Sakamoto
2014/12/10 09:10:47
Thanks for the info. Added a TODO comment so that
|
| + |
| + thread_safe_sender_->Send(new ServiceWorkerHostMsg_GetClientInfoSuccess( |
| + embedded_worker_id, request_id, result)); |
| + } else { |
| + thread_safe_sender_->Send(new ServiceWorkerHostMsg_GetClientInfoError( |
| + embedded_worker_id, request_id)); |
| + } |
| +} |
| + |
| void ServiceWorkerDispatcher::AddServiceWorker( |
| int handle_id, WebServiceWorkerImpl* worker) { |
| DCHECK(!ContainsKey(service_workers_, handle_id)); |