blob: 82b4e6a556f4f8674e5b7f4d715dd8cf002ded91 [file] [log] [blame]
[email protected]6c54e7e42011-03-02 20:52:341// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]d5a04832011-03-12 21:46:265// Multiply-included file, no traditional include guard.
6#include <map>
7#include <set>
initial.commit09911bf2008-07-26 23:55:298#include <string>
9#include <vector>
10
[email protected]7a4de7a62010-08-17 18:38:2411// TODO(erg): This list has been temporarily annotated by erg while doing work
12// on which headers to pull out.
initial.commit09911bf2008-07-26 23:55:2913#include "base/basictypes.h"
[email protected]d5a04832011-03-12 21:46:2614#include "base/file_path.h"
[email protected]d5a04832011-03-12 21:46:2615#include "base/process.h"
[email protected]d5a04832011-03-12 21:46:2616#include "base/shared_memory.h"
[email protected]4c79e3e2009-10-23 18:31:3217#include "base/string16.h"
[email protected]d5a04832011-03-12 21:46:2618#include "base/values.h"
19#include "build/build_config.h"
[email protected]79d68c62011-04-15 21:07:0320#include "chrome/common/common_param_traits.h"
[email protected]1c9c7fb2011-03-11 16:38:3821#include "chrome/common/instant_types.h"
[email protected]d5a04832011-03-12 21:46:2622#include "chrome/common/nacl_types.h"
[email protected]c08e7932011-03-29 04:08:1423#include "chrome/common/search_provider.h"
[email protected]d5a04832011-03-12 21:46:2624#include "chrome/common/thumbnail_score.h"
[email protected]152b8ba32010-03-29 19:40:1625#include "chrome/common/translate_errors.h"
[email protected]7b291f92009-08-14 05:43:5326#include "chrome/common/view_types.h"
[email protected]db803aae2011-03-05 02:00:4227#include "content/common/common_param_traits.h"
[email protected]d5a04832011-03-12 21:46:2628#include "ipc/ipc_message_macros.h"
[email protected]fffaf972011-03-24 01:34:3529#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
[email protected]fffaf972011-03-24 01:34:3530#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
[email protected]d5a04832011-03-12 21:46:2631#include "third_party/skia/include/core/SkBitmap.h"
32#include "ui/gfx/rect.h"
[email protected]7a4de7a62010-08-17 18:38:2433
[email protected]44c49c92011-03-28 16:17:2334// Singly-included section for enums and custom IPC traits.
[email protected]d5a04832011-03-12 21:46:2635#ifndef CHROME_COMMON_RENDER_MESSAGES_H_
36#define CHROME_COMMON_RENDER_MESSAGES_H_
[email protected]049eec22010-10-20 21:32:5237
[email protected]a6097f42011-01-10 08:50:5138// Command values for the cmd parameter of the
39// ViewHost_JavaScriptStressTestControl message. For each command the parameter
40// passed has a different meaning:
41// For the command kJavaScriptStressTestSetStressRunType the parameter it the
42// type taken from the enumeration v8::Testing::StressType.
43// For the command kJavaScriptStressTestPrepareStressRun the parameter it the
44// number of the stress run about to take place.
45enum ViewHostMsg_JavaScriptStressTestControl_Commands {
46 kJavaScriptStressTestSetStressRunType = 0,
47 kJavaScriptStressTestPrepareStressRun = 1,
48};
49
[email protected]7d5c3ac2009-02-04 08:58:1950namespace IPC {
51
[email protected]661eb9d2009-02-03 02:11:4852#if defined(OS_POSIX)
53
54// TODO(port): this shouldn't exist. However, the plugin stuff is really using
55// HWNDS (NativeView), and making Windows calls based on them. I've not figured
56// out the deal with plugins yet.
57template <>
58struct ParamTraits<gfx::NativeView> {
59 typedef gfx::NativeView param_type;
[email protected]7d5c3ac2009-02-04 08:58:1960 static void Write(Message* m, const param_type& p) {
[email protected]661eb9d2009-02-03 02:11:4861 NOTIMPLEMENTED();
62 }
63
[email protected]7d5c3ac2009-02-04 08:58:1964 static bool Read(const Message* m, void** iter, param_type* p) {
[email protected]661eb9d2009-02-03 02:11:4865 NOTIMPLEMENTED();
66 *p = NULL;
67 return true;
68 }
69
[email protected]252cad62010-08-18 18:33:5770 static void Log(const param_type& p, std::string* l) {
[email protected]93f10522010-10-31 16:27:4871 l->append(base::StringPrintf("<gfx::NativeView>"));
[email protected]661eb9d2009-02-03 02:11:4872 }
73};
74
75#endif // defined(OS_POSIX)
76
[email protected]7b291f92009-08-14 05:43:5377template <>
[email protected]fffaf972011-03-24 01:34:3578struct ParamTraits<ContentSettings> {
79 typedef ContentSettings param_type;
80 static void Write(Message* m, const param_type& p);
81 static bool Read(const Message* m, void** iter, param_type* r);
82 static void Log(const param_type& p, std::string* l);
[email protected]7b291f92009-08-14 05:43:5383};
[email protected]1b9af292009-07-09 04:30:3084
[email protected]b3df5a42010-05-11 14:31:0985} // namespace IPC
[email protected]9f4db512010-05-10 20:21:4186
[email protected]5a52f162008-08-27 04:15:3187#endif // CHROME_COMMON_RENDER_MESSAGES_H_
[email protected]d5a04832011-03-12 21:46:2688
[email protected]778574e2011-03-21 22:03:5089#define IPC_MESSAGE_START ChromeMsgStart
[email protected]d5a04832011-03-12 21:46:2690
[email protected]fffaf972011-03-24 01:34:3591IPC_ENUM_TRAITS(InstantCompleteBehavior)
[email protected]c08e7932011-03-29 04:08:1492IPC_ENUM_TRAITS(search_provider::OSDDType)
93IPC_ENUM_TRAITS(search_provider::InstallState)
[email protected]fffaf972011-03-24 01:34:3594IPC_ENUM_TRAITS(TranslateErrors::Type)
95IPC_ENUM_TRAITS(ViewType::Type)
96IPC_ENUM_TRAITS(WebKit::WebConsoleMessage::Level)
[email protected]fffaf972011-03-24 01:34:3597
98IPC_STRUCT_TRAITS_BEGIN(ThumbnailScore)
99 IPC_STRUCT_TRAITS_MEMBER(boring_score)
100 IPC_STRUCT_TRAITS_MEMBER(good_clipping)
101 IPC_STRUCT_TRAITS_MEMBER(at_top)
102 IPC_STRUCT_TRAITS_MEMBER(time_at_snapshot)
103IPC_STRUCT_TRAITS_END()
104
[email protected]fffaf972011-03-24 01:34:35105IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::ResourceTypeStat)
106 IPC_STRUCT_TRAITS_MEMBER(count)
107 IPC_STRUCT_TRAITS_MEMBER(size)
108 IPC_STRUCT_TRAITS_MEMBER(liveSize)
109 IPC_STRUCT_TRAITS_MEMBER(decodedSize)
110IPC_STRUCT_TRAITS_END()
111
112IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::ResourceTypeStats)
113 IPC_STRUCT_TRAITS_MEMBER(images)
114 IPC_STRUCT_TRAITS_MEMBER(cssStyleSheets)
115 IPC_STRUCT_TRAITS_MEMBER(scripts)
116 IPC_STRUCT_TRAITS_MEMBER(xslStyleSheets)
117 IPC_STRUCT_TRAITS_MEMBER(fonts)
118IPC_STRUCT_TRAITS_END()
119
120IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::UsageStats)
121 IPC_STRUCT_TRAITS_MEMBER(minDeadCapacity)
122 IPC_STRUCT_TRAITS_MEMBER(maxDeadCapacity)
123 IPC_STRUCT_TRAITS_MEMBER(capacity)
124 IPC_STRUCT_TRAITS_MEMBER(liveSize)
125 IPC_STRUCT_TRAITS_MEMBER(deadSize)
126IPC_STRUCT_TRAITS_END()
127
[email protected]d5a04832011-03-12 21:46:26128//-----------------------------------------------------------------------------
129// RenderView messages
130// These are messages sent from the browser to the renderer process.
131
[email protected]d5a04832011-03-12 21:46:26132// Tells the renderer to set its maximum cache size to the supplied value.
133IPC_MESSAGE_CONTROL3(ViewMsg_SetCacheCapacities,
134 size_t /* min_dead_capacity */,
135 size_t /* max_dead_capacity */,
136 size_t /* capacity */)
137
138// Tells the renderer to clear the cache.
139IPC_MESSAGE_CONTROL0(ViewMsg_ClearCache)
140
[email protected]55722152011-03-22 01:33:53141// Tells the renderer to dump as much memory as it can, perhaps because we
142// have memory pressure or the renderer is (or will be) paged out. This
143// should only result in purging objects we can recalculate, e.g. caches or
144// JS garbage, not in purging irreplaceable objects.
145IPC_MESSAGE_CONTROL0(ViewMsg_PurgeMemory)
146
147// Tells the render view to capture a thumbnail image of the page. The
148// render view responds with a ViewHostMsg_Snapshot.
149IPC_MESSAGE_ROUTED0(ViewMsg_CaptureSnapshot)
[email protected]d5a04832011-03-12 21:46:26150
[email protected]d5a04832011-03-12 21:46:26151// History system notification that the visited link database has been
152// replaced. It has one SharedMemoryHandle argument consisting of the table
153// handle. This handle is valid in the context of the renderer
154IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_NewTable, base::SharedMemoryHandle)
155
156// History system notification that a link has been added and the link
157// coloring state for the given hash must be re-calculated.
158IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_Add, std::vector<uint64>)
159
160// History system notification that one or more history items have been
161// deleted, which at this point means that all link coloring state must be
162// re-calculated.
163IPC_MESSAGE_CONTROL0(ViewMsg_VisitedLink_Reset)
164
[email protected]d5a04832011-03-12 21:46:26165// Set the content settings for a particular url that the renderer is in the
166// process of loading. This will be stored, to be used if the load commits
167// and ignored otherwise.
168IPC_MESSAGE_ROUTED2(ViewMsg_SetContentSettingsForLoadingURL,
169 GURL /* url */,
170 ContentSettings /* content_settings */)
171
172// Set the content settings for a particular url, so all render views
173// displaying this host url update their content settings to match.
174IPC_MESSAGE_CONTROL2(ViewMsg_SetContentSettingsForCurrentURL,
175 GURL /* url */,
176 ContentSettings /* content_settings */)
177
[email protected]d5a04832011-03-12 21:46:26178// Tells the render view to load all blocked plugins.
179IPC_MESSAGE_ROUTED0(ViewMsg_LoadBlockedPlugins)
180
[email protected]d5a04832011-03-12 21:46:26181// Used to instruct the RenderView to go into "view source" mode.
182IPC_MESSAGE_ROUTED0(ViewMsg_EnableViewSourceMode)
183
184// Get all savable resource links from current webpage, include main
185// frame and sub-frame.
186IPC_MESSAGE_ROUTED1(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
187 GURL /* url of page which is needed to save */)
188
189// Get html data by serializing all frames of current page with lists
190// which contain all resource links that have local copy.
191IPC_MESSAGE_ROUTED3(ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
192 std::vector<GURL> /* urls that have local copy */,
193 std::vector<FilePath> /* paths of local copy */,
194 FilePath /* local directory path */)
195
[email protected]d5a04832011-03-12 21:46:26196// Asks the renderer to send back stats on the WebCore cache broken down by
197// resource types.
198IPC_MESSAGE_CONTROL0(ViewMsg_GetCacheResourceStats)
199
200// Asks the renderer to send back Histograms.
201IPC_MESSAGE_CONTROL1(ViewMsg_GetRendererHistograms,
202 int /* sequence number of Renderer Histograms. */)
203
[email protected]63a8ba12011-04-29 05:42:22204// Tells the renderer to create a FieldTrial, and by using a 100% probability
205// for the FieldTrial, forces the FieldTrial to have assigned group name.
206IPC_MESSAGE_CONTROL2(ViewMsg_SetFieldTrialGroup,
207 std::string /* field trial name */,
208 std::string /* group name that was assigned. */)
209
[email protected]d5a04832011-03-12 21:46:26210#if defined(USE_TCMALLOC)
211// Asks the renderer to send back tcmalloc stats.
212IPC_MESSAGE_CONTROL0(ViewMsg_GetRendererTcmalloc)
213#endif
214
215// Asks the renderer to send back V8 heap stats.
216IPC_MESSAGE_CONTROL0(ViewMsg_GetV8HeapStats)
217
[email protected]d5a04832011-03-12 21:46:26218// Posts a message to the renderer.
219IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost,
220 std::string /* The message */,
221 std::string /* The origin */,
222 std::string /* The target*/)
223
[email protected]d5a04832011-03-12 21:46:26224IPC_MESSAGE_ROUTED4(ViewMsg_SearchBoxChange,
225 string16 /* value */,
226 bool /* verbatim */,
227 int /* selection_start */,
228 int /* selection_end */)
229IPC_MESSAGE_ROUTED2(ViewMsg_SearchBoxSubmit,
230 string16 /* value */,
231 bool /* verbatim */)
232IPC_MESSAGE_ROUTED0(ViewMsg_SearchBoxCancel)
233IPC_MESSAGE_ROUTED1(ViewMsg_SearchBoxResize,
234 gfx::Rect /* search_box_bounds */)
235IPC_MESSAGE_ROUTED4(ViewMsg_DetermineIfPageSupportsInstant,
236 string16 /* value*/,
237 bool /* verbatim */,
238 int /* selection_start */,
239 int /* selection_end */)
240
[email protected]d5a04832011-03-12 21:46:26241// Tell the renderer which browser window it's being attached to.
242IPC_MESSAGE_ROUTED1(ViewMsg_UpdateBrowserWindowId,
243 int /* id of browser window */)
244
245// Tell the renderer which type this view is.
246IPC_MESSAGE_ROUTED1(ViewMsg_NotifyRenderViewType,
247 ViewType::Type /* view_type */)
248
[email protected]d5a04832011-03-12 21:46:26249// Tells the renderer to translate the page contents from one language to
250// another.
251IPC_MESSAGE_ROUTED4(ViewMsg_TranslatePage,
252 int /* page id */,
253 std::string, /* the script injected in the page */
254 std::string, /* BCP 47/RFC 5646 language code the page
255 is in */
256 std::string /* BCP 47/RFC 5646 language code to translate
257 to */)
258
259// Tells the renderer to revert the text of translated page to its original
260// contents.
261IPC_MESSAGE_ROUTED1(ViewMsg_RevertTranslation,
262 int /* page id */)
263
[email protected]d5a04832011-03-12 21:46:26264// Sent on process startup to indicate whether this process is running in
265// incognito mode.
266IPC_MESSAGE_CONTROL1(ViewMsg_SetIsIncognitoProcess,
267 bool /* is_incognito_processs */)
268
[email protected]d5a04832011-03-12 21:46:26269//-----------------------------------------------------------------------------
270// TabContents messages
271// These are messages sent from the renderer to the browser process.
272
[email protected]93b9d692011-04-13 00:44:31273// Provides the contents for the given page that was loaded recently.
274IPC_MESSAGE_ROUTED3(ViewHostMsg_PageContents,
275 GURL /* URL of the page */,
276 int32 /* page id */,
277 string16 /* page contents */)
278
279// Notification that the language for the tab has been determined.
280IPC_MESSAGE_ROUTED2(ViewHostMsg_TranslateLanguageDetermined,
281 std::string /* page ISO639_1 language code */,
282 bool /* whether the page can be translated */)
283
[email protected]d5a04832011-03-12 21:46:26284IPC_MESSAGE_CONTROL1(ViewHostMsg_UpdatedCacheStats,
285 WebKit::WebCache::UsageStats /* stats */)
286
[email protected]d5a04832011-03-12 21:46:26287// Tells the browser that content in the current page was blocked due to the
288// user's content settings.
289IPC_MESSAGE_ROUTED2(ViewHostMsg_ContentBlocked,
290 ContentSettingsType, /* type of blocked content */
291 std::string /* resource identifier */)
292
[email protected]d5a04832011-03-12 21:46:26293// Specifies the URL as the first parameter (a wstring) and thumbnail as
294// binary data as the second parameter.
295IPC_MESSAGE_ROUTED3(ViewHostMsg_Thumbnail,
296 GURL /* url */,
297 ThumbnailScore /* score */,
298 SkBitmap /* bitmap */)
299
300// Send a snapshot of the tab contents to the render host.
301IPC_MESSAGE_ROUTED1(ViewHostMsg_Snapshot,
302 SkBitmap /* bitmap */)
303
[email protected]d5a04832011-03-12 21:46:26304// Following message is used to communicate the values received by the
305// callback binding the JS to Cpp.
306// An instance of browser that has an automation host listening to it can
307// have a javascript send a native value (string, number, boolean) to the
308// listener in Cpp. (DomAutomationController)
309IPC_MESSAGE_ROUTED2(ViewHostMsg_DomOperationResponse,
310 std::string /* json_string */,
311 int /* automation_id */)
312
[email protected]d5a04832011-03-12 21:46:26313// A message for an external host.
314IPC_MESSAGE_ROUTED3(ViewHostMsg_ForwardMessageToExternalHost,
315 std::string /* message */,
316 std::string /* origin */,
317 std::string /* target */)
318
[email protected]d5a04832011-03-12 21:46:26319// A renderer sends this to the browser process when it wants to start
320// a new instance of the Native Client process. The browser will launch
321// the process and return a handle to an IMC channel.
322IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_LaunchNaCl,
323 std::wstring /* url for the NaCl module */,
324 int /* socket count */,
325 std::vector<nacl::FileDescriptor>
326 /* imc channel handles */,
327 base::ProcessHandle /* NaCl process handle */,
328 base::ProcessId /* NaCl process id */)
329
[email protected]d5a04832011-03-12 21:46:26330// Notification that the page has an OpenSearch description document
331// associated with it.
332IPC_MESSAGE_ROUTED3(ViewHostMsg_PageHasOSDD,
333 int32 /* page_id */,
334 GURL /* url of OS description document */,
[email protected]c08e7932011-03-29 04:08:14335 search_provider::OSDDType)
[email protected]d5a04832011-03-12 21:46:26336
337// Find out if the given url's security origin is installed as a search
338// provider.
[email protected]c08e7932011-03-29 04:08:14339IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetSearchProviderInstallState,
340 GURL /* page url */,
341 GURL /* inquiry url */,
342 search_provider::InstallState /* install */)
[email protected]d5a04832011-03-12 21:46:26343
[email protected]d5a04832011-03-12 21:46:26344// Send back histograms as vector of pickled-histogram strings.
345IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererHistograms,
346 int, /* sequence number of Renderer Histograms. */
347 std::vector<std::string>)
348
349#if defined USE_TCMALLOC
350// Send back tcmalloc stats output.
351IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererTcmalloc,
352 int /* pid */,
353 std::string /* tcmalloc debug output */)
354#endif
355
356// Sends back stats about the V8 heap.
357IPC_MESSAGE_CONTROL2(ViewHostMsg_V8HeapStats,
358 int /* size of heap (allocated from the OS) */,
359 int /* bytes in use */)
360
361// Request for a DNS prefetch of the names in the array.
362// NameList is typedef'ed std::vector<std::string>
363IPC_MESSAGE_CONTROL1(ViewHostMsg_DnsPrefetch,
[email protected]2bf2bd92011-03-31 07:12:44364 std::vector<std::string> /* hostnames */)
[email protected]d5a04832011-03-12 21:46:26365
[email protected]2bf2bd92011-03-31 07:12:44366// Requests the outdated plugins policy.
367// |policy| is one of ALLOW, BLOCK or ASK. Anything else is an error.
368// ALLOW means that outdated plugins are allowed, and BLOCK that they should
369// be blocked. The default is ASK, which blocks the plugin initially but allows
370// the user to start them manually.
371IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetOutdatedPluginsPolicy,
372 ContentSetting /* policy */)
373
[email protected]d5a04832011-03-12 21:46:26374// Notifies when a plugin couldn't be loaded because it's outdated.
375IPC_MESSAGE_ROUTED2(ViewHostMsg_BlockedOutdatedPlugin,
376 string16, /* name */
377 GURL /* update_url */)
378
[email protected]d5a04832011-03-12 21:46:26379IPC_MESSAGE_ROUTED3(ViewHostMsg_SendCurrentPageAllSavableResourceLinks,
380 std::vector<GURL> /* all savable resource links */,
381 std::vector<GURL> /* all referrers of resource links */,
382 std::vector<GURL> /* all frame links */)
383
384IPC_MESSAGE_ROUTED3(ViewHostMsg_SendSerializedHtmlData,
385 GURL /* frame's url */,
386 std::string /* data buffer */,
387 int32 /* complete status */)
388
[email protected]d5a04832011-03-12 21:46:26389// Provide the browser process with information about the WebCore resource
390// cache.
391IPC_MESSAGE_CONTROL1(ViewHostMsg_ResourceTypeStats,
392 WebKit::WebCache::ResourceTypeStats)
393
[email protected]d5a04832011-03-12 21:46:26394// Message sent from renderer to the browser to update the state of a command.
395// The |command| parameter is a RenderViewCommand. The |checked_state| parameter
396// is a CommandCheckedState.
397IPC_MESSAGE_ROUTED3(ViewHostMsg_CommandStateChanged,
398 int /* command */,
399 bool /* is_enabled */,
400 int /* checked_state */)
401
[email protected]d5a04832011-03-12 21:46:26402
403// Notifies the browser of the language (ISO 639_1 code language, such as fr,
404// en, zh...) of the current page.
405IPC_MESSAGE_ROUTED1(ViewHostMsg_PageLanguageDetermined,
406 std::string /* the language */)
407
408// Notifies the browser that a page has been translated.
409IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated,
410 int, /* page id */
411 std::string /* the original language */,
412 std::string /* the translated language */,
413 TranslateErrors::Type /* the error type if available */)
414
[email protected]d5a04832011-03-12 21:46:26415// Suggest results -----------------------------------------------------------
416
417IPC_MESSAGE_ROUTED3(ViewHostMsg_SetSuggestions,
418 int32 /* page_id */,
419 std::vector<std::string> /* suggestions */,
420 InstantCompleteBehavior)
421
422IPC_MESSAGE_ROUTED2(ViewHostMsg_InstantSupportDetermined,
423 int32 /* page_id */,
424 bool /* result */)
425
[email protected]d5a04832011-03-12 21:46:26426// JavaScript related messages -----------------------------------------------
427
428// Notify the JavaScript engine in the render to change its parameters
429// while performing stress testing.
430IPC_MESSAGE_ROUTED2(ViewMsg_JavaScriptStressTestControl,
431 int /* cmd */,
432 int /* param */)