3cc6a6f94dea674b5c5926fdb493df16e3f9e0ec
[platform/framework/web/crosswalk.git] / src / content / common / worker_messages.h
1 // Copyright (c) 2012 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 // Defines messages between the browser and worker process, as well as between
6 // the renderer and worker process.
7
8 // Multiply-included message file, hence no include guard.
9
10 #include <string>
11 #include <utility>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/strings/string16.h"
16 #include "content/common/content_export.h"
17 #include "content/common/content_param_traits.h"
18 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_message_utils.h"
20 #include "url/gurl.h"
21
22 #undef IPC_MESSAGE_EXPORT
23 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
24 #define IPC_MESSAGE_START WorkerMsgStart
25
26 // Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
27 // which has too many data parameters to be reasonably put in a predefined
28 // IPC message. The data members directly correspond to parameters of
29 // WebWorkerClient::postConsoleMessageToWorkerObject()
30 IPC_STRUCT_BEGIN(WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
31   IPC_STRUCT_MEMBER(int, source_identifier)
32   IPC_STRUCT_MEMBER(int, message_type)
33   IPC_STRUCT_MEMBER(int, message_level)
34   IPC_STRUCT_MEMBER(base::string16, message)
35   IPC_STRUCT_MEMBER(int, line_number)
36   IPC_STRUCT_MEMBER(base::string16, source_url)
37 IPC_STRUCT_END()
38
39 // Parameter structure for WorkerProcessMsg_CreateWorker.
40 IPC_STRUCT_BEGIN(WorkerProcessMsg_CreateWorker_Params)
41   IPC_STRUCT_MEMBER(GURL, url)
42   IPC_STRUCT_MEMBER(base::string16, name)
43   IPC_STRUCT_MEMBER(base::string16, content_security_policy)
44   IPC_STRUCT_MEMBER(blink::WebContentSecurityPolicyType, security_policy_type)
45   IPC_STRUCT_MEMBER(int, route_id)
46 IPC_STRUCT_END()
47
48 //-----------------------------------------------------------------------------
49 // WorkerProcess messages
50 // These are messages sent from the browser to the worker process.
51 IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker,
52                      WorkerProcessMsg_CreateWorker_Params)
53
54 //-----------------------------------------------------------------------------
55 // WorkerProcessHost messages
56 // These are messages sent from the worker process to the browser process.
57
58 // Sent by the worker process to check whether access to web databases is
59 // allowed.
60 IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase,
61                             int /* worker_route_id */,
62                             GURL /* origin url */,
63                             base::string16 /* database name */,
64                             base::string16 /* database display name */,
65                             unsigned long /* estimated size */,
66                             bool /* result */)
67
68 // Sent by the worker process to check whether access to file system is allowed.
69 IPC_SYNC_MESSAGE_CONTROL2_1(WorkerProcessHostMsg_AllowFileSystem,
70                             int /* worker_route_id */,
71                             GURL /* origin url */,
72                             bool /* result */)
73
74 // Sent by the worker process to check whether access to IndexedDB is allowed.
75 IPC_SYNC_MESSAGE_CONTROL3_1(WorkerProcessHostMsg_AllowIndexedDB,
76                             int /* worker_route_id */,
77                             GURL /* origin url */,
78                             base::string16 /* database name */,
79                             bool /* result */)
80
81 // Sent by the worker process to request being killed.
82 IPC_SYNC_MESSAGE_CONTROL0_0(WorkerProcessHostMsg_ForceKillWorker)
83
84
85 //-----------------------------------------------------------------------------
86 // Worker messages
87 // These are messages sent from the renderer process to the worker process.
88 IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext)
89
90 IPC_MESSAGE_ROUTED2(WorkerMsg_Connect,
91                     int /* sent_message_port_id */,
92                     int /* routing_id */)
93
94 IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed)
95
96
97 //-----------------------------------------------------------------------------
98 // WorkerHost messages
99 // These are messages sent from the worker process to the renderer process.
100 // WorkerMsg_PostMessage is also sent here.
101 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed,
102                      int /* worker_route_id */)
103
104 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextDestroyed,
105                      int /* worker_route_id */)
106
107 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoaded,
108                      int /* worker_route_id */)
109
110 IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerScriptLoadFailed,
111                      int /* worker_route_id */)
112
113 IPC_MESSAGE_CONTROL2(WorkerHostMsg_WorkerConnected,
114                      int /* message_port_id */,
115                      int /* worker_route_id */)