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/browser/shared_worker/shared_worker_message_filter.h" | 5 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
6 | 6 |
7 #include "content/browser/devtools/worker_devtools_manager.h" | 7 #include "content/browser/devtools/worker_devtools_manager.h" |
8 #include "content/browser/message_port_message_filter.h" | 8 #include "content/browser/message_port_message_filter.h" |
9 #include "content/browser/shared_worker/shared_worker_service_impl.h" | 9 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
10 #include "content/common/devtools_messages.h" | 10 #include "content/common/devtools_messages.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 SharedWorkerMessageFilter::~SharedWorkerMessageFilter() { | 35 SharedWorkerMessageFilter::~SharedWorkerMessageFilter() { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
37 } | 37 } |
38 | 38 |
39 void SharedWorkerMessageFilter::OnChannelClosing() { | 39 void SharedWorkerMessageFilter::OnChannelClosing() { |
40 SharedWorkerServiceImpl::GetInstance()->OnSharedWorkerMessageFilterClosing( | 40 SharedWorkerServiceImpl::GetInstance()->OnSharedWorkerMessageFilterClosing( |
41 this); | 41 this); |
42 } | 42 } |
43 | 43 |
44 bool SharedWorkerMessageFilter::OnMessageReceived(const IPC::Message& message, | 44 bool SharedWorkerMessageFilter::OnMessageReceived(const IPC::Message& message) { |
45 bool* message_was_ok) { | |
46 bool handled = true; | 45 bool handled = true; |
47 IPC_BEGIN_MESSAGE_MAP_EX(SharedWorkerMessageFilter, message, *message_was_ok) | 46 IPC_BEGIN_MESSAGE_MAP(SharedWorkerMessageFilter, message) |
48 // Only sent from renderer for now, until we have nested workers. | 47 // Only sent from renderer for now, until we have nested workers. |
49 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWorker, OnCreateWorker) | 48 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWorker, OnCreateWorker) |
50 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker, OnForwardToWorker) | 49 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker, OnForwardToWorker) |
51 // Only sent from renderer. | 50 // Only sent from renderer. |
52 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentDetached, OnDocumentDetached) | 51 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentDetached, OnDocumentDetached) |
53 // Only sent from SharedWorker in renderer. | 52 // Only sent from SharedWorker in renderer. |
54 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, | 53 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, |
55 OnWorkerContextClosed) | 54 OnWorkerContextClosed) |
56 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed, | 55 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed, |
57 OnWorkerContextDestroyed) | 56 OnWorkerContextDestroyed) |
58 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded, | 57 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded, |
59 OnWorkerScriptLoaded) | 58 OnWorkerScriptLoaded) |
60 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed, | 59 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed, |
61 OnWorkerScriptLoadFailed) | 60 OnWorkerScriptLoadFailed) |
62 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected, | 61 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected, |
63 OnWorkerConnected) | 62 OnWorkerConnected) |
64 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) | 63 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) |
65 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) | 64 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) |
66 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 65 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
67 IPC_MESSAGE_UNHANDLED(handled = false) | 66 IPC_MESSAGE_UNHANDLED(handled = false) |
68 IPC_END_MESSAGE_MAP_EX() | 67 IPC_END_MESSAGE_MAP() |
69 return handled; | 68 return handled; |
70 } | 69 } |
71 | 70 |
72 int SharedWorkerMessageFilter::GetNextRoutingID() { | 71 int SharedWorkerMessageFilter::GetNextRoutingID() { |
73 return message_port_message_filter_->GetNextRoutingID(); | 72 return message_port_message_filter_->GetNextRoutingID(); |
74 } | 73 } |
75 | 74 |
76 void SharedWorkerMessageFilter::OnCreateWorker( | 75 void SharedWorkerMessageFilter::OnCreateWorker( |
77 const ViewHostMsg_CreateWorker_Params& params, | 76 const ViewHostMsg_CreateWorker_Params& params, |
78 int* route_id) { | 77 int* route_id) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const base::string16& name, | 157 const base::string16& name, |
159 bool* result) { | 158 bool* result) { |
160 SharedWorkerServiceImpl::GetInstance()->AllowIndexedDB(worker_route_id, | 159 SharedWorkerServiceImpl::GetInstance()->AllowIndexedDB(worker_route_id, |
161 url, | 160 url, |
162 name, | 161 name, |
163 result, | 162 result, |
164 this); | 163 this); |
165 } | 164 } |
166 | 165 |
167 } // namespace content | 166 } // namespace content |
OLD | NEW |