Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: content/browser/shared_worker/shared_worker_message_filter.h

Issue 166273002: Add SharedWorkerMessageFilter for the embedded SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated kinuko's comments. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_
7 7
8 #include "base/callback.h"
9 #include "content/browser/worker_host/worker_storage_partition.h" 8 #include "content/browser/worker_host/worker_storage_partition.h"
10 #include "content/public/browser/browser_message_filter.h" 9 #include "content/public/browser/browser_message_filter.h"
11 10
12 class ResourceDispatcherHost; 11 class GURL;
13 struct ViewHostMsg_CreateWorker_Params; 12 struct ViewHostMsg_CreateWorker_Params;
14 13
15 namespace content { 14 namespace content {
16 class MessagePortMessageFilter; 15 class MessagePortMessageFilter;
17 class ResourceContext; 16 class ResourceContext;
18 17
19 class WorkerMessageFilter : public BrowserMessageFilter { 18 // If "enable-embedded-shared-worker" is set this class will be used instead of
19 // WorkerMessageFilter.
20 class SharedWorkerMessageFilter : public BrowserMessageFilter {
20 public: 21 public:
21 WorkerMessageFilter(int render_process_id, 22 SharedWorkerMessageFilter(int render_process_id,
22 ResourceContext* resource_context, 23 ResourceContext* resource_context,
23 const WorkerStoragePartition& partition, 24 const WorkerStoragePartition& partition,
24 MessagePortMessageFilter* message_port_filter); 25 MessagePortMessageFilter* message_port_filter);
25 26
26 // BrowserMessageFilter implementation. 27 // BrowserMessageFilter implementation.
27 virtual void OnChannelClosing() OVERRIDE; 28 virtual void OnChannelClosing() OVERRIDE;
28 virtual bool OnMessageReceived(const IPC::Message& message, 29 virtual bool OnMessageReceived(const IPC::Message& message,
29 bool* message_was_ok) OVERRIDE; 30 bool* message_was_ok) OVERRIDE;
30 31
31 int GetNextRoutingID(); 32 int GetNextRoutingID();
32 int render_process_id() const { return render_process_id_; } 33 int render_process_id() const { return render_process_id_; }
33 34
34 MessagePortMessageFilter* message_port_message_filter() const { 35 MessagePortMessageFilter* message_port_message_filter() const {
35 return message_port_message_filter_; 36 return message_port_message_filter_;
36 } 37 }
37 38
38 private: 39 private:
39 virtual ~WorkerMessageFilter(); 40 virtual ~SharedWorkerMessageFilter();
40 41
41 // Message handlers. 42 // Message handlers.
42 void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params, 43 void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params,
43 int* route_id); 44 int* route_id);
44 void OnForwardToWorker(const IPC::Message& message); 45 void OnForwardToWorker(const IPC::Message& message);
45 void OnDocumentDetached(unsigned long long document_id); 46 void OnDocumentDetached(unsigned long long document_id);
46 void OnCreateMessagePort(int* route_id, int* message_port_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);
47 65
48 int render_process_id_; 66 const int render_process_id_;
49 ResourceContext* const resource_context_; 67 ResourceContext* const resource_context_;
50 WorkerStoragePartition partition_; 68 const WorkerStoragePartition partition_;
69 MessagePortMessageFilter* const message_port_message_filter_;
51 70
52 MessagePortMessageFilter* message_port_message_filter_; 71 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedWorkerMessageFilter);
53 DISALLOW_IMPLICIT_CONSTRUCTORS(WorkerMessageFilter);
54 }; 72 };
55 73
56 } // namespace content 74 } // namespace content
57 75
58 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_MESSAGE_FILTER_H_ 76 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698