| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_ | |
| 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_ | |
| 7 | |
| 8 #include "content/browser/worker_host/worker_storage_partition.h" | |
| 9 #include "content/public/browser/browser_message_filter.h" | |
| 10 | |
| 11 class GURL; | |
| 12 struct ViewHostMsg_CreateWorker_Params; | |
| 13 | |
| 14 namespace content { | |
| 15 class MessagePortMessageFilter; | |
| 16 class ResourceContext; | |
| 17 | |
| 18 // If "enable-embedded-shared-worker" is set this class will be used instead of | |
| 19 // WorkerMessageFilter. | |
| 20 class SharedWorkerMessageFilter : public BrowserMessageFilter { | |
| 21 public: | |
| 22 SharedWorkerMessageFilter(int render_process_id, | |
| 23 ResourceContext* resource_context, | |
| 24 const WorkerStoragePartition& partition, | |
| 25 MessagePortMessageFilter* message_port_filter); | |
| 26 | |
| 27 // BrowserMessageFilter implementation. | |
| 28 virtual void OnChannelClosing() OVERRIDE; | |
| 29 virtual bool OnMessageReceived(const IPC::Message& message, | |
| 30 bool* message_was_ok) OVERRIDE; | |
| 31 | |
| 32 int GetNextRoutingID(); | |
| 33 int render_process_id() const { return render_process_id_; } | |
| 34 | |
| 35 MessagePortMessageFilter* message_port_message_filter() const { | |
| 36 return message_port_message_filter_; | |
| 37 } | |
| 38 | |
| 39 private: | |
| 40 virtual ~SharedWorkerMessageFilter(); | |
| 41 | |
| 42 // Message handlers. | |
| 43 void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params, | |
| 44 int* route_id); | |
| 45 void OnForwardToWorker(const IPC::Message& message); | |
| 46 void OnDocumentDetached(unsigned long long document_id); | |
| 47 void OnWorkerContextClosed(int worker_route_id); | |
| 48 void OnWorkerContextDestroyed(int worker_route_id); | |
| 49 void OnWorkerScriptLoaded(int worker_route_id); | |
| 50 void OnWorkerScriptLoadFailed(int worker_route_id); | |
| 51 void OnWorkerConnected(int message_port_id, int worker_route_id); | |
| 52 void OnAllowDatabase(int worker_route_id, | |
| 53 const GURL& url, | |
| 54 const base::string16& name, | |
| 55 const base::string16& display_name, | |
| 56 unsigned long estimated_size, | |
| 57 bool* result); | |
| 58 void OnAllowFileSystem(int worker_route_id, | |
| 59 const GURL& url, | |
| 60 bool* result); | |
| 61 void OnAllowIndexedDB(int worker_route_id, | |
| 62 const GURL& url, | |
| 63 const base::string16& name, | |
| 64 bool* result); | |
| 65 | |
| 66 const int render_process_id_; | |
| 67 ResourceContext* const resource_context_; | |
| 68 const WorkerStoragePartition partition_; | |
| 69 MessagePortMessageFilter* const message_port_message_filter_; | |
| 70 | |
| 71 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedWorkerMessageFilter); | |
| 72 }; | |
| 73 | |
| 74 } // namespace content | |
| 75 | |
| 76 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_ | |
| OLD | NEW |