OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "content/public/common/referrer.h" | 35 #include "content/public/common/referrer.h" |
36 #include "content/public/renderer/content_renderer_client.h" | 36 #include "content/public/renderer/content_renderer_client.h" |
37 #include "content/public/renderer/document_state.h" | 37 #include "content/public/renderer/document_state.h" |
38 #include "content/renderer/background_sync/background_sync_client_impl.h" | 38 #include "content/renderer/background_sync/background_sync_client_impl.h" |
39 #include "content/renderer/devtools/devtools_agent.h" | 39 #include "content/renderer/devtools/devtools_agent.h" |
40 #include "content/renderer/render_thread_impl.h" | 40 #include "content/renderer/render_thread_impl.h" |
41 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 41 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
42 #include "content/renderer/service_worker/service_worker_type_util.h" | 42 #include "content/renderer/service_worker/service_worker_type_util.h" |
43 #include "ipc/ipc_message.h" | 43 #include "ipc/ipc_message.h" |
44 #include "ipc/ipc_message_macros.h" | 44 #include "ipc/ipc_message_macros.h" |
| 45 #include "third_party/WebKit/public/platform/URLConversion.h" |
45 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 46 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
46 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 47 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
47 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" | 48 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" |
48 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 49 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
49 #include "third_party/WebKit/public/platform/WebString.h" | 50 #include "third_party/WebKit/public/platform/WebString.h" |
50 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" | 51 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
51 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 52 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
52 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" | 53 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" |
53 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" | 54 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" |
54 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" | 55 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 base::Bind(&CallWorkerContextDestroyedOnMainThread, | 442 base::Bind(&CallWorkerContextDestroyedOnMainThread, |
442 embedded_worker_id_)); | 443 embedded_worker_id_)); |
443 } | 444 } |
444 | 445 |
445 void ServiceWorkerContextClient::reportException( | 446 void ServiceWorkerContextClient::reportException( |
446 const blink::WebString& error_message, | 447 const blink::WebString& error_message, |
447 int line_number, | 448 int line_number, |
448 int column_number, | 449 int column_number, |
449 const blink::WebString& source_url) { | 450 const blink::WebString& source_url) { |
450 Send(new EmbeddedWorkerHostMsg_ReportException( | 451 Send(new EmbeddedWorkerHostMsg_ReportException( |
451 embedded_worker_id_, | 452 embedded_worker_id_, error_message, line_number, column_number, |
452 error_message, | 453 blink::WebStringToGURL(source_url))); |
453 line_number, | |
454 column_number, GURL(source_url))); | |
455 } | 454 } |
456 | 455 |
457 void ServiceWorkerContextClient::reportConsoleMessage( | 456 void ServiceWorkerContextClient::reportConsoleMessage( |
458 int source, | 457 int source, |
459 int level, | 458 int level, |
460 const blink::WebString& message, | 459 const blink::WebString& message, |
461 int line_number, | 460 int line_number, |
462 const blink::WebString& source_url) { | 461 const blink::WebString& source_url) { |
463 EmbeddedWorkerHostMsg_ReportConsoleMessage_Params params; | 462 EmbeddedWorkerHostMsg_ReportConsoleMessage_Params params; |
464 params.source_identifier = source; | 463 params.source_identifier = source; |
465 params.message_level = level; | 464 params.message_level = level; |
466 params.message = message; | 465 params.message = message; |
467 params.line_number = line_number; | 466 params.line_number = line_number; |
468 params.source_url = GURL(source_url); | 467 params.source_url = blink::WebStringToGURL(source_url); |
469 | 468 |
470 Send(new EmbeddedWorkerHostMsg_ReportConsoleMessage( | 469 Send(new EmbeddedWorkerHostMsg_ReportConsoleMessage( |
471 embedded_worker_id_, params)); | 470 embedded_worker_id_, params)); |
472 } | 471 } |
473 | 472 |
474 void ServiceWorkerContextClient::sendDevToolsMessage( | 473 void ServiceWorkerContextClient::sendDevToolsMessage( |
475 int session_id, | 474 int session_id, |
476 int call_id, | 475 int call_id, |
477 const blink::WebString& message, | 476 const blink::WebString& message, |
478 const blink::WebString& state_cookie) { | 477 const blink::WebString& state_cookie) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 } | 986 } |
988 | 987 |
989 base::WeakPtr<ServiceWorkerContextClient> | 988 base::WeakPtr<ServiceWorkerContextClient> |
990 ServiceWorkerContextClient::GetWeakPtr() { | 989 ServiceWorkerContextClient::GetWeakPtr() { |
991 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 990 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
992 DCHECK(context_); | 991 DCHECK(context_); |
993 return context_->weak_factory.GetWeakPtr(); | 992 return context_->weak_factory.GetWeakPtr(); |
994 } | 993 } |
995 | 994 |
996 } // namespace content | 995 } // namespace content |
OLD | NEW |