| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/browser/worker_host/worker_storage_partition.h" | 9 #include "content/browser/worker_host/worker_storage_partition.h" |
| 10 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
| 11 | 11 |
| 12 class ResourceDispatcherHost; | 12 class ResourceDispatcherHost; |
| 13 struct ViewHostMsg_CreateWorker_Params; | 13 struct ViewHostMsg_CreateWorker_Params; |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class MessagePortMessageFilter; | 16 class MessagePortMessageFilter; |
| 17 class ResourceContext; | 17 class ResourceContext; |
| 18 | 18 |
| 19 class WorkerMessageFilter : public BrowserMessageFilter { | 19 class WorkerMessageFilter : public BrowserMessageFilter { |
| 20 public: | 20 public: |
| 21 WorkerMessageFilter(int render_process_id, | 21 WorkerMessageFilter(int render_process_id, |
| 22 ResourceContext* resource_context, | 22 ResourceContext* resource_context, |
| 23 const WorkerStoragePartition& partition, | 23 const WorkerStoragePartition& partition, |
| 24 MessagePortMessageFilter* message_port_filter); | 24 MessagePortMessageFilter* message_port_filter); |
| 25 | 25 |
| 26 // BrowserMessageFilter implementation. | 26 // BrowserMessageFilter implementation. |
| 27 virtual void OnChannelClosing() OVERRIDE; | 27 virtual void OnChannelClosing() OVERRIDE; |
| 28 virtual bool OnMessageReceived(const IPC::Message& message, | 28 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 29 bool* message_was_ok) OVERRIDE; | |
| 30 | 29 |
| 31 int GetNextRoutingID(); | 30 int GetNextRoutingID(); |
| 32 int render_process_id() const { return render_process_id_; } | 31 int render_process_id() const { return render_process_id_; } |
| 33 | 32 |
| 34 MessagePortMessageFilter* message_port_message_filter() const { | 33 MessagePortMessageFilter* message_port_message_filter() const { |
| 35 return message_port_message_filter_; | 34 return message_port_message_filter_; |
| 36 } | 35 } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 virtual ~WorkerMessageFilter(); | 38 virtual ~WorkerMessageFilter(); |
| 40 | 39 |
| 41 // Message handlers. | 40 // Message handlers. |
| 42 void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params, | 41 void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 43 int* route_id); | 42 int* route_id); |
| 44 void OnForwardToWorker(const IPC::Message& message); | 43 void OnForwardToWorker(const IPC::Message& message); |
| 45 void OnDocumentDetached(unsigned long long document_id); | 44 void OnDocumentDetached(unsigned long long document_id); |
| 46 | 45 |
| 47 int render_process_id_; | 46 int render_process_id_; |
| 48 ResourceContext* const resource_context_; | 47 ResourceContext* const resource_context_; |
| 49 WorkerStoragePartition partition_; | 48 WorkerStoragePartition partition_; |
| 50 | 49 |
| 51 MessagePortMessageFilter* message_port_message_filter_; | 50 MessagePortMessageFilter* message_port_message_filter_; |
| 52 DISALLOW_IMPLICIT_CONSTRUCTORS(WorkerMessageFilter); | 51 DISALLOW_IMPLICIT_CONSTRUCTORS(WorkerMessageFilter); |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 } // namespace content | 54 } // namespace content |
| 56 | 55 |
| 57 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ | 56 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ |
| OLD | NEW |