OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/embedded_worker_context_client.h" | 5 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 EmbeddedWorkerContextClient::createServiceWorkerProvider() { | 383 EmbeddedWorkerContextClient::createServiceWorkerProvider() { |
384 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 384 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
385 DCHECK(provider_context_); | 385 DCHECK(provider_context_); |
386 | 386 |
387 // Blink is responsible for deleting the returned object. | 387 // Blink is responsible for deleting the returned object. |
388 return new WebServiceWorkerProviderImpl( | 388 return new WebServiceWorkerProviderImpl( |
389 thread_safe_sender(), provider_context_.get()); | 389 thread_safe_sender(), provider_context_.get()); |
390 } | 390 } |
391 | 391 |
392 void EmbeddedWorkerContextClient::postMessageToClient( | 392 void EmbeddedWorkerContextClient::postMessageToClient( |
393 int client_id, | 393 const blink::WebString& uuid, |
394 const blink::WebString& message, | 394 const blink::WebString& message, |
395 blink::WebMessagePortChannelArray* channels) { | 395 blink::WebMessagePortChannelArray* channels) { |
396 DCHECK(script_context_); | 396 DCHECK(script_context_); |
397 script_context_->PostMessageToDocument(client_id, message, | 397 script_context_->PostMessageToClient( |
398 make_scoped_ptr(channels)); | 398 uuid, message, make_scoped_ptr(channels)); |
399 } | 399 } |
400 | 400 |
401 void EmbeddedWorkerContextClient::postMessageToCrossOriginClient( | 401 void EmbeddedWorkerContextClient::postMessageToCrossOriginClient( |
402 const blink::WebCrossOriginServiceWorkerClient& client, | 402 const blink::WebCrossOriginServiceWorkerClient& client, |
403 const blink::WebString& message, | 403 const blink::WebString& message, |
404 blink::WebMessagePortChannelArray* channels) { | 404 blink::WebMessagePortChannelArray* channels) { |
405 DCHECK(script_context_); | 405 DCHECK(script_context_); |
406 script_context_->PostCrossOriginMessageToClient(client, message, | 406 script_context_->PostCrossOriginMessageToClient(client, message, |
407 make_scoped_ptr(channels)); | 407 make_scoped_ptr(channels)); |
408 } | 408 } |
409 | 409 |
410 void EmbeddedWorkerContextClient::focus( | 410 void EmbeddedWorkerContextClient::focus( |
411 int client_id, blink::WebServiceWorkerClientCallbacks* callback) { | 411 const blink::WebString& uuid, |
| 412 blink::WebServiceWorkerClientCallbacks* callback) { |
412 DCHECK(script_context_); | 413 DCHECK(script_context_); |
413 script_context_->FocusClient(client_id, callback); | 414 script_context_->FocusClient(uuid, callback); |
414 } | 415 } |
415 | 416 |
416 void EmbeddedWorkerContextClient::skipWaiting( | 417 void EmbeddedWorkerContextClient::skipWaiting( |
417 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) { | 418 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) { |
418 DCHECK(script_context_); | 419 DCHECK(script_context_); |
419 script_context_->SkipWaiting(callbacks); | 420 script_context_->SkipWaiting(callbacks); |
420 } | 421 } |
421 | 422 |
422 void EmbeddedWorkerContextClient::claim( | 423 void EmbeddedWorkerContextClient::claim( |
423 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { | 424 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 registration->SetWaiting( | 469 registration->SetWaiting( |
469 dispatcher->GetServiceWorker(attrs.waiting, false)); | 470 dispatcher->GetServiceWorker(attrs.waiting, false)); |
470 registration->SetActive( | 471 registration->SetActive( |
471 dispatcher->GetServiceWorker(attrs.active, false)); | 472 dispatcher->GetServiceWorker(attrs.active, false)); |
472 | 473 |
473 script_context_->SetRegistrationInServiceWorkerGlobalScope( | 474 script_context_->SetRegistrationInServiceWorkerGlobalScope( |
474 registration.Pass()); | 475 registration.Pass()); |
475 } | 476 } |
476 | 477 |
477 } // namespace content | 478 } // namespace content |
OLD | NEW |