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
3// found in the LICENSE file.
4
5// Multiply-included message file, hence no include guard.
6
7#include "ipc/ipc_message_macros.h"
8#include "webkit/common/appcache/appcache_interfaces.h"
9
10#define IPC_MESSAGE_START AppCacheMsgStart
11
12IPC_ENUM_TRAITS_MAX_VALUE(appcache::AppCacheEventID,
13                          appcache::APPCACHE_EVENT_ID_LAST)
14IPC_ENUM_TRAITS_MAX_VALUE(appcache::AppCacheStatus,
15                          appcache::APPCACHE_STATUS_LAST)
16IPC_ENUM_TRAITS_MAX_VALUE(appcache::AppCacheErrorReason,
17    appcache::APPCACHE_ERROR_REASON_LAST)
18
19IPC_STRUCT_TRAITS_BEGIN(appcache::AppCacheInfo)
20  IPC_STRUCT_TRAITS_MEMBER(manifest_url)
21  IPC_STRUCT_TRAITS_MEMBER(creation_time)
22  IPC_STRUCT_TRAITS_MEMBER(last_update_time)
23  IPC_STRUCT_TRAITS_MEMBER(last_access_time)
24  IPC_STRUCT_TRAITS_MEMBER(cache_id)
25  IPC_STRUCT_TRAITS_MEMBER(group_id)
26  IPC_STRUCT_TRAITS_MEMBER(status)
27  IPC_STRUCT_TRAITS_MEMBER(size)
28  IPC_STRUCT_TRAITS_MEMBER(is_complete)
29IPC_STRUCT_TRAITS_END()
30
31IPC_STRUCT_TRAITS_BEGIN(appcache::AppCacheResourceInfo)
32  IPC_STRUCT_TRAITS_MEMBER(url)
33  IPC_STRUCT_TRAITS_MEMBER(size)
34  IPC_STRUCT_TRAITS_MEMBER(is_master)
35  IPC_STRUCT_TRAITS_MEMBER(is_manifest)
36  IPC_STRUCT_TRAITS_MEMBER(is_fallback)
37  IPC_STRUCT_TRAITS_MEMBER(is_foreign)
38  IPC_STRUCT_TRAITS_MEMBER(is_explicit)
39IPC_STRUCT_TRAITS_END()
40
41IPC_STRUCT_TRAITS_BEGIN(appcache::AppCacheErrorDetails)
42IPC_STRUCT_TRAITS_MEMBER(message)
43IPC_STRUCT_TRAITS_MEMBER(reason)
44IPC_STRUCT_TRAITS_MEMBER(url)
45IPC_STRUCT_TRAITS_MEMBER(status)
46IPC_STRUCT_TRAITS_MEMBER(is_cross_origin)
47IPC_STRUCT_TRAITS_END()
48
49// AppCache messages sent from the child process to the browser.
50
51// Informs the browser of a new appcache host.
52IPC_MESSAGE_CONTROL1(AppCacheHostMsg_RegisterHost,
53                     int /* host_id */)
54
55// Informs the browser of an appcache host being destroyed.
56IPC_MESSAGE_CONTROL1(AppCacheHostMsg_UnregisterHost,
57                     int /* host_id */)
58
59// Informs the browser of which host caused another to be created.
60// This can influence which appcache should be utilized for the main
61// resource load into the newly created host, so it should be sent
62// prior to the main resource request being initiated.
63IPC_MESSAGE_CONTROL2(AppCacheHostMsg_SetSpawningHostId,
64                     int /* host_id */,
65                     int /* spawning_host_id */)
66
67// Initiates the cache selection algorithm for the given host.
68// This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected
69// message will be sent in response.
70// 'host_id' indentifies a specific document or worker
71// 'document_url' the url of the main resource
72// 'appcache_document_was_loaded_from' the id of the appcache the main
73//     resource was loaded from or kAppCacheNoCacheId
74// 'opt_manifest_url' the manifest url specified in the <html> tag if any
75IPC_MESSAGE_CONTROL4(AppCacheHostMsg_SelectCache,
76                     int /* host_id */,
77                     GURL  /* document_url */,
78                     int64 /* appcache_document_was_loaded_from */,
79                     GURL  /* opt_manifest_url */)
80
81// Initiates worker specific cache selection algorithm for the given host.
82IPC_MESSAGE_CONTROL3(AppCacheHostMsg_SelectCacheForWorker,
83                     int /* host_id */,
84                     int /* parent_process_id */,
85                     int /* parent_host_id */)
86IPC_MESSAGE_CONTROL2(AppCacheHostMsg_SelectCacheForSharedWorker,
87                     int /* host_id */,
88                     int64 /* appcache_id */)
89
90// Informs the browser of a 'foreign' entry in an appcache.
91IPC_MESSAGE_CONTROL3(AppCacheHostMsg_MarkAsForeignEntry,
92                     int /* host_id */,
93                     GURL  /* document_url */,
94                     int64 /* appcache_document_was_loaded_from */)
95
96// Returns the status of the appcache associated with host_id.
97IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_GetStatus,
98                            int /* host_id */,
99                            appcache::AppCacheStatus)
100
101// Initiates an update of the appcache associated with host_id.
102IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_StartUpdate,
103                            int /* host_id */,
104                            bool /* success */)
105
106// Swaps a new pending appcache, if there is one, into use for host_id.
107IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_SwapCache,
108                            int /* host_id */,
109                            bool /* success */)
110
111// Gets resource list from appcache synchronously.
112IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_GetResourceList,
113                            int /* host_id in*/,
114                            std::vector<appcache::AppCacheResourceInfo>
115                            /* resources out */)
116
117
118// AppCache messages sent from the browser to the child process.
119
120// Notifies the renderer of the appcache that has been selected for a
121// a particular host. This is sent in reply to AppCacheHostMsg_SelectCache.
122IPC_MESSAGE_CONTROL2(AppCacheMsg_CacheSelected,
123                     int /* host_id */,
124                     appcache::AppCacheInfo)
125
126// Notifies the renderer of an AppCache status change.
127IPC_MESSAGE_CONTROL2(AppCacheMsg_StatusChanged,
128                     std::vector<int> /* host_ids */,
129                     appcache::AppCacheStatus)
130
131// Notifies the renderer of an AppCache event other than the
132// progress event which has a seperate message.
133IPC_MESSAGE_CONTROL2(AppCacheMsg_EventRaised,
134                     std::vector<int> /* host_ids */,
135                     appcache::AppCacheEventID)
136
137// Notifies the renderer of an AppCache progress event.
138IPC_MESSAGE_CONTROL4(AppCacheMsg_ProgressEventRaised,
139                     std::vector<int> /* host_ids */,
140                     GURL /* url being processed */,
141                     int /* total */,
142                     int /* complete */)
143
144// Notifies the renderer of an AppCache error event.
145IPC_MESSAGE_CONTROL2(AppCacheMsg_ErrorEventRaised,
146                     std::vector<int> /* host_ids */,
147                     appcache::AppCacheErrorDetails)
148
149// Notifies the renderer of an AppCache logging message.
150IPC_MESSAGE_CONTROL3(AppCacheMsg_LogMessage,
151                     int /* host_id */,
152                     int /* log_level */,
153                     std::string /* message */)
154
155// Notifies the renderer of the fact that AppCache access was blocked.
156IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked,
157                     int /* host_id */,
158                     GURL /* manifest_url */)
159