OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_COMMON_RENDER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 // TODO(erg): This list has been temporarily annotated by erg while doing work | 12 // TODO(erg): This list has been temporarily annotated by erg while doing work |
13 // on which headers to pull out. | 13 // on which headers to pull out. |
14 #include "app/clipboard/clipboard.h" | 14 #include "app/clipboard/clipboard.h" // enum |
15 #include "app/surface/transport_dib.h" | |
16 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
17 #include "base/platform_file.h" | |
18 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
19 #include "base/shared_memory.h" | |
20 #include "base/string16.h" | 17 #include "base/string16.h" |
21 #include "base/values.h" | |
22 #include "chrome/common/common_param_traits.h" | 18 #include "chrome/common/common_param_traits.h" |
23 #include "chrome/common/css_colors.h" | 19 #include "chrome/common/css_colors.h" |
24 #include "chrome/common/dom_storage_common.h" | 20 #include "chrome/common/dom_storage_common.h" |
25 #include "chrome/common/extensions/extension_extent.h" // used in struct | |
26 #include "chrome/common/font_descriptor_mac.h" | |
27 #include "chrome/common/indexed_db_param_traits.h" | 21 #include "chrome/common/indexed_db_param_traits.h" |
28 #include "chrome/common/navigation_gesture.h" | |
29 #include "chrome/common/page_transition_types.h" | 22 #include "chrome/common/page_transition_types.h" |
30 #include "chrome/common/renderer_preferences.h" // used in struct | |
31 #include "chrome/common/resource_response.h" | 23 #include "chrome/common/resource_response.h" |
32 #include "chrome/common/translate_errors.h" | 24 #include "chrome/common/translate_errors.h" |
33 #include "chrome/common/view_types.h" | 25 #include "chrome/common/view_types.h" |
34 #include "chrome/common/webkit_param_traits.h" | 26 #include "chrome/common/webkit_param_traits.h" |
35 #include "chrome/common/window_container_type.h" | |
36 #include "gfx/native_widget_types.h" | 27 #include "gfx/native_widget_types.h" |
37 #include "gfx/rect.h" | |
38 #include "googleurl/src/gurl.h" | |
39 #include "ipc/ipc_message_utils.h" | 28 #include "ipc/ipc_message_utils.h" |
40 #include "ipc/ipc_platform_file.h" | 29 #include "ipc/ipc_platform_file.h" // ifdefed typedef. |
41 #include "media/audio/audio_io.h" | |
42 #include "net/base/upload_data.h" | |
43 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" | 30 #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" |
44 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" | |
45 #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status | 31 #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status |
46 #include "webkit/glue/password_form.h" // used in struct | 32 #include "webkit/glue/resource_loader_bridge.h" // nested classes |
47 #include "webkit/glue/plugins/webplugin.h" | 33 |
48 #include "webkit/glue/resource_loader_bridge.h" | 34 #if defined(OS_MACOSX) |
49 #include "webkit/glue/webmenuitem.h" | 35 struct FontDescriptor; |
50 #include "webkit/glue/webpreferences.h" // used in struct | 36 #endif |
51 | 37 |
52 namespace appcache { | 38 namespace appcache { |
53 struct AppCacheInfo; | 39 struct AppCacheInfo; |
54 struct AppCacheResourceInfo; | 40 struct AppCacheResourceInfo; |
55 } | 41 } |
56 | 42 |
57 namespace base { | 43 namespace base { |
58 class Time; | 44 class Time; |
59 } | 45 } |
60 | 46 |
61 namespace net { | 47 namespace net { |
62 class HttpResponseHeaders; | 48 class HttpResponseHeaders; |
| 49 class UploadData; |
63 } | 50 } |
64 | 51 |
65 namespace webkit_glue { | 52 namespace webkit_glue { |
66 struct FormData; | 53 struct FormData; |
67 class FormField; | 54 class FormField; |
68 struct PasswordFormFillData; | 55 struct PasswordFormFillData; |
69 struct WebAccessibility; | 56 struct WebAccessibility; |
70 struct WebCookie; | 57 struct WebCookie; |
| 58 struct WebPluginGeometry; |
71 } | 59 } |
72 | 60 |
73 namespace webkit_glue { | 61 namespace webkit_glue { |
74 struct WebAccessibility; | 62 struct WebAccessibility; |
75 } | 63 } |
76 | 64 |
77 struct EditCommand; | |
78 class ExtensionExtent; | 65 class ExtensionExtent; |
79 | 66 class GURL; |
80 class SkBitmap; | 67 class SkBitmap; |
81 class URLPattern; | 68 class URLPattern; |
82 struct ContextMenuParams; | 69 struct ContextMenuParams; |
| 70 struct EditCommand; |
| 71 struct RendererPreferences; |
83 struct WebDropData; | 72 struct WebDropData; |
| 73 struct WebMenuItem; |
84 struct WebPluginInfo; | 74 struct WebPluginInfo; |
85 struct WebPluginMimeType; | 75 struct WebPluginMimeType; |
| 76 struct WebPreferences; |
86 | 77 |
87 // Parameters structure for ViewMsg_Navigate, which has too many data | 78 // Forward declarations of structures used to store data for when we have a lot |
88 // parameters to be reasonably put in a predefined IPC message. | 79 // of parameters. |
89 struct ViewMsg_Navigate_Params { | 80 struct ViewMsg_Navigate_Params; |
90 enum NavigationType { | 81 struct ViewMsg_AudioStreamState_Params; |
91 // Reload the page. | 82 struct ViewMsg_StopFinding_Params; |
92 RELOAD, | 83 struct ViewHostMsg_GetSearchProviderInstallState_Params; |
93 | 84 struct ViewHostMsg_FrameNavigate_Params; |
94 // Reload the page, ignoring any cache entries. | 85 struct ViewHostMsg_UpdateRect_Params; |
95 RELOAD_IGNORING_CACHE, | 86 struct ViewMsg_ClosePage_Params; |
96 | 87 struct ViewHostMsg_Resource_Request; |
97 // The navigation is the result of session restore and should honor the | 88 struct ViewMsg_Print_Params; |
98 // page's cache policy while restoring form state. This is set to true if | 89 struct ViewMsg_PrintPage_Params; |
99 // restoring a tab/session from the previous session and the previous | 90 struct ViewMsg_PrintPages_Params; |
100 // session did not crash. If this is not set and the page was restored then | 91 struct ViewHostMsg_DidPrintPage_Params; |
101 // the page's cache policy is ignored and we load from the cache. | 92 struct ViewHostMsg_Audio_CreateStream_Params; |
102 RESTORE, | 93 struct ViewHostMsg_ShowPopup_Params; |
103 | 94 struct ViewHostMsg_ScriptedPrint_Params; |
104 // Navigation type not categorized by the other types. | 95 struct ViewMsg_DOMStorageEvent_Params; |
105 NORMAL | 96 struct ViewHostMsg_IDBFactoryOpen_Params; |
106 }; | 97 struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; |
107 | 98 struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; |
108 // The page_id for this navigation, or -1 if it is a new navigation. Back, | 99 struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; |
109 // Forward, and Reload navigations should have a valid page_id. If the load | 100 struct ViewMsg_ExecuteCode_Params; |
110 // succeeds, then this page_id will be reflected in the resultant | 101 struct ViewHostMsg_CreateWorker_Params; |
111 // ViewHostMsg_FrameNavigate message. | 102 struct ViewHostMsg_ShowNotification_Params; |
112 int32 page_id; | 103 struct ViewMsg_New_Params; |
113 | 104 struct ViewHostMsg_CreateWindow_Params; |
114 // If page_id is -1, then pending_history_list_offset will also be -1. | 105 struct ViewHostMsg_RunFileChooser_Params; |
115 // Otherwise, it contains the offset into the history list corresponding to | 106 struct ViewMsg_ExtensionExtentInfo; |
116 // the current navigation. | 107 struct ViewMsg_ExtensionExtentsUpdated_Params; |
117 int pending_history_list_offset; | 108 struct ViewMsg_DeviceOrientationUpdated_Params; |
118 | 109 struct ViewHostMsg_DomMessage_Params; |
119 // Informs the RenderView of where its current page contents reside in | 110 struct ViewHostMsg_OpenFileSystemRequest_Params; |
120 // session history and the total size of the session history list. | |
121 int current_history_list_offset; | |
122 int current_history_list_length; | |
123 | |
124 // The URL to load. | |
125 GURL url; | |
126 | |
127 // The URL to send in the "Referer" header field. Can be empty if there is | |
128 // no referrer. | |
129 GURL referrer; | |
130 | |
131 // The type of transition. | |
132 PageTransition::Type transition; | |
133 | |
134 // Opaque history state (received by ViewHostMsg_UpdateState). | |
135 std::string state; | |
136 | |
137 // Type of navigation. | |
138 NavigationType navigation_type; | |
139 | |
140 // The time the request was created | |
141 base::Time request_time; | |
142 }; | |
143 | |
144 // Current status of the audio output stream in the browser process. Browser | |
145 // sends information about the current playback state and error to the | |
146 // renderer process using this type. | |
147 struct ViewMsg_AudioStreamState_Params { | |
148 enum State { | |
149 kPlaying, | |
150 kPaused, | |
151 kError | |
152 }; | |
153 | |
154 // Carries the current playback state. | |
155 State state; | |
156 }; | |
157 | |
158 // The user has completed a find-in-page; this type defines what actions the | |
159 // renderer should take next. | |
160 struct ViewMsg_StopFinding_Params { | |
161 enum Action { | |
162 kClearSelection, | |
163 kKeepSelection, | |
164 kActivateSelection | |
165 }; | |
166 | |
167 // The action that should be taken when the find is completed. | |
168 Action action; | |
169 }; | |
170 | |
171 // The install state of the search provider (not installed, installed, default). | |
172 struct ViewHostMsg_GetSearchProviderInstallState_Params { | |
173 enum State { | |
174 // Equates to an access denied error. | |
175 DENIED = -1, | |
176 | |
177 // DON'T CHANGE THE VALUES BELOW. | |
178 // All of the following values are manidated by the | |
179 // spec for window.external.IsSearchProviderInstalled. | |
180 | |
181 // The search provider is not installed. | |
182 NOT_INSTALLED = 0, | |
183 | |
184 // The search provider is in the user's set but is not | |
185 INSTALLED_BUT_NOT_DEFAULT = 1, | |
186 | |
187 // The search provider is set as the user's default. | |
188 INSTALLED_AS_DEFAULT = 2 | |
189 }; | |
190 State state; | |
191 | |
192 ViewHostMsg_GetSearchProviderInstallState_Params() | |
193 : state(DENIED) { | |
194 } | |
195 | |
196 explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s) | |
197 : state(s) { | |
198 } | |
199 | |
200 static ViewHostMsg_GetSearchProviderInstallState_Params Denied() { | |
201 return ViewHostMsg_GetSearchProviderInstallState_Params(DENIED); | |
202 } | |
203 | |
204 static ViewHostMsg_GetSearchProviderInstallState_Params NotInstalled() { | |
205 return ViewHostMsg_GetSearchProviderInstallState_Params(NOT_INSTALLED); | |
206 } | |
207 | |
208 static ViewHostMsg_GetSearchProviderInstallState_Params | |
209 InstallButNotDefault() { | |
210 return ViewHostMsg_GetSearchProviderInstallState_Params( | |
211 INSTALLED_BUT_NOT_DEFAULT); | |
212 } | |
213 | |
214 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { | |
215 return ViewHostMsg_GetSearchProviderInstallState_Params( | |
216 INSTALLED_AS_DEFAULT); | |
217 } | |
218 }; | |
219 | |
220 | |
221 // Parameters structure for ViewHostMsg_FrameNavigate, which has too many data | |
222 // parameters to be reasonably put in a predefined IPC message. | |
223 struct ViewHostMsg_FrameNavigate_Params { | |
224 // Page ID of this navigation. The renderer creates a new unique page ID | |
225 // anytime a new session history entry is created. This means you'll get new | |
226 // page IDs for user actions, and the old page IDs will be reloaded when | |
227 // iframes are loaded automatically. | |
228 int32 page_id; | |
229 | |
230 // URL of the page being loaded. | |
231 GURL url; | |
232 | |
233 // URL of the referrer of this load. WebKit generates this based on the | |
234 // source of the event that caused the load. | |
235 GURL referrer; | |
236 | |
237 // The type of transition. | |
238 PageTransition::Type transition; | |
239 | |
240 // Lists the redirects that occurred on the way to the current page. This | |
241 // vector has the same format as reported by the WebDataSource in the glue, | |
242 // with the current page being the last one in the list (so even when | |
243 // there's no redirect, there will be one entry in the list. | |
244 std::vector<GURL> redirects; | |
245 | |
246 // Set to false if we want to update the session history but not update | |
247 // the browser history. E.g., on unreachable urls. | |
248 bool should_update_history; | |
249 | |
250 // See SearchableFormData for a description of these. | |
251 GURL searchable_form_url; | |
252 std::string searchable_form_encoding; | |
253 | |
254 // See password_form.h. | |
255 webkit_glue::PasswordForm password_form; | |
256 | |
257 // Information regarding the security of the connection (empty if the | |
258 // connection was not secure). | |
259 std::string security_info; | |
260 | |
261 // The gesture that initiated this navigation. | |
262 NavigationGesture gesture; | |
263 | |
264 // Contents MIME type of main frame. | |
265 std::string contents_mime_type; | |
266 | |
267 // True if this was a post request. | |
268 bool is_post; | |
269 | |
270 // Whether the content of the frame was replaced with some alternate content | |
271 // (this can happen if the resource was insecure). | |
272 bool is_content_filtered; | |
273 | |
274 // The status code of the HTTP request. | |
275 int http_status_code; | |
276 }; | |
277 | |
278 // Values that may be OR'd together to form the 'flags' parameter of a | |
279 // ViewHostMsg_UpdateRect_Params structure. | |
280 struct ViewHostMsg_UpdateRect_Flags { | |
281 enum { | |
282 IS_RESIZE_ACK = 1 << 0, | |
283 IS_RESTORE_ACK = 1 << 1, | |
284 IS_REPAINT_ACK = 1 << 2, | |
285 }; | |
286 static bool is_resize_ack(int flags) { | |
287 return (flags & IS_RESIZE_ACK) != 0; | |
288 } | |
289 static bool is_restore_ack(int flags) { | |
290 return (flags & IS_RESTORE_ACK) != 0; | |
291 } | |
292 static bool is_repaint_ack(int flags) { | |
293 return (flags & IS_REPAINT_ACK) != 0; | |
294 } | |
295 }; | |
296 | |
297 struct ViewHostMsg_UpdateRect_Params { | |
298 // The bitmap to be painted into the view at the locations specified by | |
299 // update_rects. | |
300 TransportDIB::Id bitmap; | |
301 | |
302 // The position and size of the bitmap. | |
303 gfx::Rect bitmap_rect; | |
304 | |
305 // The scroll offset. Only one of these can be non-zero, and if they are | |
306 // both zero, then it means there is no scrolling and the scroll_rect is | |
307 // ignored. | |
308 int dx; | |
309 int dy; | |
310 | |
311 // The rectangular region to scroll. | |
312 gfx::Rect scroll_rect; | |
313 | |
314 // The regions of the bitmap (in view coords) that contain updated pixels. | |
315 // In the case of scrolling, this includes the scroll damage rect. | |
316 std::vector<gfx::Rect> copy_rects; | |
317 | |
318 // The size of the RenderView when this message was generated. This is | |
319 // included so the host knows how large the view is from the perspective of | |
320 // the renderer process. This is necessary in case a resize operation is in | |
321 // progress. | |
322 gfx::Size view_size; | |
323 | |
324 // New window locations for plugin child windows. | |
325 std::vector<webkit_glue::WebPluginGeometry> plugin_window_moves; | |
326 | |
327 // The following describes the various bits that may be set in flags: | |
328 // | |
329 // ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK | |
330 // Indicates that this is a response to a ViewMsg_Resize message. | |
331 // | |
332 // ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK | |
333 // Indicates that this is a response to a ViewMsg_WasRestored message. | |
334 // | |
335 // ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK | |
336 // Indicates that this is a response to a ViewMsg_Repaint message. | |
337 // | |
338 // If flags is zero, then this message corresponds to an unsoliticed paint | |
339 // request by the render view. Any of the above bits may be set in flags, | |
340 // which would indicate that this paint message is an ACK for multiple | |
341 // request messages. | |
342 int flags; | |
343 }; | |
344 | |
345 // Information on closing a tab. This is used both for ViewMsg_ClosePage, and | |
346 // the corresponding ViewHostMsg_ClosePage_ACK. | |
347 struct ViewMsg_ClosePage_Params { | |
348 // The identifier of the RenderProcessHost for the currently closing view. | |
349 // | |
350 // These first two parameters are technically redundant since they are | |
351 // needed only when processing the ACK message, and the processor | |
352 // theoretically knows both the process and route ID. However, this is | |
353 // difficult to figure out with our current implementation, so this | |
354 // information is duplicate here. | |
355 int closing_process_id; | |
356 | |
357 // The route identifier for the currently closing RenderView. | |
358 int closing_route_id; | |
359 | |
360 // True when this close is for the first (closing) tab of a cross-site | |
361 // transition where we switch processes. False indicates the close is for the | |
362 // entire tab. | |
363 // | |
364 // When true, the new_* variables below must be filled in. Otherwise they must | |
365 // both be -1. | |
366 bool for_cross_site_transition; | |
367 | |
368 // The identifier of the RenderProcessHost for the new view attempting to | |
369 // replace the closing one above. This must be valid when | |
370 // for_cross_site_transition is set, and must be -1 otherwise. | |
371 int new_render_process_host_id; | |
372 | |
373 // The identifier of the *request* the new view made that is causing the | |
374 // cross-site transition. This is *not* a route_id, but the request that we | |
375 // will resume once the ACK from the closing view has been received. This | |
376 // must be valid when for_cross_site_transition is set, and must be -1 | |
377 // otherwise. | |
378 int new_request_id; | |
379 }; | |
380 | |
381 // Parameters for a resource request. | |
382 struct ViewHostMsg_Resource_Request { | |
383 // The request method: GET, POST, etc. | |
384 std::string method; | |
385 | |
386 // The requested URL. | |
387 GURL url; | |
388 | |
389 // Usually the URL of the document in the top-level window, which may be | |
390 // checked by the third-party cookie blocking policy. Leaving it empty may | |
391 // lead to undesired cookie blocking. Third-party cookie blocking can be | |
392 // bypassed by setting first_party_for_cookies = url, but this should ideally | |
393 // only be done if there really is no way to determine the correct value. | |
394 GURL first_party_for_cookies; | |
395 | |
396 // The referrer to use (may be empty). | |
397 GURL referrer; | |
398 | |
399 // The origin of the frame that is associated with this request. This is used | |
400 // to update our insecure content state. | |
401 std::string frame_origin; | |
402 | |
403 // The origin of the main frame (top-level frame) that is associated with this | |
404 // request. This is used to update our insecure content state. | |
405 std::string main_frame_origin; | |
406 | |
407 // Additional HTTP request headers. | |
408 std::string headers; | |
409 | |
410 // URLRequest load flags (0 by default). | |
411 int load_flags; | |
412 | |
413 // Unique ID of process that originated this request. For normal renderer | |
414 // requests, this will be the ID of the renderer. For plugin requests routed | |
415 // through the renderer, this will be the plugin's ID. | |
416 int origin_child_id; | |
417 | |
418 // What this resource load is for (main frame, sub-frame, sub-resource, | |
419 // object). | |
420 ResourceType::Type resource_type; | |
421 | |
422 // Used by plugin->browser requests to get the correct URLRequestContext. | |
423 uint32 request_context; | |
424 | |
425 // Indicates which frame (or worker context) the request is being loaded into, | |
426 // or kNoHostId. | |
427 int appcache_host_id; | |
428 | |
429 // Optional upload data (may be null). | |
430 scoped_refptr<net::UploadData> upload_data; | |
431 | |
432 bool download_to_file; | |
433 | |
434 // The following two members are specified if the request is initiated by | |
435 // a plugin like Gears. | |
436 | |
437 // Contains the id of the host renderer. | |
438 int host_renderer_id; | |
439 | |
440 // Contains the id of the host render view. | |
441 int host_render_view_id; | |
442 }; | |
443 | |
444 // Parameters for a render request. | |
445 struct ViewMsg_Print_Params { | |
446 // Physical size of the page, including non-printable margins, | |
447 // in pixels according to dpi. | |
448 gfx::Size page_size; | |
449 | |
450 // In pixels according to dpi_x and dpi_y. | |
451 gfx::Size printable_size; | |
452 | |
453 // The y-offset of the printable area, in pixels according to dpi. | |
454 int margin_top; | |
455 | |
456 // The x-offset of the printable area, in pixels according to dpi. | |
457 int margin_left; | |
458 | |
459 // Specifies dots per inch. | |
460 double dpi; | |
461 | |
462 // Minimum shrink factor. See PrintSettings::min_shrink for more information. | |
463 double min_shrink; | |
464 | |
465 // Maximum shrink factor. See PrintSettings::max_shrink for more information. | |
466 double max_shrink; | |
467 | |
468 // Desired apparent dpi on paper. | |
469 int desired_dpi; | |
470 | |
471 // Cookie for the document to ensure correctness. | |
472 int document_cookie; | |
473 | |
474 // Should only print currently selected text. | |
475 bool selection_only; | |
476 | |
477 // Warning: do not compare document_cookie. | |
478 bool Equals(const ViewMsg_Print_Params& rhs) const { | |
479 return page_size == rhs.page_size && | |
480 printable_size == rhs.printable_size && | |
481 margin_top == rhs.margin_top && | |
482 margin_left == rhs.margin_left && | |
483 dpi == rhs.dpi && | |
484 min_shrink == rhs.min_shrink && | |
485 max_shrink == rhs.max_shrink && | |
486 desired_dpi == rhs.desired_dpi && | |
487 selection_only == rhs.selection_only; | |
488 } | |
489 | |
490 // Checking if the current params is empty. Just initialized after a memset. | |
491 bool IsEmpty() const { | |
492 return !document_cookie && !desired_dpi && !max_shrink && !min_shrink && | |
493 !dpi && printable_size.IsEmpty() && !selection_only && | |
494 page_size.IsEmpty() && !margin_top && !margin_left; | |
495 } | |
496 }; | |
497 | |
498 struct ViewMsg_PrintPage_Params { | |
499 // Parameters to render the page as a printed page. It must always be the same | |
500 // value for all the document. | |
501 ViewMsg_Print_Params params; | |
502 | |
503 // The page number is the indicator of the square that should be rendered | |
504 // according to the layout specified in ViewMsg_Print_Params. | |
505 int page_number; | |
506 }; | |
507 | |
508 struct ViewMsg_PrintPages_Params { | |
509 // Parameters to render the page as a printed page. It must always be the same | |
510 // value for all the document. | |
511 ViewMsg_Print_Params params; | |
512 | |
513 // If empty, this means a request to render all the printed pages. | |
514 std::vector<int> pages; | |
515 }; | |
516 | |
517 // Parameters to describe a rendered page. | |
518 struct ViewHostMsg_DidPrintPage_Params { | |
519 // A shared memory handle to the EMF data. This data can be quite large so a | |
520 // memory map needs to be used. | |
521 base::SharedMemoryHandle metafile_data_handle; | |
522 | |
523 // Size of the metafile data. | |
524 uint32 data_size; | |
525 | |
526 // Cookie for the document to ensure correctness. | |
527 int document_cookie; | |
528 | |
529 // Page number. | |
530 int page_number; | |
531 | |
532 // Shrink factor used to render this page. | |
533 double actual_shrink; | |
534 | |
535 // The size of the page the page author specified. | |
536 gfx::Size page_size; | |
537 | |
538 // The printable area the page author specified. | |
539 gfx::Rect content_area; | |
540 | |
541 // True if the page has visible overlays. | |
542 bool has_visible_overlays; | |
543 }; | |
544 | |
545 // Parameters for creating an audio output stream. | |
546 struct ViewHostMsg_Audio_CreateStream_Params { | |
547 // Format request for the stream. | |
548 AudioManager::Format format; | |
549 | |
550 // Number of channels. | |
551 int channels; | |
552 | |
553 // Sampling rate (frequency) of the output stream. | |
554 int sample_rate; | |
555 | |
556 // Number of bits per sample; | |
557 int bits_per_sample; | |
558 | |
559 // Number of bytes per packet. Determines the maximum number of bytes | |
560 // transported for each audio packet request. | |
561 // A value of 0 means that the audio packet size is selected automatically | |
562 // by the browser process. | |
563 uint32 packet_size; | |
564 }; | |
565 | |
566 // This message is used for supporting popup menus on Mac OS X using native | |
567 // Cocoa controls. The renderer sends us this message which we use to populate | |
568 // the popup menu. | |
569 struct ViewHostMsg_ShowPopup_Params { | |
570 // Position on the screen. | |
571 gfx::Rect bounds; | |
572 | |
573 // The height of each item in the menu. | |
574 int item_height; | |
575 | |
576 // The size of the font to use for those items. | |
577 double item_font_size; | |
578 | |
579 // The currently selected (displayed) item in the menu. | |
580 int selected_item; | |
581 | |
582 // The entire list of items in the popup menu. | |
583 std::vector<WebMenuItem> popup_items; | |
584 | |
585 // Whether items should be right-aligned. | |
586 bool right_aligned; | |
587 }; | |
588 | |
589 // Parameters for the IPC message ViewHostMsg_ScriptedPrint | |
590 struct ViewHostMsg_ScriptedPrint_Params { | |
591 int routing_id; | |
592 gfx::NativeViewId host_window_id; | |
593 int cookie; | |
594 int expected_pages_count; | |
595 bool has_selection; | |
596 bool use_overlays; | |
597 }; | |
598 | |
599 // Signals a storage event. | |
600 struct ViewMsg_DOMStorageEvent_Params { | |
601 // The key that generated the storage event. Null if clear() was called. | |
602 NullableString16 key_; | |
603 | |
604 // The old value of this key. Null on clear() or if it didn't have a value. | |
605 NullableString16 old_value_; | |
606 | |
607 // The new value of this key. Null on removeItem() or clear(). | |
608 NullableString16 new_value_; | |
609 | |
610 // The origin this is associated with. | |
611 string16 origin_; | |
612 | |
613 // The URL of the page that caused the storage event. | |
614 GURL url_; | |
615 | |
616 // The storage type of this event. | |
617 DOMStorageType storage_type_; | |
618 }; | |
619 | |
620 // Used to open an indexed database. | |
621 struct ViewHostMsg_IDBFactoryOpen_Params { | |
622 // The routing ID of the view initiating the open. | |
623 int32 routing_id_; | |
624 | |
625 // The response should have this id. | |
626 int32 response_id_; | |
627 | |
628 // The origin doing the initiating. | |
629 string16 origin_; | |
630 | |
631 // The name of the database. | |
632 string16 name_; | |
633 | |
634 // The description of the database. | |
635 string16 description_; | |
636 }; | |
637 | |
638 // Used to create an object store. | |
639 struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { | |
640 // The response should have this id. | |
641 int32 response_id_; | |
642 | |
643 // The name of the object store. | |
644 string16 name_; | |
645 | |
646 // The keyPath of the object store. | |
647 NullableString16 key_path_; | |
648 | |
649 // Whether the object store created should have a key generator. | |
650 bool auto_increment_; | |
651 | |
652 // The database the object store belongs to. | |
653 int32 idb_database_id_; | |
654 }; | |
655 | |
656 // Used to create an index. | |
657 struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { | |
658 // The response should have this id. | |
659 int32 response_id_; | |
660 | |
661 // The name of the index. | |
662 string16 name_; | |
663 | |
664 // The keyPath of the index. | |
665 NullableString16 key_path_; | |
666 | |
667 // Whether the index created has unique keys. | |
668 bool unique_; | |
669 | |
670 // The object store the index belongs to. | |
671 int32 idb_object_store_id_; | |
672 }; | |
673 | |
674 // Used to open an IndexedDB cursor. | |
675 struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { | |
676 // The response should have this id. | |
677 int32 response_id_; | |
678 // The serialized left key. | |
679 IndexedDBKey left_key_; | |
680 // The serialized right key. | |
681 IndexedDBKey right_key_; | |
682 // The key flags. | |
683 int32 flags_; | |
684 // The direction of this cursor. | |
685 int32 direction_; | |
686 // The object store the index belongs to. | |
687 int32 idb_object_store_id_; | |
688 }; | |
689 | |
690 // Allows an extension to execute code in a tab. | |
691 struct ViewMsg_ExecuteCode_Params { | |
692 ViewMsg_ExecuteCode_Params() {} | |
693 ViewMsg_ExecuteCode_Params(int request_id, const std::string& extension_id, | |
694 const std::vector<URLPattern>& host_permissions, | |
695 bool is_javascript, const std::string& code, | |
696 bool all_frames) | |
697 : request_id(request_id), extension_id(extension_id), | |
698 host_permissions(host_permissions), is_javascript(is_javascript), | |
699 code(code), all_frames(all_frames) { | |
700 } | |
701 | |
702 // The extension API request id, for responding. | |
703 int request_id; | |
704 | |
705 // The ID of the requesting extension. To know which isolated world to | |
706 // execute the code inside of. | |
707 std::string extension_id; | |
708 | |
709 // The host permissions of the requesting extension. So that we can check them | |
710 // right before injecting, to avoid any race conditions. | |
711 std::vector<URLPattern> host_permissions; | |
712 | |
713 // Whether the code is JavaScript or CSS. | |
714 bool is_javascript; | |
715 | |
716 // String of code to execute. | |
717 std::string code; | |
718 | |
719 // Whether to inject into all frames, or only the root frame. | |
720 bool all_frames; | |
721 }; | |
722 | |
723 // Parameters for the message that creates a worker thread. | |
724 struct ViewHostMsg_CreateWorker_Params { | |
725 // URL for the worker script. | |
726 GURL url; | |
727 | |
728 // True if this is a SharedWorker, false if it is a dedicated Worker. | |
729 bool is_shared; | |
730 | |
731 // Name for a SharedWorker, otherwise empty string. | |
732 string16 name; | |
733 | |
734 // The ID of the parent document (unique within parent renderer). | |
735 unsigned long long document_id; | |
736 | |
737 // RenderView routing id used to send messages back to the parent. | |
738 int render_view_route_id; | |
739 | |
740 // The route ID to associate with the worker. If MSG_ROUTING_NONE is passed, | |
741 // a new unique ID is created and assigned to the worker. | |
742 int route_id; | |
743 | |
744 // The ID of the parent's appcache host, only valid for dedicated workers. | |
745 int parent_appcache_host_id; | |
746 | |
747 // The ID of the appcache the main shared worker script resource was loaded | |
748 // from, only valid for shared workers. | |
749 int64 script_resource_appcache_id; | |
750 }; | |
751 | |
752 // Parameters for the message that creates a desktop notification. | |
753 struct ViewHostMsg_ShowNotification_Params { | |
754 // URL which is the origin that created this notification. | |
755 GURL origin; | |
756 | |
757 // True if this is HTML | |
758 bool is_html; | |
759 | |
760 // URL which contains the HTML contents (if is_html is true), otherwise empty. | |
761 GURL contents_url; | |
762 | |
763 // Contents of the notification if is_html is false. | |
764 GURL icon_url; | |
765 string16 title; | |
766 string16 body; | |
767 | |
768 // Directionality of the notification. | |
769 WebKit::WebTextDirection direction; | |
770 | |
771 // ReplaceID if this notification should replace an existing one; may be | |
772 // empty if no replacement is called for. | |
773 string16 replace_id; | |
774 | |
775 // Notification ID for sending events back for this notification. | |
776 int notification_id; | |
777 }; | |
778 | |
779 // Creates a new view via a control message since the view doesn't yet exist. | |
780 struct ViewMsg_New_Params { | |
781 // The parent window's id. | |
782 gfx::NativeViewId parent_window; | |
783 | |
784 // Renderer-wide preferences. | |
785 RendererPreferences renderer_preferences; | |
786 | |
787 // Preferences for this view. | |
788 WebPreferences web_preferences; | |
789 | |
790 // The ID of the view to be created. | |
791 int32 view_id; | |
792 | |
793 // The session storage namespace ID this view should use. | |
794 int64 session_storage_namespace_id; | |
795 | |
796 // The name of the frame associated with this view (or empty if none). | |
797 string16 frame_name; | |
798 }; | |
799 | |
800 struct ViewHostMsg_CreateWindow_Params { | |
801 // Routing ID of the view initiating the open. | |
802 int opener_id; | |
803 | |
804 // True if this open request came in the context of a user gesture. | |
805 bool user_gesture; | |
806 | |
807 // Type of window requested. | |
808 WindowContainerType window_container_type; | |
809 | |
810 // The session storage namespace ID this view should use. | |
811 int64 session_storage_namespace_id; | |
812 | |
813 // The name of the resulting frame that should be created (empty if none | |
814 // has been specified). | |
815 string16 frame_name; | |
816 }; | |
817 | |
818 struct ViewHostMsg_RunFileChooser_Params { | |
819 enum Mode { | |
820 // Requires that the file exists before allowing the user to pick it. | |
821 Open, | |
822 | |
823 // Like Open, but allows picking multiple files to open. | |
824 OpenMultiple, | |
825 | |
826 // Allows picking a nonexistent file, and prompts to overwrite if the file | |
827 // already exists. | |
828 Save, | |
829 }; | |
830 | |
831 Mode mode; | |
832 | |
833 // Title to be used for the dialog. This may be empty for the default title, | |
834 // which will be either "Open" or "Save" depending on the mode. | |
835 string16 title; | |
836 | |
837 // Default file name to select in the dialog. | |
838 FilePath default_file_name; | |
839 }; | |
840 | |
841 struct ViewMsg_ExtensionExtentInfo { | |
842 std::string extension_id; | |
843 ExtensionExtent web_extent; | |
844 ExtensionExtent browse_extent; | |
845 }; | |
846 | |
847 struct ViewMsg_ExtensionExtentsUpdated_Params { | |
848 // Describes the installed extension apps and the URLs they cover. | |
849 std::vector<ViewMsg_ExtensionExtentInfo> extension_apps; | |
850 }; | |
851 | |
852 struct ViewMsg_DeviceOrientationUpdated_Params { | |
853 // These fields have the same meaning as in device_orientation::Orientation. | |
854 bool can_provide_alpha; | |
855 double alpha; | |
856 bool can_provide_beta; | |
857 double beta; | |
858 bool can_provide_gamma; | |
859 double gamma; | |
860 }; | |
861 | 111 |
862 // Values that may be OR'd together to form the 'flags' parameter of the | 112 // Values that may be OR'd together to form the 'flags' parameter of the |
863 // ViewMsg_EnablePreferredSizeChangedMode message. | 113 // ViewMsg_EnablePreferredSizeChangedMode message. |
864 enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags { | 114 enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags { |
865 kPreferredSizeNothing, | 115 kPreferredSizeNothing, |
866 kPreferredSizeWidth = 1 << 0, | 116 kPreferredSizeWidth = 1 << 0, |
867 // Requesting the height currently requires a polling loop in render_view.cc. | 117 // Requesting the height currently requires a polling loop in render_view.cc. |
868 kPreferredSizeHeightThisIsSlow = 1 << 1, | 118 kPreferredSizeHeightThisIsSlow = 1 << 1, |
869 }; | 119 }; |
870 | 120 |
871 // Parameters structure for ViewHostMsg_ExtensionRequest. | |
872 struct ViewHostMsg_DomMessage_Params { | |
873 // Message name. | |
874 std::string name; | |
875 | |
876 // List of message arguments. | |
877 ListValue arguments; | |
878 | |
879 // URL of the frame request was sent from. | |
880 GURL source_url; | |
881 | |
882 // Unique request id to match requests and responses. | |
883 int request_id; | |
884 | |
885 // True if request has a callback specified. | |
886 bool has_callback; | |
887 | |
888 // True if request is executed in response to an explicit user gesture. | |
889 bool user_gesture; | |
890 }; | |
891 | |
892 struct ViewHostMsg_OpenFileSystemRequest_Params { | |
893 // The routing ID of the view initiating the request. | |
894 int routing_id; | |
895 | |
896 // The response should have this id. | |
897 int request_id; | |
898 | |
899 // The origin doing the initiating. | |
900 GURL origin_url; | |
901 | |
902 // The requested FileSystem type. | |
903 WebKit::WebFileSystem::Type type; | |
904 | |
905 // Indicates how much storage space (in bytes) the caller expects to need. | |
906 int64 requested_size; | |
907 }; | |
908 | |
909 namespace IPC { | 121 namespace IPC { |
910 | 122 |
911 template <> | |
912 struct ParamTraits<ResourceType::Type> { | |
913 typedef ResourceType::Type param_type; | |
914 static void Write(Message* m, const param_type& p) { | |
915 m->WriteInt(p); | |
916 } | |
917 static bool Read(const Message* m, void** iter, param_type* p) { | |
918 int type; | |
919 if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) | |
920 return false; | |
921 *p = ResourceType::FromInt(type); | |
922 return true; | |
923 } | |
924 static void Log(const param_type& p, std::string* l) { | |
925 std::string type; | |
926 switch (p) { | |
927 case ResourceType::MAIN_FRAME: | |
928 type = "MAIN_FRAME"; | |
929 break; | |
930 case ResourceType::SUB_FRAME: | |
931 type = "SUB_FRAME"; | |
932 break; | |
933 case ResourceType::SUB_RESOURCE: | |
934 type = "SUB_RESOURCE"; | |
935 break; | |
936 case ResourceType::OBJECT: | |
937 type = "OBJECT"; | |
938 break; | |
939 case ResourceType::MEDIA: | |
940 type = "MEDIA"; | |
941 break; | |
942 default: | |
943 type = "UNKNOWN"; | |
944 break; | |
945 } | |
946 | |
947 LogParam(type, l); | |
948 } | |
949 }; | |
950 | |
951 // Traits for ViewMsg_Navigate_Params structure to pack/unpack. | |
952 template <> | |
953 struct ParamTraits<ViewMsg_Navigate_Params> { | |
954 typedef ViewMsg_Navigate_Params param_type; | |
955 static void Write(Message* m, const param_type& p); | |
956 static bool Read(const Message* m, void** iter, param_type* p); | |
957 static void Log(const param_type& p, std::string* l); | |
958 }; | |
959 | |
960 template<> | |
961 struct ParamTraits<ViewMsg_Navigate_Params::NavigationType> { | |
962 typedef ViewMsg_Navigate_Params::NavigationType param_type; | |
963 static void Write(Message* m, const param_type& p) { | |
964 m->WriteInt(p); | |
965 } | |
966 static bool Read(const Message* m, void** iter, param_type* p) { | |
967 int type; | |
968 if (!m->ReadInt(iter, &type)) | |
969 return false; | |
970 *p = static_cast<ViewMsg_Navigate_Params::NavigationType>(type); | |
971 return true; | |
972 } | |
973 static void Log(const param_type& p, std::string* l) { | |
974 std::string event; | |
975 switch (p) { | |
976 case ViewMsg_Navigate_Params::RELOAD: | |
977 event = "NavigationType_RELOAD"; | |
978 break; | |
979 | |
980 case ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE: | |
981 event = "NavigationType_RELOAD_IGNORING_CACHE"; | |
982 break; | |
983 | |
984 case ViewMsg_Navigate_Params::RESTORE: | |
985 event = "NavigationType_RESTORE"; | |
986 break; | |
987 | |
988 case ViewMsg_Navigate_Params::NORMAL: | |
989 event = "NavigationType_NORMA"; | |
990 break; | |
991 | |
992 default: | |
993 event = "NavigationType_UNKNOWN"; | |
994 break; | |
995 } | |
996 LogParam(event, l); | |
997 } | |
998 }; | |
999 | |
1000 // Traits for FormField_Params structure to pack/unpack. | 123 // Traits for FormField_Params structure to pack/unpack. |
1001 template <> | 124 template <> |
1002 struct ParamTraits<webkit_glue::FormField> { | 125 struct ParamTraits<webkit_glue::FormField> { |
1003 typedef webkit_glue::FormField param_type; | 126 typedef webkit_glue::FormField param_type; |
1004 static void Write(Message* m, const param_type& p); | 127 static void Write(Message* m, const param_type& p); |
1005 static bool Read(const Message* m, void** iter, param_type* p); | 128 static bool Read(const Message* m, void** iter, param_type* p); |
1006 static void Log(const param_type& p, std::string* l); | 129 static void Log(const param_type& p, std::string* l); |
1007 }; | 130 }; |
1008 | 131 |
| 132 #if defined(OS_MACOSX) |
1009 // Traits for FontDescriptor structure to pack/unpack. | 133 // Traits for FontDescriptor structure to pack/unpack. |
1010 template <> | 134 template <> |
1011 struct ParamTraits<FontDescriptor> { | 135 struct ParamTraits<FontDescriptor> { |
1012 typedef FontDescriptor param_type; | 136 typedef FontDescriptor param_type; |
1013 static void Write(Message* m, const param_type& p) { | 137 static void Write(Message* m, const param_type& p); |
1014 WriteParam(m, p.font_name); | 138 static bool Read(const Message* m, void** iter, param_type* p); |
1015 WriteParam(m, p.font_point_size); | 139 static void Log(const param_type& p, std::string* l); |
1016 } | |
1017 static bool Read(const Message* m, void** iter, param_type* p) { | |
1018 return( | |
1019 ReadParam(m, iter, &p->font_name) && | |
1020 ReadParam(m, iter, &p->font_point_size)); | |
1021 } | |
1022 static void Log(const param_type& p, std::string* l) { | |
1023 l->append("<FontDescriptor>"); | |
1024 } | |
1025 }; | 140 }; |
1026 | 141 #endif |
1027 // Traits for ViewHostMsg_GetSearchProviderInstallState_Params structure to | |
1028 // pack/unpack. | |
1029 template <> | |
1030 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { | |
1031 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; | |
1032 static void Write(Message* m, const param_type& p) { | |
1033 m->WriteInt(p.state); | |
1034 } | |
1035 static bool Read(const Message* m, void** iter, param_type* p) { | |
1036 int type; | |
1037 if (!m->ReadInt(iter, &type)) | |
1038 return false; | |
1039 p->state = static_cast<param_type::State>(type); | |
1040 return true; | |
1041 } | |
1042 static void Log(const param_type& p, std::string* l) { | |
1043 std::string state; | |
1044 switch (p.state) { | |
1045 case ViewHostMsg_GetSearchProviderInstallState_Params::DENIED: | |
1046 state = "ViewHostMsg_GetSearchProviderInstallState_Params::DENIED"; | |
1047 break; | |
1048 case ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED: | |
1049 state = | |
1050 "ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED"; | |
1051 break; | |
1052 case ViewHostMsg_GetSearchProviderInstallState_Params:: | |
1053 INSTALLED_BUT_NOT_DEFAULT: | |
1054 state = "ViewHostMsg_GetSearchProviderInstallState_Params::" | |
1055 "INSTALLED_BUT_NOT_DEFAULT"; | |
1056 break; | |
1057 case ViewHostMsg_GetSearchProviderInstallState_Params:: | |
1058 INSTALLED_AS_DEFAULT: | |
1059 state = "ViewHostMsg_GetSearchProviderInstallState_Params::" | |
1060 "INSTALLED_AS_DEFAULT"; | |
1061 break; | |
1062 default: | |
1063 state = "UNKNOWN"; | |
1064 break; | |
1065 } | |
1066 LogParam(state, l); | |
1067 } | |
1068 }; | |
1069 | |
1070 // Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack. | |
1071 template <> | |
1072 struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { | |
1073 typedef ViewHostMsg_FrameNavigate_Params param_type; | |
1074 static void Write(Message* m, const param_type& p) { | |
1075 WriteParam(m, p.page_id); | |
1076 WriteParam(m, p.url); | |
1077 WriteParam(m, p.referrer); | |
1078 WriteParam(m, p.transition); | |
1079 WriteParam(m, p.redirects); | |
1080 WriteParam(m, p.should_update_history); | |
1081 WriteParam(m, p.searchable_form_url); | |
1082 WriteParam(m, p.searchable_form_encoding); | |
1083 WriteParam(m, p.password_form); | |
1084 WriteParam(m, p.security_info); | |
1085 WriteParam(m, p.gesture); | |
1086 WriteParam(m, p.contents_mime_type); | |
1087 WriteParam(m, p.is_post); | |
1088 WriteParam(m, p.is_content_filtered); | |
1089 WriteParam(m, p.http_status_code); | |
1090 } | |
1091 static bool Read(const Message* m, void** iter, param_type* p) { | |
1092 return | |
1093 ReadParam(m, iter, &p->page_id) && | |
1094 ReadParam(m, iter, &p->url) && | |
1095 ReadParam(m, iter, &p->referrer) && | |
1096 ReadParam(m, iter, &p->transition) && | |
1097 ReadParam(m, iter, &p->redirects) && | |
1098 ReadParam(m, iter, &p->should_update_history) && | |
1099 ReadParam(m, iter, &p->searchable_form_url) && | |
1100 ReadParam(m, iter, &p->searchable_form_encoding) && | |
1101 ReadParam(m, iter, &p->password_form) && | |
1102 ReadParam(m, iter, &p->security_info) && | |
1103 ReadParam(m, iter, &p->gesture) && | |
1104 ReadParam(m, iter, &p->contents_mime_type) && | |
1105 ReadParam(m, iter, &p->is_post) && | |
1106 ReadParam(m, iter, &p->is_content_filtered) && | |
1107 ReadParam(m, iter, &p->http_status_code); | |
1108 } | |
1109 static void Log(const param_type& p, std::string* l) { | |
1110 l->append("("); | |
1111 LogParam(p.page_id, l); | |
1112 l->append(", "); | |
1113 LogParam(p.url, l); | |
1114 l->append(", "); | |
1115 LogParam(p.referrer, l); | |
1116 l->append(", "); | |
1117 LogParam(p.transition, l); | |
1118 l->append(", "); | |
1119 LogParam(p.redirects, l); | |
1120 l->append(", "); | |
1121 LogParam(p.should_update_history, l); | |
1122 l->append(", "); | |
1123 LogParam(p.searchable_form_url, l); | |
1124 l->append(", "); | |
1125 LogParam(p.searchable_form_encoding, l); | |
1126 l->append(", "); | |
1127 LogParam(p.password_form, l); | |
1128 l->append(", "); | |
1129 LogParam(p.security_info, l); | |
1130 l->append(", "); | |
1131 LogParam(p.gesture, l); | |
1132 l->append(", "); | |
1133 LogParam(p.contents_mime_type, l); | |
1134 l->append(", "); | |
1135 LogParam(p.is_post, l); | |
1136 l->append(", "); | |
1137 LogParam(p.is_content_filtered, l); | |
1138 l->append(", "); | |
1139 LogParam(p.http_status_code, l); | |
1140 l->append(")"); | |
1141 } | |
1142 }; | |
1143 | 142 |
1144 template <> | 143 template <> |
1145 struct ParamTraits<ContextMenuParams> { | 144 struct ParamTraits<ContextMenuParams> { |
1146 typedef ContextMenuParams param_type; | 145 typedef ContextMenuParams param_type; |
1147 static void Write(Message* m, const param_type& p); | 146 static void Write(Message* m, const param_type& p); |
1148 static bool Read(const Message* m, void** iter, param_type* p); | 147 static bool Read(const Message* m, void** iter, param_type* p); |
1149 static void Log(const param_type& p, std::string* l); | 148 static void Log(const param_type& p, std::string* l); |
1150 }; | |
1151 | |
1152 // Traits for ViewHostMsg_UpdateRect_Params structure to pack/unpack. | |
1153 template <> | |
1154 struct ParamTraits<ViewHostMsg_UpdateRect_Params> { | |
1155 typedef ViewHostMsg_UpdateRect_Params param_type; | |
1156 static void Write(Message* m, const param_type& p); | |
1157 static bool Read(const Message* m, void** iter, param_type* p); | |
1158 static void Log(const param_type& p, std::string* l); | |
1159 }; | 149 }; |
1160 | 150 |
1161 template <> | 151 template <> |
1162 struct ParamTraits<webkit_glue::WebPluginGeometry> { | 152 struct ParamTraits<webkit_glue::WebPluginGeometry> { |
1163 typedef webkit_glue::WebPluginGeometry param_type; | 153 typedef webkit_glue::WebPluginGeometry param_type; |
1164 static void Write(Message* m, const param_type& p); | 154 static void Write(Message* m, const param_type& p); |
1165 static bool Read(const Message* m, void** iter, param_type* p); | 155 static bool Read(const Message* m, void** iter, param_type* p); |
1166 static void Log(const param_type& p, std::string* l); | 156 static void Log(const param_type& p, std::string* l); |
1167 }; | 157 }; |
1168 | 158 |
(...skipping 16 matching lines...) Expand all Loading... |
1185 | 175 |
1186 // Traits for webkit_glue::PasswordFormDomManager::FillData. | 176 // Traits for webkit_glue::PasswordFormDomManager::FillData. |
1187 template <> | 177 template <> |
1188 struct ParamTraits<webkit_glue::PasswordFormFillData> { | 178 struct ParamTraits<webkit_glue::PasswordFormFillData> { |
1189 typedef webkit_glue::PasswordFormFillData param_type; | 179 typedef webkit_glue::PasswordFormFillData param_type; |
1190 static void Write(Message* m, const param_type& p); | 180 static void Write(Message* m, const param_type& p); |
1191 static bool Read(const Message* m, void** iter, param_type* r); | 181 static bool Read(const Message* m, void** iter, param_type* r); |
1192 static void Log(const param_type& p, std::string* l); | 182 static void Log(const param_type& p, std::string* l); |
1193 }; | 183 }; |
1194 | 184 |
1195 template<> | |
1196 struct ParamTraits<NavigationGesture> { | |
1197 typedef NavigationGesture param_type; | |
1198 static void Write(Message* m, const param_type& p) { | |
1199 m->WriteInt(p); | |
1200 } | |
1201 static bool Read(const Message* m, void** iter, param_type* p) { | |
1202 int type; | |
1203 if (!m->ReadInt(iter, &type)) | |
1204 return false; | |
1205 *p = static_cast<NavigationGesture>(type); | |
1206 return true; | |
1207 } | |
1208 static void Log(const param_type& p, std::string* l) { | |
1209 std::string event; | |
1210 switch (p) { | |
1211 case NavigationGestureUser: | |
1212 event = "GESTURE_USER"; | |
1213 break; | |
1214 case NavigationGestureAuto: | |
1215 event = "GESTURE_AUTO"; | |
1216 break; | |
1217 default: | |
1218 event = "GESTURE_UNKNOWN"; | |
1219 break; | |
1220 } | |
1221 LogParam(event, l); | |
1222 } | |
1223 }; | |
1224 | |
1225 // Traits for ViewMsg_Close_Params. | |
1226 template <> | |
1227 struct ParamTraits<ViewMsg_ClosePage_Params> { | |
1228 typedef ViewMsg_ClosePage_Params param_type; | |
1229 static void Write(Message* m, const param_type& p) { | |
1230 WriteParam(m, p.closing_process_id); | |
1231 WriteParam(m, p.closing_route_id); | |
1232 WriteParam(m, p.for_cross_site_transition); | |
1233 WriteParam(m, p.new_render_process_host_id); | |
1234 WriteParam(m, p.new_request_id); | |
1235 } | |
1236 | |
1237 static bool Read(const Message* m, void** iter, param_type* r) { | |
1238 return ReadParam(m, iter, &r->closing_process_id) && | |
1239 ReadParam(m, iter, &r->closing_route_id) && | |
1240 ReadParam(m, iter, &r->for_cross_site_transition) && | |
1241 ReadParam(m, iter, &r->new_render_process_host_id) && | |
1242 ReadParam(m, iter, &r->new_request_id); | |
1243 } | |
1244 | |
1245 static void Log(const param_type& p, std::string* l) { | |
1246 l->append("("); | |
1247 LogParam(p.closing_process_id, l); | |
1248 l->append(", "); | |
1249 LogParam(p.closing_route_id, l); | |
1250 l->append(", "); | |
1251 LogParam(p.for_cross_site_transition, l); | |
1252 l->append(", "); | |
1253 LogParam(p.new_render_process_host_id, l); | |
1254 l->append(", "); | |
1255 LogParam(p.new_request_id, l); | |
1256 l->append(")"); | |
1257 } | |
1258 }; | |
1259 | |
1260 // Traits for ViewHostMsg_Resource_Request | |
1261 template <> | |
1262 struct ParamTraits<ViewHostMsg_Resource_Request> { | |
1263 typedef ViewHostMsg_Resource_Request param_type; | |
1264 static void Write(Message* m, const param_type& p) { | |
1265 WriteParam(m, p.method); | |
1266 WriteParam(m, p.url); | |
1267 WriteParam(m, p.first_party_for_cookies); | |
1268 WriteParam(m, p.referrer); | |
1269 WriteParam(m, p.frame_origin); | |
1270 WriteParam(m, p.main_frame_origin); | |
1271 WriteParam(m, p.headers); | |
1272 WriteParam(m, p.load_flags); | |
1273 WriteParam(m, p.origin_child_id); | |
1274 WriteParam(m, p.resource_type); | |
1275 WriteParam(m, p.request_context); | |
1276 WriteParam(m, p.appcache_host_id); | |
1277 WriteParam(m, p.upload_data); | |
1278 WriteParam(m, p.download_to_file); | |
1279 WriteParam(m, p.host_renderer_id); | |
1280 WriteParam(m, p.host_render_view_id); | |
1281 } | |
1282 static bool Read(const Message* m, void** iter, param_type* r) { | |
1283 return | |
1284 ReadParam(m, iter, &r->method) && | |
1285 ReadParam(m, iter, &r->url) && | |
1286 ReadParam(m, iter, &r->first_party_for_cookies) && | |
1287 ReadParam(m, iter, &r->referrer) && | |
1288 ReadParam(m, iter, &r->frame_origin) && | |
1289 ReadParam(m, iter, &r->main_frame_origin) && | |
1290 ReadParam(m, iter, &r->headers) && | |
1291 ReadParam(m, iter, &r->load_flags) && | |
1292 ReadParam(m, iter, &r->origin_child_id) && | |
1293 ReadParam(m, iter, &r->resource_type) && | |
1294 ReadParam(m, iter, &r->request_context) && | |
1295 ReadParam(m, iter, &r->appcache_host_id) && | |
1296 ReadParam(m, iter, &r->upload_data) && | |
1297 ReadParam(m, iter, &r->download_to_file) && | |
1298 ReadParam(m, iter, &r->host_renderer_id) && | |
1299 ReadParam(m, iter, &r->host_render_view_id); | |
1300 } | |
1301 static void Log(const param_type& p, std::string* l) { | |
1302 l->append("("); | |
1303 LogParam(p.method, l); | |
1304 l->append(", "); | |
1305 LogParam(p.url, l); | |
1306 l->append(", "); | |
1307 LogParam(p.referrer, l); | |
1308 l->append(", "); | |
1309 LogParam(p.frame_origin, l); | |
1310 l->append(", "); | |
1311 LogParam(p.main_frame_origin, l); | |
1312 l->append(", "); | |
1313 LogParam(p.load_flags, l); | |
1314 l->append(", "); | |
1315 LogParam(p.origin_child_id, l); | |
1316 l->append(", "); | |
1317 LogParam(p.resource_type, l); | |
1318 l->append(", "); | |
1319 LogParam(p.request_context, l); | |
1320 l->append(", "); | |
1321 LogParam(p.appcache_host_id, l); | |
1322 l->append(", "); | |
1323 LogParam(p.download_to_file, l); | |
1324 l->append(", "); | |
1325 LogParam(p.host_renderer_id, l); | |
1326 l->append(", "); | |
1327 LogParam(p.host_render_view_id, l); | |
1328 l->append(")"); | |
1329 } | |
1330 }; | |
1331 | |
1332 template <> | 185 template <> |
1333 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { | 186 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { |
1334 typedef scoped_refptr<net::HttpResponseHeaders> param_type; | 187 typedef scoped_refptr<net::HttpResponseHeaders> param_type; |
1335 static void Write(Message* m, const param_type& p); | 188 static void Write(Message* m, const param_type& p); |
1336 static bool Read(const Message* m, void** iter, param_type* r); | 189 static bool Read(const Message* m, void** iter, param_type* r); |
1337 static void Log(const param_type& p, std::string* l); | 190 static void Log(const param_type& p, std::string* l); |
1338 }; | 191 }; |
1339 | 192 |
1340 // Traits for webkit_glue::ResourceLoaderBridge::LoadTimingInfo | 193 // Traits for webkit_glue::ResourceLoaderBridge::LoadTimingInfo |
1341 template <> | 194 template <> |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 | 389 |
1537 // Traits for FormData structure to pack/unpack. | 390 // Traits for FormData structure to pack/unpack. |
1538 template <> | 391 template <> |
1539 struct ParamTraits<webkit_glue::FormData> { | 392 struct ParamTraits<webkit_glue::FormData> { |
1540 typedef webkit_glue::FormData param_type; | 393 typedef webkit_glue::FormData param_type; |
1541 static void Write(Message* m, const param_type& p); | 394 static void Write(Message* m, const param_type& p); |
1542 static bool Read(const Message* m, void** iter, param_type* p); | 395 static bool Read(const Message* m, void** iter, param_type* p); |
1543 static void Log(const param_type& p, std::string* l); | 396 static void Log(const param_type& p, std::string* l); |
1544 }; | 397 }; |
1545 | 398 |
1546 // Traits for ViewMsg_Print_Params | |
1547 template <> | |
1548 struct ParamTraits<ViewMsg_Print_Params> { | |
1549 typedef ViewMsg_Print_Params param_type; | |
1550 static void Write(Message* m, const param_type& p) { | |
1551 WriteParam(m, p.page_size); | |
1552 WriteParam(m, p.printable_size); | |
1553 WriteParam(m, p.margin_top); | |
1554 WriteParam(m, p.margin_left); | |
1555 WriteParam(m, p.dpi); | |
1556 WriteParam(m, p.min_shrink); | |
1557 WriteParam(m, p.max_shrink); | |
1558 WriteParam(m, p.desired_dpi); | |
1559 WriteParam(m, p.document_cookie); | |
1560 WriteParam(m, p.selection_only); | |
1561 } | |
1562 static bool Read(const Message* m, void** iter, param_type* p) { | |
1563 return ReadParam(m, iter, &p->page_size) && | |
1564 ReadParam(m, iter, &p->printable_size) && | |
1565 ReadParam(m, iter, &p->margin_top) && | |
1566 ReadParam(m, iter, &p->margin_left) && | |
1567 ReadParam(m, iter, &p->dpi) && | |
1568 ReadParam(m, iter, &p->min_shrink) && | |
1569 ReadParam(m, iter, &p->max_shrink) && | |
1570 ReadParam(m, iter, &p->desired_dpi) && | |
1571 ReadParam(m, iter, &p->document_cookie) && | |
1572 ReadParam(m, iter, &p->selection_only); | |
1573 } | |
1574 static void Log(const param_type& p, std::string* l) { | |
1575 l->append("<ViewMsg_Print_Params>"); | |
1576 } | |
1577 }; | |
1578 | |
1579 // Traits for ViewMsg_PrintPage_Params | |
1580 template <> | |
1581 struct ParamTraits<ViewMsg_PrintPage_Params> { | |
1582 typedef ViewMsg_PrintPage_Params param_type; | |
1583 static void Write(Message* m, const param_type& p) { | |
1584 WriteParam(m, p.params); | |
1585 WriteParam(m, p.page_number); | |
1586 } | |
1587 static bool Read(const Message* m, void** iter, param_type* p) { | |
1588 return ReadParam(m, iter, &p->params) && | |
1589 ReadParam(m, iter, &p->page_number); | |
1590 } | |
1591 static void Log(const param_type& p, std::string* l) { | |
1592 l->append("<ViewMsg_PrintPage_Params>"); | |
1593 } | |
1594 }; | |
1595 | |
1596 // Traits for ViewMsg_PrintPages_Params | |
1597 template <> | |
1598 struct ParamTraits<ViewMsg_PrintPages_Params> { | |
1599 typedef ViewMsg_PrintPages_Params param_type; | |
1600 static void Write(Message* m, const param_type& p) { | |
1601 WriteParam(m, p.params); | |
1602 WriteParam(m, p.pages); | |
1603 } | |
1604 static bool Read(const Message* m, void** iter, param_type* p) { | |
1605 return ReadParam(m, iter, &p->params) && | |
1606 ReadParam(m, iter, &p->pages); | |
1607 } | |
1608 static void Log(const param_type& p, std::string* l) { | |
1609 l->append("<ViewMsg_PrintPages_Params>"); | |
1610 } | |
1611 }; | |
1612 | |
1613 // Traits for ViewHostMsg_DidPrintPage_Params | |
1614 template <> | |
1615 struct ParamTraits<ViewHostMsg_DidPrintPage_Params> { | |
1616 typedef ViewHostMsg_DidPrintPage_Params param_type; | |
1617 static void Write(Message* m, const param_type& p) { | |
1618 WriteParam(m, p.metafile_data_handle); | |
1619 WriteParam(m, p.data_size); | |
1620 WriteParam(m, p.document_cookie); | |
1621 WriteParam(m, p.page_number); | |
1622 WriteParam(m, p.actual_shrink); | |
1623 WriteParam(m, p.page_size); | |
1624 WriteParam(m, p.content_area); | |
1625 WriteParam(m, p.has_visible_overlays); | |
1626 } | |
1627 static bool Read(const Message* m, void** iter, param_type* p) { | |
1628 return ReadParam(m, iter, &p->metafile_data_handle) && | |
1629 ReadParam(m, iter, &p->data_size) && | |
1630 ReadParam(m, iter, &p->document_cookie) && | |
1631 ReadParam(m, iter, &p->page_number) && | |
1632 ReadParam(m, iter, &p->actual_shrink) && | |
1633 ReadParam(m, iter, &p->page_size) && | |
1634 ReadParam(m, iter, &p->content_area) && | |
1635 ReadParam(m, iter, &p->has_visible_overlays); | |
1636 } | |
1637 static void Log(const param_type& p, std::string* l) { | |
1638 l->append("<ViewHostMsg_DidPrintPage_Params>"); | |
1639 } | |
1640 }; | |
1641 | |
1642 // Traits for reading/writing CSS Colors | 399 // Traits for reading/writing CSS Colors |
1643 template <> | 400 template <> |
1644 struct ParamTraits<CSSColors::CSSColorName> { | 401 struct ParamTraits<CSSColors::CSSColorName> { |
1645 typedef CSSColors::CSSColorName param_type; | 402 typedef CSSColors::CSSColorName param_type; |
1646 static void Write(Message* m, const param_type& p) { | 403 static void Write(Message* m, const param_type& p) { |
1647 WriteParam(m, static_cast<int>(p)); | 404 WriteParam(m, static_cast<int>(p)); |
1648 } | 405 } |
1649 static bool Read(const Message* m, void** iter, param_type* p) { | 406 static bool Read(const Message* m, void** iter, param_type* p) { |
1650 return ReadParam(m, iter, reinterpret_cast<int*>(p)); | 407 return ReadParam(m, iter, reinterpret_cast<int*>(p)); |
1651 } | 408 } |
1652 static void Log(const param_type& p, std::string* l) { | 409 static void Log(const param_type& p, std::string* l) { |
1653 l->append("<CSSColorName>"); | 410 l->append("<CSSColorName>"); |
1654 } | 411 } |
1655 }; | 412 }; |
1656 | 413 |
1657 | |
1658 // Traits for RendererPreferences structure to pack/unpack. | 414 // Traits for RendererPreferences structure to pack/unpack. |
1659 template <> | 415 template <> |
1660 struct ParamTraits<RendererPreferences> { | 416 struct ParamTraits<RendererPreferences> { |
1661 typedef RendererPreferences param_type; | 417 typedef RendererPreferences param_type; |
1662 static void Write(Message* m, const param_type& p); | 418 static void Write(Message* m, const param_type& p); |
1663 static bool Read(const Message* m, void** iter, param_type* p); | 419 static bool Read(const Message* m, void** iter, param_type* p); |
1664 static void Log(const param_type& p, std::string* l); | 420 static void Log(const param_type& p, std::string* l); |
1665 }; | 421 }; |
1666 | 422 |
1667 // Traits for WebPreferences structure to pack/unpack. | 423 // Traits for WebPreferences structure to pack/unpack. |
1668 template <> | 424 template <> |
1669 struct ParamTraits<WebPreferences> { | 425 struct ParamTraits<WebPreferences> { |
1670 typedef WebPreferences param_type; | 426 typedef WebPreferences param_type; |
1671 static void Write(Message* m, const param_type& p); | 427 static void Write(Message* m, const param_type& p); |
1672 static bool Read(const Message* m, void** iter, param_type* p); | 428 static bool Read(const Message* m, void** iter, param_type* p); |
1673 static void Log(const param_type& p, std::string* l); | 429 static void Log(const param_type& p, std::string* l); |
1674 }; | 430 }; |
1675 | 431 |
1676 // Traits for WebDropData | 432 // Traits for WebDropData |
1677 template <> | 433 template <> |
1678 struct ParamTraits<WebDropData> { | 434 struct ParamTraits<WebDropData> { |
1679 typedef WebDropData param_type; | 435 typedef WebDropData param_type; |
1680 static void Write(Message* m, const param_type& p); | 436 static void Write(Message* m, const param_type& p); |
1681 static bool Read(const Message* m, void** iter, param_type* p); | 437 static bool Read(const Message* m, void** iter, param_type* p); |
1682 static void Log(const param_type& p, std::string* l); | 438 static void Log(const param_type& p, std::string* l); |
1683 }; | 439 }; |
1684 | 440 |
1685 // Traits for AudioManager::Format. | |
1686 template <> | |
1687 struct ParamTraits<AudioManager::Format> { | |
1688 typedef AudioManager::Format param_type; | |
1689 static void Write(Message* m, const param_type& p) { | |
1690 m->WriteInt(p); | |
1691 } | |
1692 static bool Read(const Message* m, void** iter, param_type* p) { | |
1693 int type; | |
1694 if (!m->ReadInt(iter, &type)) | |
1695 return false; | |
1696 *p = static_cast<AudioManager::Format>(type); | |
1697 return true; | |
1698 } | |
1699 static void Log(const param_type& p, std::string* l) { | |
1700 std::string format; | |
1701 switch (p) { | |
1702 case AudioManager::AUDIO_PCM_LINEAR: | |
1703 format = "AUDIO_PCM_LINEAR"; | |
1704 break; | |
1705 case AudioManager::AUDIO_PCM_LOW_LATENCY: | |
1706 format = "AUDIO_PCM_LOW_LATENCY"; | |
1707 break; | |
1708 case AudioManager::AUDIO_MOCK: | |
1709 format = "AUDIO_MOCK"; | |
1710 break; | |
1711 default: | |
1712 format = "AUDIO_LAST_FORMAT"; | |
1713 break; | |
1714 } | |
1715 LogParam(format, l); | |
1716 } | |
1717 }; | |
1718 | |
1719 // Traits for ViewHostMsg_Audio_CreateStream_Params. | |
1720 template <> | |
1721 struct ParamTraits<ViewHostMsg_Audio_CreateStream_Params> { | |
1722 typedef ViewHostMsg_Audio_CreateStream_Params param_type; | |
1723 static void Write(Message* m, const param_type& p) { | |
1724 WriteParam(m, p.format); | |
1725 WriteParam(m, p.channels); | |
1726 WriteParam(m, p.sample_rate); | |
1727 WriteParam(m, p.bits_per_sample); | |
1728 WriteParam(m, p.packet_size); | |
1729 } | |
1730 static bool Read(const Message* m, void** iter, param_type* p) { | |
1731 return | |
1732 ReadParam(m, iter, &p->format) && | |
1733 ReadParam(m, iter, &p->channels) && | |
1734 ReadParam(m, iter, &p->sample_rate) && | |
1735 ReadParam(m, iter, &p->bits_per_sample) && | |
1736 ReadParam(m, iter, &p->packet_size); | |
1737 } | |
1738 static void Log(const param_type& p, std::string* l) { | |
1739 l->append("<ViewHostMsg_Audio_CreateStream_Params>("); | |
1740 LogParam(p.format, l); | |
1741 l->append(", "); | |
1742 LogParam(p.channels, l); | |
1743 l->append(", "); | |
1744 LogParam(p.sample_rate, l); | |
1745 l->append(", "); | |
1746 LogParam(p.bits_per_sample, l); | |
1747 l->append(", "); | |
1748 LogParam(p.packet_size, l); | |
1749 l->append(")"); | |
1750 } | |
1751 }; | |
1752 | |
1753 | |
1754 #if defined(OS_POSIX) | 441 #if defined(OS_POSIX) |
1755 | 442 |
1756 // TODO(port): this shouldn't exist. However, the plugin stuff is really using | 443 // TODO(port): this shouldn't exist. However, the plugin stuff is really using |
1757 // HWNDS (NativeView), and making Windows calls based on them. I've not figured | 444 // HWNDS (NativeView), and making Windows calls based on them. I've not figured |
1758 // out the deal with plugins yet. | 445 // out the deal with plugins yet. |
1759 template <> | 446 template <> |
1760 struct ParamTraits<gfx::NativeView> { | 447 struct ParamTraits<gfx::NativeView> { |
1761 typedef gfx::NativeView param_type; | 448 typedef gfx::NativeView param_type; |
1762 static void Write(Message* m, const param_type& p) { | 449 static void Write(Message* m, const param_type& p) { |
1763 NOTIMPLEMENTED(); | 450 NOTIMPLEMENTED(); |
1764 } | 451 } |
1765 | 452 |
1766 static bool Read(const Message* m, void** iter, param_type* p) { | 453 static bool Read(const Message* m, void** iter, param_type* p) { |
1767 NOTIMPLEMENTED(); | 454 NOTIMPLEMENTED(); |
1768 *p = NULL; | 455 *p = NULL; |
1769 return true; | 456 return true; |
1770 } | 457 } |
1771 | 458 |
1772 static void Log(const param_type& p, std::string* l) { | 459 static void Log(const param_type& p, std::string* l) { |
1773 l->append(StringPrintf("<gfx::NativeView>")); | 460 l->append(StringPrintf("<gfx::NativeView>")); |
1774 } | 461 } |
1775 }; | 462 }; |
1776 | 463 |
1777 #endif // defined(OS_POSIX) | 464 #endif // defined(OS_POSIX) |
1778 | 465 |
1779 template <> | 466 template <> |
1780 struct ParamTraits<ViewMsg_AudioStreamState_Params> { | |
1781 typedef ViewMsg_AudioStreamState_Params param_type; | |
1782 static void Write(Message* m, const param_type& p) { | |
1783 m->WriteInt(p.state); | |
1784 } | |
1785 static bool Read(const Message* m, void** iter, param_type* p) { | |
1786 int type; | |
1787 if (!m->ReadInt(iter, &type)) | |
1788 return false; | |
1789 p->state = static_cast<ViewMsg_AudioStreamState_Params::State>(type); | |
1790 return true; | |
1791 } | |
1792 static void Log(const param_type& p, std::string* l) { | |
1793 std::string state; | |
1794 switch (p.state) { | |
1795 case ViewMsg_AudioStreamState_Params::kPlaying: | |
1796 state = "ViewMsg_AudioStreamState_Params::kPlaying"; | |
1797 break; | |
1798 case ViewMsg_AudioStreamState_Params::kPaused: | |
1799 state = "ViewMsg_AudioStreamState_Params::kPaused"; | |
1800 break; | |
1801 case ViewMsg_AudioStreamState_Params::kError: | |
1802 state = "ViewMsg_AudioStreamState_Params::kError"; | |
1803 break; | |
1804 default: | |
1805 state = "UNKNOWN"; | |
1806 break; | |
1807 } | |
1808 LogParam(state, l); | |
1809 } | |
1810 }; | |
1811 | |
1812 template <> | |
1813 struct ParamTraits<ViewMsg_StopFinding_Params> { | |
1814 typedef ViewMsg_StopFinding_Params param_type; | |
1815 static void Write(Message* m, const param_type& p) { | |
1816 m->WriteInt(p.action); | |
1817 } | |
1818 static bool Read(const Message* m, void** iter, param_type* p) { | |
1819 int type; | |
1820 if (!m->ReadInt(iter, &type)) | |
1821 return false; | |
1822 p->action = static_cast<ViewMsg_StopFinding_Params::Action>(type); | |
1823 return true; | |
1824 } | |
1825 static void Log(const param_type& p, std::string* l) { | |
1826 std::string action; | |
1827 switch (p.action) { | |
1828 case ViewMsg_StopFinding_Params::kClearSelection: | |
1829 action = "ViewMsg_StopFinding_Params::kClearSelection"; | |
1830 break; | |
1831 case ViewMsg_StopFinding_Params::kKeepSelection: | |
1832 action = "ViewMsg_StopFinding_Params::kKeepSelection"; | |
1833 break; | |
1834 case ViewMsg_StopFinding_Params::kActivateSelection: | |
1835 action = "ViewMsg_StopFinding_Params::kActivateSelection"; | |
1836 break; | |
1837 default: | |
1838 action = "UNKNOWN"; | |
1839 break; | |
1840 } | |
1841 LogParam(action, l); | |
1842 } | |
1843 }; | |
1844 | |
1845 template <> | |
1846 struct ParamTraits<appcache::Status> { | 467 struct ParamTraits<appcache::Status> { |
1847 typedef appcache::Status param_type; | 468 typedef appcache::Status param_type; |
1848 static void Write(Message* m, const param_type& p) { | 469 static void Write(Message* m, const param_type& p) { |
1849 m->WriteInt(static_cast<int>(p)); | 470 m->WriteInt(static_cast<int>(p)); |
1850 } | 471 } |
1851 static bool Read(const Message* m, void** iter, param_type* p) { | 472 static bool Read(const Message* m, void** iter, param_type* p) { |
1852 int type; | 473 int type; |
1853 if (!m->ReadInt(iter, &type)) | 474 if (!m->ReadInt(iter, &type)) |
1854 return false; | 475 return false; |
1855 *p = static_cast<param_type>(type); | 476 *p = static_cast<param_type>(type); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 default: | 549 default: |
1929 state = "InvalidEventValue"; | 550 state = "InvalidEventValue"; |
1930 break; | 551 break; |
1931 } | 552 } |
1932 | 553 |
1933 LogParam(state, l); | 554 LogParam(state, l); |
1934 } | 555 } |
1935 }; | 556 }; |
1936 | 557 |
1937 template<> | 558 template<> |
1938 struct ParamTraits<WebMenuItem::Type> { | |
1939 typedef WebMenuItem::Type param_type; | |
1940 static void Write(Message* m, const param_type& p) { | |
1941 m->WriteInt(p); | |
1942 } | |
1943 static bool Read(const Message* m, void** iter, param_type* p) { | |
1944 int type; | |
1945 if (!m->ReadInt(iter, &type)) | |
1946 return false; | |
1947 *p = static_cast<WebMenuItem::Type>(type); | |
1948 return true; | |
1949 } | |
1950 static void Log(const param_type& p, std::string* l) { | |
1951 std::string type; | |
1952 switch (p) { | |
1953 case WebMenuItem::OPTION: | |
1954 type = "OPTION"; | |
1955 break; | |
1956 case WebMenuItem::GROUP: | |
1957 type = "GROUP"; | |
1958 break; | |
1959 case WebMenuItem::SEPARATOR: | |
1960 type = "SEPARATOR"; | |
1961 break; | |
1962 default: | |
1963 type = "UNKNOWN"; | |
1964 break; | |
1965 } | |
1966 LogParam(type, l); | |
1967 } | |
1968 }; | |
1969 | |
1970 template<> | |
1971 struct ParamTraits<WebMenuItem> { | 559 struct ParamTraits<WebMenuItem> { |
1972 typedef WebMenuItem param_type; | 560 typedef WebMenuItem param_type; |
1973 static void Write(Message* m, const param_type& p) { | 561 static void Write(Message* m, const param_type& p); |
1974 WriteParam(m, p.label); | 562 static bool Read(const Message* m, void** iter, param_type* p); |
1975 WriteParam(m, p.type); | 563 static void Log(const param_type& p, std::string* l); |
1976 WriteParam(m, p.enabled); | |
1977 WriteParam(m, p.checked); | |
1978 WriteParam(m, p.action); | |
1979 } | |
1980 static bool Read(const Message* m, void** iter, param_type* p) { | |
1981 return | |
1982 ReadParam(m, iter, &p->label) && | |
1983 ReadParam(m, iter, &p->type) && | |
1984 ReadParam(m, iter, &p->enabled) && | |
1985 ReadParam(m, iter, &p->checked) && | |
1986 ReadParam(m, iter, &p->action); | |
1987 } | |
1988 static void Log(const param_type& p, std::string* l) { | |
1989 l->append("("); | |
1990 LogParam(p.label, l); | |
1991 l->append(", "); | |
1992 LogParam(p.type, l); | |
1993 l->append(", "); | |
1994 LogParam(p.enabled, l); | |
1995 l->append(", "); | |
1996 LogParam(p.checked, l); | |
1997 l->append(", "); | |
1998 LogParam(p.action, l); | |
1999 l->append(")"); | |
2000 } | |
2001 }; | |
2002 | |
2003 // Traits for ViewHostMsg_ShowPopup_Params. | |
2004 template <> | |
2005 struct ParamTraits<ViewHostMsg_ShowPopup_Params> { | |
2006 typedef ViewHostMsg_ShowPopup_Params param_type; | |
2007 static void Write(Message* m, const param_type& p) { | |
2008 WriteParam(m, p.bounds); | |
2009 WriteParam(m, p.item_height); | |
2010 WriteParam(m, p.item_font_size); | |
2011 WriteParam(m, p.selected_item); | |
2012 WriteParam(m, p.popup_items); | |
2013 WriteParam(m, p.right_aligned); | |
2014 } | |
2015 static bool Read(const Message* m, void** iter, param_type* p) { | |
2016 return | |
2017 ReadParam(m, iter, &p->bounds) && | |
2018 ReadParam(m, iter, &p->item_height) && | |
2019 ReadParam(m, iter, &p->item_font_size) && | |
2020 ReadParam(m, iter, &p->selected_item) && | |
2021 ReadParam(m, iter, &p->popup_items) && | |
2022 ReadParam(m, iter, &p->right_aligned); | |
2023 } | |
2024 static void Log(const param_type& p, std::string* l) { | |
2025 l->append("("); | |
2026 LogParam(p.bounds, l); | |
2027 l->append(", "); | |
2028 LogParam(p.item_height, l); | |
2029 l->append(", "); | |
2030 LogParam(p.item_font_size, l); | |
2031 l->append(", "); | |
2032 LogParam(p.selected_item, l); | |
2033 l->append(", "); | |
2034 LogParam(p.popup_items, l); | |
2035 l->append(", "); | |
2036 LogParam(p.right_aligned, l); | |
2037 l->append(")"); | |
2038 } | |
2039 }; | |
2040 | |
2041 // Traits for ViewHostMsg_ScriptedPrint_Params. | |
2042 template <> | |
2043 struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> { | |
2044 typedef ViewHostMsg_ScriptedPrint_Params param_type; | |
2045 static void Write(Message* m, const param_type& p) { | |
2046 WriteParam(m, p.routing_id); | |
2047 WriteParam(m, p.host_window_id); | |
2048 WriteParam(m, p.cookie); | |
2049 WriteParam(m, p.expected_pages_count); | |
2050 WriteParam(m, p.has_selection); | |
2051 WriteParam(m, p.use_overlays); | |
2052 } | |
2053 static bool Read(const Message* m, void** iter, param_type* p) { | |
2054 return | |
2055 ReadParam(m, iter, &p->routing_id) && | |
2056 ReadParam(m, iter, &p->host_window_id) && | |
2057 ReadParam(m, iter, &p->cookie) && | |
2058 ReadParam(m, iter, &p->expected_pages_count) && | |
2059 ReadParam(m, iter, &p->has_selection) && | |
2060 ReadParam(m, iter, &p->use_overlays); | |
2061 } | |
2062 static void Log(const param_type& p, std::string* l) { | |
2063 l->append("("); | |
2064 LogParam(p.routing_id, l); | |
2065 l->append(", "); | |
2066 LogParam(p.host_window_id, l); | |
2067 l->append(", "); | |
2068 LogParam(p.cookie, l); | |
2069 l->append(", "); | |
2070 LogParam(p.expected_pages_count, l); | |
2071 l->append(", "); | |
2072 LogParam(p.has_selection, l); | |
2073 l->append(","); | |
2074 LogParam(p.use_overlays, l); | |
2075 l->append(")"); | |
2076 } | |
2077 }; | 564 }; |
2078 | 565 |
2079 template <> | 566 template <> |
2080 struct SimilarTypeTraits<ViewType::Type> { | 567 struct SimilarTypeTraits<ViewType::Type> { |
2081 typedef int Type; | 568 typedef int Type; |
2082 }; | 569 }; |
2083 | 570 |
2084 // Traits for URLPattern. | 571 // Traits for URLPattern. |
2085 template <> | 572 template <> |
2086 struct ParamTraits<URLPattern> { | 573 struct ParamTraits<URLPattern> { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 break; | 682 break; |
2196 default: | 683 default: |
2197 NOTIMPLEMENTED(); | 684 NOTIMPLEMENTED(); |
2198 control = "UNKNOWN"; | 685 control = "UNKNOWN"; |
2199 break; | 686 break; |
2200 } | 687 } |
2201 LogParam(control, l); | 688 LogParam(control, l); |
2202 } | 689 } |
2203 }; | 690 }; |
2204 | 691 |
2205 // Traits for ViewMsg_DOMStorageEvent_Params. | |
2206 template <> | |
2207 struct ParamTraits<ViewMsg_DOMStorageEvent_Params> { | |
2208 typedef ViewMsg_DOMStorageEvent_Params param_type; | |
2209 static void Write(Message* m, const param_type& p) { | |
2210 WriteParam(m, p.key_); | |
2211 WriteParam(m, p.old_value_); | |
2212 WriteParam(m, p.new_value_); | |
2213 WriteParam(m, p.origin_); | |
2214 WriteParam(m, p.url_); | |
2215 WriteParam(m, p.storage_type_); | |
2216 } | |
2217 static bool Read(const Message* m, void** iter, param_type* p) { | |
2218 return | |
2219 ReadParam(m, iter, &p->key_) && | |
2220 ReadParam(m, iter, &p->old_value_) && | |
2221 ReadParam(m, iter, &p->new_value_) && | |
2222 ReadParam(m, iter, &p->origin_) && | |
2223 ReadParam(m, iter, &p->url_) && | |
2224 ReadParam(m, iter, &p->storage_type_); | |
2225 } | |
2226 static void Log(const param_type& p, std::string* l) { | |
2227 l->append("("); | |
2228 LogParam(p.key_, l); | |
2229 l->append(", "); | |
2230 LogParam(p.old_value_, l); | |
2231 l->append(", "); | |
2232 LogParam(p.new_value_, l); | |
2233 l->append(", "); | |
2234 LogParam(p.origin_, l); | |
2235 l->append(", "); | |
2236 LogParam(p.url_, l); | |
2237 l->append(", "); | |
2238 LogParam(p.storage_type_, l); | |
2239 l->append(")"); | |
2240 } | |
2241 }; | |
2242 | |
2243 // Traits for ViewHostMsg_IDBFactoryOpen_Params. | |
2244 template <> | |
2245 struct ParamTraits<ViewHostMsg_IDBFactoryOpen_Params> { | |
2246 typedef ViewHostMsg_IDBFactoryOpen_Params param_type; | |
2247 static void Write(Message* m, const param_type& p) { | |
2248 WriteParam(m, p.routing_id_); | |
2249 WriteParam(m, p.response_id_); | |
2250 WriteParam(m, p.origin_); | |
2251 WriteParam(m, p.name_); | |
2252 WriteParam(m, p.description_); | |
2253 } | |
2254 static bool Read(const Message* m, void** iter, param_type* p) { | |
2255 return | |
2256 ReadParam(m, iter, &p->routing_id_) && | |
2257 ReadParam(m, iter, &p->response_id_) && | |
2258 ReadParam(m, iter, &p->origin_) && | |
2259 ReadParam(m, iter, &p->name_) && | |
2260 ReadParam(m, iter, &p->description_); | |
2261 } | |
2262 static void Log(const param_type& p, std::string* l) { | |
2263 l->append("("); | |
2264 LogParam(p.routing_id_, l); | |
2265 l->append(", "); | |
2266 LogParam(p.response_id_, l); | |
2267 l->append(", "); | |
2268 LogParam(p.origin_, l); | |
2269 l->append(", "); | |
2270 LogParam(p.name_, l); | |
2271 l->append(", "); | |
2272 LogParam(p.description_, l); | |
2273 l->append(")"); | |
2274 } | |
2275 }; | |
2276 | |
2277 // Traits for ViewHostMsg_IDBDatabaseCreateObjectStore_Params. | |
2278 template <> | |
2279 struct ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { | |
2280 typedef ViewHostMsg_IDBDatabaseCreateObjectStore_Params param_type; | |
2281 static void Write(Message* m, const param_type& p) { | |
2282 WriteParam(m, p.response_id_); | |
2283 WriteParam(m, p.name_); | |
2284 WriteParam(m, p.key_path_); | |
2285 WriteParam(m, p.auto_increment_); | |
2286 WriteParam(m, p.idb_database_id_); | |
2287 } | |
2288 static bool Read(const Message* m, void** iter, param_type* p) { | |
2289 return | |
2290 ReadParam(m, iter, &p->response_id_) && | |
2291 ReadParam(m, iter, &p->name_) && | |
2292 ReadParam(m, iter, &p->key_path_) && | |
2293 ReadParam(m, iter, &p->auto_increment_) && | |
2294 ReadParam(m, iter, &p->idb_database_id_); | |
2295 } | |
2296 static void Log(const param_type& p, std::string* l) { | |
2297 l->append("("); | |
2298 LogParam(p.response_id_, l); | |
2299 l->append(", "); | |
2300 LogParam(p.name_, l); | |
2301 l->append(", "); | |
2302 LogParam(p.key_path_, l); | |
2303 l->append(", "); | |
2304 LogParam(p.auto_increment_, l); | |
2305 l->append(", "); | |
2306 LogParam(p.idb_database_id_, l); | |
2307 l->append(")"); | |
2308 } | |
2309 }; | |
2310 | |
2311 // Traits for ViewHostMsg_IDBObjectStoreCreateIndex_Params. | |
2312 template <> | |
2313 struct ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { | |
2314 typedef ViewHostMsg_IDBObjectStoreCreateIndex_Params param_type; | |
2315 static void Write(Message* m, const param_type& p) { | |
2316 WriteParam(m, p.response_id_); | |
2317 WriteParam(m, p.name_); | |
2318 WriteParam(m, p.key_path_); | |
2319 WriteParam(m, p.unique_); | |
2320 WriteParam(m, p.idb_object_store_id_); | |
2321 } | |
2322 static bool Read(const Message* m, void** iter, param_type* p) { | |
2323 return | |
2324 ReadParam(m, iter, &p->response_id_) && | |
2325 ReadParam(m, iter, &p->name_) && | |
2326 ReadParam(m, iter, &p->key_path_) && | |
2327 ReadParam(m, iter, &p->unique_) && | |
2328 ReadParam(m, iter, &p->idb_object_store_id_); | |
2329 } | |
2330 static void Log(const param_type& p, std::string* l) { | |
2331 l->append("("); | |
2332 LogParam(p.response_id_, l); | |
2333 l->append(", "); | |
2334 LogParam(p.name_, l); | |
2335 l->append(", "); | |
2336 LogParam(p.key_path_, l); | |
2337 l->append(", "); | |
2338 LogParam(p.unique_, l); | |
2339 l->append(", "); | |
2340 LogParam(p.idb_object_store_id_, l); | |
2341 l->append(")"); | |
2342 } | |
2343 }; | |
2344 | |
2345 // Traits for ViewHostMsg_IDBObjectStoreOpenCursor_Params. | |
2346 template <> | |
2347 struct ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params> { | |
2348 typedef ViewHostMsg_IDBObjectStoreOpenCursor_Params param_type; | |
2349 static void Write(Message* m, const param_type& p) { | |
2350 WriteParam(m, p.response_id_); | |
2351 WriteParam(m, p.left_key_); | |
2352 WriteParam(m, p.right_key_); | |
2353 WriteParam(m, p.flags_); | |
2354 WriteParam(m, p.direction_); | |
2355 WriteParam(m, p.idb_object_store_id_); | |
2356 } | |
2357 static bool Read(const Message* m, void** iter, param_type* p) { | |
2358 return | |
2359 ReadParam(m, iter, &p->response_id_) && | |
2360 ReadParam(m, iter, &p->left_key_) && | |
2361 ReadParam(m, iter, &p->right_key_) && | |
2362 ReadParam(m, iter, &p->flags_) && | |
2363 ReadParam(m, iter, &p->direction_) && | |
2364 ReadParam(m, iter, &p->idb_object_store_id_); | |
2365 } | |
2366 static void Log(const param_type& p, std::string* l) { | |
2367 l->append("("); | |
2368 LogParam(p.response_id_, l); | |
2369 l->append(", "); | |
2370 LogParam(p.left_key_, l); | |
2371 l->append(", "); | |
2372 LogParam(p.right_key_, l); | |
2373 l->append(", "); | |
2374 LogParam(p.flags_, l); | |
2375 l->append(", "); | |
2376 LogParam(p.direction_, l); | |
2377 l->append(", "); | |
2378 LogParam(p.idb_object_store_id_, l); | |
2379 l->append(")"); | |
2380 } | |
2381 }; | |
2382 | |
2383 // Traits for ViewHostMsg_CreateWorker_Params | |
2384 template <> | |
2385 struct ParamTraits<ViewHostMsg_CreateWorker_Params> { | |
2386 typedef ViewHostMsg_CreateWorker_Params param_type; | |
2387 static void Write(Message* m, const param_type& p) { | |
2388 WriteParam(m, p.url); | |
2389 WriteParam(m, p.is_shared); | |
2390 WriteParam(m, p.name); | |
2391 WriteParam(m, p.document_id); | |
2392 WriteParam(m, p.render_view_route_id); | |
2393 WriteParam(m, p.route_id); | |
2394 WriteParam(m, p.parent_appcache_host_id); | |
2395 WriteParam(m, p.script_resource_appcache_id); | |
2396 } | |
2397 static bool Read(const Message* m, void** iter, param_type* p) { | |
2398 return | |
2399 ReadParam(m, iter, &p->url) && | |
2400 ReadParam(m, iter, &p->is_shared) && | |
2401 ReadParam(m, iter, &p->name) && | |
2402 ReadParam(m, iter, &p->document_id) && | |
2403 ReadParam(m, iter, &p->render_view_route_id) && | |
2404 ReadParam(m, iter, &p->route_id) && | |
2405 ReadParam(m, iter, &p->parent_appcache_host_id) && | |
2406 ReadParam(m, iter, &p->script_resource_appcache_id); | |
2407 } | |
2408 static void Log(const param_type& p, std::string* l) { | |
2409 l->append("("); | |
2410 LogParam(p.url, l); | |
2411 l->append(", "); | |
2412 LogParam(p.is_shared, l); | |
2413 l->append(", "); | |
2414 LogParam(p.name, l); | |
2415 l->append(", "); | |
2416 LogParam(p.document_id, l); | |
2417 l->append(", "); | |
2418 LogParam(p.render_view_route_id, l); | |
2419 l->append(","); | |
2420 LogParam(p.route_id, l); | |
2421 l->append(", "); | |
2422 LogParam(p.parent_appcache_host_id, l); | |
2423 l->append(","); | |
2424 LogParam(p.script_resource_appcache_id, l); | |
2425 l->append(")"); | |
2426 } | |
2427 }; | |
2428 | |
2429 // Traits for ShowNotification_Params | |
2430 template <> | |
2431 struct ParamTraits<ViewHostMsg_ShowNotification_Params> { | |
2432 typedef ViewHostMsg_ShowNotification_Params param_type; | |
2433 static void Write(Message* m, const param_type& p) { | |
2434 WriteParam(m, p.origin); | |
2435 WriteParam(m, p.is_html); | |
2436 WriteParam(m, p.contents_url); | |
2437 WriteParam(m, p.icon_url); | |
2438 WriteParam(m, p.title); | |
2439 WriteParam(m, p.body); | |
2440 WriteParam(m, p.direction); | |
2441 WriteParam(m, p.replace_id); | |
2442 WriteParam(m, p.notification_id); | |
2443 } | |
2444 static bool Read(const Message* m, void** iter, param_type* p) { | |
2445 return | |
2446 ReadParam(m, iter, &p->origin) && | |
2447 ReadParam(m, iter, &p->is_html) && | |
2448 ReadParam(m, iter, &p->contents_url) && | |
2449 ReadParam(m, iter, &p->icon_url) && | |
2450 ReadParam(m, iter, &p->title) && | |
2451 ReadParam(m, iter, &p->body) && | |
2452 ReadParam(m, iter, &p->direction) && | |
2453 ReadParam(m, iter, &p->replace_id) && | |
2454 ReadParam(m, iter, &p->notification_id); | |
2455 } | |
2456 static void Log(const param_type &p, std::string* l) { | |
2457 l->append("("); | |
2458 LogParam(p.origin, l); | |
2459 l->append(", "); | |
2460 LogParam(p.is_html, l); | |
2461 l->append(", "); | |
2462 LogParam(p.contents_url, l); | |
2463 l->append(", "); | |
2464 LogParam(p.icon_url, l); | |
2465 l->append(", "); | |
2466 LogParam(p.title, l); | |
2467 l->append(","); | |
2468 LogParam(p.body, l); | |
2469 l->append(","); | |
2470 LogParam(p.direction, l); | |
2471 l->append(","); | |
2472 LogParam(p.replace_id, l); | |
2473 l->append(","); | |
2474 LogParam(p.notification_id, l); | |
2475 l->append(")"); | |
2476 } | |
2477 }; | |
2478 | |
2479 // Traits for WebCookie | 692 // Traits for WebCookie |
2480 template <> | 693 template <> |
2481 struct ParamTraits<webkit_glue::WebCookie> { | 694 struct ParamTraits<webkit_glue::WebCookie> { |
2482 typedef webkit_glue::WebCookie param_type; | 695 typedef webkit_glue::WebCookie param_type; |
2483 static void Write(Message* m, const param_type& p); | 696 static void Write(Message* m, const param_type& p); |
2484 static bool Read(const Message* m, void** iter, param_type* p); | 697 static bool Read(const Message* m, void** iter, param_type* p); |
2485 static void Log(const param_type& p, std::string* l); | 698 static void Log(const param_type& p, std::string* l); |
2486 }; | 699 }; |
2487 | 700 |
2488 template<> | |
2489 struct ParamTraits<ViewMsg_ExecuteCode_Params> { | |
2490 typedef ViewMsg_ExecuteCode_Params param_type; | |
2491 static void Write(Message* m, const param_type& p) { | |
2492 WriteParam(m, p.request_id); | |
2493 WriteParam(m, p.extension_id); | |
2494 WriteParam(m, p.host_permissions); | |
2495 WriteParam(m, p.is_javascript); | |
2496 WriteParam(m, p.code); | |
2497 WriteParam(m, p.all_frames); | |
2498 } | |
2499 static bool Read(const Message* m, void** iter, param_type* p) { | |
2500 return | |
2501 ReadParam(m, iter, &p->request_id) && | |
2502 ReadParam(m, iter, &p->extension_id) && | |
2503 ReadParam(m, iter, &p->host_permissions) && | |
2504 ReadParam(m, iter, &p->is_javascript) && | |
2505 ReadParam(m, iter, &p->code) && | |
2506 ReadParam(m, iter, &p->all_frames); | |
2507 } | |
2508 static void Log(const param_type& p, std::string* l) { | |
2509 l->append("<ViewMsg_ExecuteCode_Params>"); | |
2510 } | |
2511 }; | |
2512 | |
2513 template<> | |
2514 struct ParamTraits<ViewMsg_New_Params> { | |
2515 typedef ViewMsg_New_Params param_type; | |
2516 static void Write(Message* m, const param_type& p) { | |
2517 WriteParam(m, p.parent_window); | |
2518 WriteParam(m, p.renderer_preferences); | |
2519 WriteParam(m, p.web_preferences); | |
2520 WriteParam(m, p.view_id); | |
2521 WriteParam(m, p.session_storage_namespace_id); | |
2522 WriteParam(m, p.frame_name); | |
2523 } | |
2524 | |
2525 static bool Read(const Message* m, void** iter, param_type* p) { | |
2526 return | |
2527 ReadParam(m, iter, &p->parent_window) && | |
2528 ReadParam(m, iter, &p->renderer_preferences) && | |
2529 ReadParam(m, iter, &p->web_preferences) && | |
2530 ReadParam(m, iter, &p->view_id) && | |
2531 ReadParam(m, iter, &p->session_storage_namespace_id) && | |
2532 ReadParam(m, iter, &p->frame_name); | |
2533 } | |
2534 static void Log(const param_type& p, std::string* l) { | |
2535 l->append("("); | |
2536 LogParam(p.parent_window, l); | |
2537 l->append(", "); | |
2538 LogParam(p.renderer_preferences, l); | |
2539 l->append(", "); | |
2540 LogParam(p.web_preferences, l); | |
2541 l->append(", "); | |
2542 LogParam(p.view_id, l); | |
2543 l->append(", "); | |
2544 LogParam(p.session_storage_namespace_id, l); | |
2545 l->append(", "); | |
2546 LogParam(p.frame_name, l); | |
2547 l->append(")"); | |
2548 } | |
2549 }; | |
2550 | |
2551 template <> | 701 template <> |
2552 struct SimilarTypeTraits<TranslateErrors::Type> { | 702 struct SimilarTypeTraits<TranslateErrors::Type> { |
2553 typedef int Type; | 703 typedef int Type; |
2554 }; | 704 }; |
2555 | 705 |
2556 template<> | |
2557 struct ParamTraits<ViewHostMsg_RunFileChooser_Params> { | |
2558 typedef ViewHostMsg_RunFileChooser_Params param_type; | |
2559 static void Write(Message* m, const param_type& p) { | |
2560 WriteParam(m, static_cast<int>(p.mode)); | |
2561 WriteParam(m, p.title); | |
2562 WriteParam(m, p.default_file_name); | |
2563 } | |
2564 static bool Read(const Message* m, void** iter, param_type* p) { | |
2565 int mode; | |
2566 if (!ReadParam(m, iter, &mode)) | |
2567 return false; | |
2568 if (mode != param_type::Open && | |
2569 mode != param_type::OpenMultiple && | |
2570 mode != param_type::Save) | |
2571 return false; | |
2572 p->mode = static_cast<param_type::Mode>(mode); | |
2573 return | |
2574 ReadParam(m, iter, &p->title) && | |
2575 ReadParam(m, iter, &p->default_file_name); | |
2576 }; | |
2577 static void Log(const param_type& p, std::string* l) { | |
2578 switch (p.mode) { | |
2579 case param_type::Open: | |
2580 l->append("(Open, "); | |
2581 break; | |
2582 case param_type::OpenMultiple: | |
2583 l->append("(OpenMultiple, "); | |
2584 break; | |
2585 case param_type::Save: | |
2586 l->append("(Save, "); | |
2587 break; | |
2588 default: | |
2589 l->append("(UNKNOWN, "); | |
2590 } | |
2591 LogParam(p.title, l); | |
2592 l->append(", "); | |
2593 LogParam(p.default_file_name, l); | |
2594 } | |
2595 }; | |
2596 | |
2597 template<> | |
2598 struct ParamTraits<ViewHostMsg_CreateWindow_Params> { | |
2599 typedef ViewHostMsg_CreateWindow_Params param_type; | |
2600 static void Write(Message* m, const param_type& p) { | |
2601 WriteParam(m, p.opener_id); | |
2602 WriteParam(m, p.user_gesture); | |
2603 WriteParam(m, p.window_container_type); | |
2604 WriteParam(m, p.session_storage_namespace_id); | |
2605 WriteParam(m, p.frame_name); | |
2606 } | |
2607 static bool Read(const Message* m, void** iter, param_type* p) { | |
2608 return | |
2609 ReadParam(m, iter, &p->opener_id) && | |
2610 ReadParam(m, iter, &p->user_gesture) && | |
2611 ReadParam(m, iter, &p->window_container_type) && | |
2612 ReadParam(m, iter, &p->session_storage_namespace_id) && | |
2613 ReadParam(m, iter, &p->frame_name); | |
2614 } | |
2615 static void Log(const param_type& p, std::string* l) { | |
2616 l->append("("); | |
2617 LogParam(p.opener_id, l); | |
2618 l->append(", "); | |
2619 LogParam(p.user_gesture, l); | |
2620 l->append(", "); | |
2621 LogParam(p.window_container_type, l); | |
2622 l->append(", "); | |
2623 LogParam(p.session_storage_namespace_id, l); | |
2624 l->append(", "); | |
2625 LogParam(p.frame_name, l); | |
2626 l->append(")"); | |
2627 } | |
2628 }; | |
2629 | |
2630 template <> | 706 template <> |
2631 struct ParamTraits<ExtensionExtent> { | 707 struct ParamTraits<ExtensionExtent> { |
2632 typedef ExtensionExtent param_type; | 708 typedef ExtensionExtent param_type; |
2633 static void Write(Message* m, const param_type& p); | 709 static void Write(Message* m, const param_type& p); |
2634 static bool Read(const Message* m, void** iter, param_type* p); | 710 static bool Read(const Message* m, void** iter, param_type* p); |
2635 static void Log(const param_type& p, std::string* l); | 711 static void Log(const param_type& p, std::string* l); |
2636 }; | 712 }; |
2637 | 713 |
2638 template <> | |
2639 struct ParamTraits<ViewMsg_ExtensionExtentInfo> { | |
2640 typedef ViewMsg_ExtensionExtentInfo param_type; | |
2641 static void Write(Message* m, const param_type& p) { | |
2642 WriteParam(m, p.extension_id); | |
2643 WriteParam(m, p.web_extent); | |
2644 WriteParam(m, p.browse_extent); | |
2645 } | |
2646 static bool Read(const Message* m, void** iter, param_type* p) { | |
2647 return ReadParam(m, iter, &p->extension_id) && | |
2648 ReadParam(m, iter, &p->web_extent) && | |
2649 ReadParam(m, iter, &p->browse_extent); | |
2650 } | |
2651 static void Log(const param_type& p, std::string* l) { | |
2652 LogParam(p.extension_id, l); | |
2653 } | |
2654 }; | |
2655 | |
2656 template <> | |
2657 struct ParamTraits<ViewMsg_ExtensionExtentsUpdated_Params> { | |
2658 typedef ViewMsg_ExtensionExtentsUpdated_Params param_type; | |
2659 static void Write(Message* m, const param_type& p) { | |
2660 WriteParam(m, p.extension_apps); | |
2661 } | |
2662 static bool Read(const Message* m, void** iter, param_type* p) { | |
2663 return ReadParam(m, iter, &p->extension_apps); | |
2664 } | |
2665 static void Log(const param_type& p, std::string* l) { | |
2666 LogParam(p.extension_apps, l); | |
2667 } | |
2668 }; | |
2669 | |
2670 template<> | 714 template<> |
2671 struct ParamTraits<appcache::AppCacheResourceInfo> { | 715 struct ParamTraits<appcache::AppCacheResourceInfo> { |
2672 typedef appcache::AppCacheResourceInfo param_type; | 716 typedef appcache::AppCacheResourceInfo param_type; |
2673 static void Write(Message* m, const param_type& p); | 717 static void Write(Message* m, const param_type& p); |
2674 static bool Read(const Message* m, void** iter, param_type* p); | 718 static bool Read(const Message* m, void** iter, param_type* p); |
2675 static void Log(const param_type& p, std::string* l); | 719 static void Log(const param_type& p, std::string* l); |
2676 }; | 720 }; |
2677 | 721 |
2678 template <> | 722 template <> |
2679 struct ParamTraits<appcache::AppCacheInfo> { | 723 struct ParamTraits<appcache::AppCacheInfo> { |
2680 typedef appcache::AppCacheInfo param_type; | 724 typedef appcache::AppCacheInfo param_type; |
2681 static void Write(Message* m, const param_type& p); | 725 static void Write(Message* m, const param_type& p); |
2682 static bool Read(const Message* m, void** iter, param_type* p); | 726 static bool Read(const Message* m, void** iter, param_type* p); |
2683 static void Log(const param_type& p, std::string* l); | 727 static void Log(const param_type& p, std::string* l); |
2684 }; | 728 }; |
2685 | 729 |
2686 template <> | 730 template <> |
2687 struct ParamTraits<WindowContainerType> { | |
2688 typedef WindowContainerType param_type; | |
2689 static void Write(Message* m, const param_type& p) { | |
2690 int val = static_cast<int>(p); | |
2691 WriteParam(m, val); | |
2692 } | |
2693 static bool Read(const Message* m, void** iter, param_type* p) { | |
2694 int val = 0; | |
2695 if (!ReadParam(m, iter, &val) || | |
2696 val < WINDOW_CONTAINER_TYPE_NORMAL || | |
2697 val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) | |
2698 return false; | |
2699 *p = static_cast<param_type>(val); | |
2700 return true; | |
2701 } | |
2702 static void Log(const param_type& p, std::string* l) { | |
2703 ParamTraits<int>::Log(static_cast<int>(p), l); | |
2704 } | |
2705 }; | |
2706 | |
2707 template <> | |
2708 struct ParamTraits<webkit_glue::WebAccessibility> { | 731 struct ParamTraits<webkit_glue::WebAccessibility> { |
2709 typedef webkit_glue::WebAccessibility param_type; | 732 typedef webkit_glue::WebAccessibility param_type; |
2710 static void Write(Message* m, const param_type& p); | 733 static void Write(Message* m, const param_type& p); |
2711 static bool Read(const Message* m, void** iter, param_type* p); | 734 static bool Read(const Message* m, void** iter, param_type* p); |
2712 static void Log(const param_type& p, std::string* l); | 735 static void Log(const param_type& p, std::string* l); |
2713 }; | 736 }; |
2714 | 737 |
2715 // Traits for ViewMsg_DeviceOrientationUpdated_Params | |
2716 // structure to pack/unpack. | |
2717 template <> | |
2718 struct ParamTraits<ViewMsg_DeviceOrientationUpdated_Params> { | |
2719 typedef ViewMsg_DeviceOrientationUpdated_Params param_type; | |
2720 static void Write(Message* m, const param_type& p) { | |
2721 WriteParam(m, p.can_provide_alpha); | |
2722 WriteParam(m, p.alpha); | |
2723 WriteParam(m, p.can_provide_beta); | |
2724 WriteParam(m, p.beta); | |
2725 WriteParam(m, p.can_provide_gamma); | |
2726 WriteParam(m, p.gamma); | |
2727 } | |
2728 static bool Read(const Message* m, void** iter, param_type* p) { | |
2729 return | |
2730 ReadParam(m, iter, &p->can_provide_alpha) && | |
2731 ReadParam(m, iter, &p->alpha) && | |
2732 ReadParam(m, iter, &p->can_provide_beta) && | |
2733 ReadParam(m, iter, &p->beta) && | |
2734 ReadParam(m, iter, &p->can_provide_gamma) && | |
2735 ReadParam(m, iter, &p->gamma); | |
2736 } | |
2737 static void Log(const param_type& p, std::string* l) { | |
2738 l->append("("); | |
2739 LogParam(p.can_provide_alpha, l); | |
2740 l->append(", "); | |
2741 LogParam(p.alpha, l); | |
2742 l->append(", "); | |
2743 LogParam(p.can_provide_beta, l); | |
2744 l->append(", "); | |
2745 LogParam(p.beta, l); | |
2746 l->append(", "); | |
2747 LogParam(p.can_provide_gamma, l); | |
2748 l->append(", "); | |
2749 LogParam(p.gamma, l); | |
2750 l->append(")"); | |
2751 } | |
2752 }; | |
2753 // Traits for ViewHostMsg_DomMessage_Params structure to pack/unpack. | |
2754 template <> | |
2755 struct ParamTraits<ViewHostMsg_DomMessage_Params> { | |
2756 typedef ViewHostMsg_DomMessage_Params param_type; | |
2757 static void Write(Message* m, const param_type& p) { | |
2758 WriteParam(m, p.name); | |
2759 WriteParam(m, p.arguments); | |
2760 WriteParam(m, p.source_url); | |
2761 WriteParam(m, p.request_id); | |
2762 WriteParam(m, p.has_callback); | |
2763 WriteParam(m, p.user_gesture); | |
2764 } | |
2765 static bool Read(const Message* m, void** iter, param_type* p) { | |
2766 return | |
2767 ReadParam(m, iter, &p->name) && | |
2768 ReadParam(m, iter, &p->arguments) && | |
2769 ReadParam(m, iter, &p->source_url) && | |
2770 ReadParam(m, iter, &p->request_id) && | |
2771 ReadParam(m, iter, &p->has_callback) && | |
2772 ReadParam(m, iter, &p->user_gesture); | |
2773 } | |
2774 static void Log(const param_type& p, std::string* l) { | |
2775 l->append("("); | |
2776 LogParam(p.name, l); | |
2777 l->append(", "); | |
2778 LogParam(p.arguments, l); | |
2779 l->append(", "); | |
2780 LogParam(p.source_url, l); | |
2781 l->append(", "); | |
2782 LogParam(p.request_id, l); | |
2783 l->append(", "); | |
2784 LogParam(p.has_callback, l); | |
2785 l->append(", "); | |
2786 LogParam(p.user_gesture, l); | |
2787 l->append(")"); | |
2788 } | |
2789 }; | |
2790 | |
2791 template <> | |
2792 struct ParamTraits<ViewHostMsg_OpenFileSystemRequest_Params> { | |
2793 typedef ViewHostMsg_OpenFileSystemRequest_Params param_type; | |
2794 static void Write(Message* m, const param_type& p) { | |
2795 WriteParam(m, p.routing_id); | |
2796 WriteParam(m, p.request_id); | |
2797 WriteParam(m, p.origin_url); | |
2798 WriteParam(m, p.type); | |
2799 WriteParam(m, p.requested_size); | |
2800 } | |
2801 static bool Read(const Message* m, void** iter, param_type* p) { | |
2802 return | |
2803 ReadParam(m, iter, &p->routing_id) && | |
2804 ReadParam(m, iter, &p->request_id) && | |
2805 ReadParam(m, iter, &p->origin_url) && | |
2806 ReadParam(m, iter, &p->type) && | |
2807 ReadParam(m, iter, &p->requested_size); | |
2808 } | |
2809 static void Log(const param_type& p, std::string* l) { | |
2810 l->append("("); | |
2811 LogParam(p.routing_id, l); | |
2812 l->append(", "); | |
2813 LogParam(p.request_id, l); | |
2814 l->append(", "); | |
2815 LogParam(p.origin_url, l); | |
2816 l->append(", "); | |
2817 LogParam(p.type, l); | |
2818 l->append(", "); | |
2819 LogParam(p.requested_size, l); | |
2820 l->append(")"); | |
2821 } | |
2822 }; | |
2823 | |
2824 } // namespace IPC | 738 } // namespace IPC |
2825 | 739 |
2826 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 740 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
2827 #include "ipc/ipc_message_macros.h" | 741 #include "ipc/ipc_message_macros.h" |
2828 | 742 |
2829 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 743 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
OLD | NEW |