| 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_PARAMS_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
| 6 #define CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "app/surface/transport_dib.h" | 12 #include "app/surface/transport_dib.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 19 #include "chrome/common/extensions/extension_extent.h" | 19 #include "chrome/common/extensions/extension_extent.h" |
| 20 #include "chrome/common/extensions/url_pattern.h" | 20 #include "chrome/common/extensions/url_pattern.h" |
| 21 #include "chrome/common/window_container_type.h" | |
| 22 #include "content/common/navigation_gesture.h" | |
| 23 #include "content/common/navigation_types.h" | 21 #include "content/common/navigation_types.h" |
| 24 #include "content/common/page_transition_types.h" | 22 #include "content/common/page_transition_types.h" |
| 25 #include "content/common/serialized_script_value.h" | 23 #include "content/common/serialized_script_value.h" |
| 26 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 27 #include "ipc/ipc_param_traits.h" | 25 #include "ipc/ipc_param_traits.h" |
| 28 #include "net/base/host_port_pair.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 29 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
| 30 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
| 31 #include "webkit/glue/password_form.h" | 29 #include "webkit/glue/password_form.h" |
| 32 #include "webkit/glue/webaccessibility.h" | 30 #include "webkit/glue/webaccessibility.h" |
| 33 #include "webkit/plugins/npapi/webplugin.h" | |
| 34 | 31 |
| 35 // TODO(erg): Split this file into $1_db_params.h, $1_audio_params.h, | 32 // TODO(erg): Split this file into $1_db_params.h, $1_audio_params.h, |
| 36 // $1_print_params.h and $1_render_params.h. | 33 // $1_print_params.h and $1_render_params.h. |
| 37 | 34 |
| 38 namespace net { | 35 namespace net { |
| 39 class UploadData; | 36 class UploadData; |
| 40 } | 37 } |
| 41 | 38 |
| 42 // The type of OSDD that the renderer is giving to the browser. | 39 // The type of OSDD that the renderer is giving to the browser. |
| 43 struct ViewHostMsg_PageHasOSDD_Type { | 40 struct ViewHostMsg_PageHasOSDD_Type { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return ViewHostMsg_GetSearchProviderInstallState_Params( | 114 return ViewHostMsg_GetSearchProviderInstallState_Params( |
| 118 INSTALLED_BUT_NOT_DEFAULT); | 115 INSTALLED_BUT_NOT_DEFAULT); |
| 119 } | 116 } |
| 120 | 117 |
| 121 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { | 118 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { |
| 122 return ViewHostMsg_GetSearchProviderInstallState_Params( | 119 return ViewHostMsg_GetSearchProviderInstallState_Params( |
| 123 INSTALLED_AS_DEFAULT); | 120 INSTALLED_AS_DEFAULT); |
| 124 } | 121 } |
| 125 }; | 122 }; |
| 126 | 123 |
| 127 // Parameters structure for ViewHostMsg_FrameNavigate, which has too many data | |
| 128 // parameters to be reasonably put in a predefined IPC message. | |
| 129 struct ViewHostMsg_FrameNavigate_Params { | |
| 130 ViewHostMsg_FrameNavigate_Params(); | |
| 131 ~ViewHostMsg_FrameNavigate_Params(); | |
| 132 | |
| 133 // Page ID of this navigation. The renderer creates a new unique page ID | |
| 134 // anytime a new session history entry is created. This means you'll get new | |
| 135 // page IDs for user actions, and the old page IDs will be reloaded when | |
| 136 // iframes are loaded automatically. | |
| 137 int32 page_id; | |
| 138 | |
| 139 // The frame ID for this navigation. The frame ID uniquely identifies the | |
| 140 // frame the navigation happened in for a given renderer. | |
| 141 int64 frame_id; | |
| 142 | |
| 143 // URL of the page being loaded. | |
| 144 GURL url; | |
| 145 | |
| 146 // URL of the referrer of this load. WebKit generates this based on the | |
| 147 // source of the event that caused the load. | |
| 148 GURL referrer; | |
| 149 | |
| 150 // The type of transition. | |
| 151 PageTransition::Type transition; | |
| 152 | |
| 153 // Lists the redirects that occurred on the way to the current page. This | |
| 154 // vector has the same format as reported by the WebDataSource in the glue, | |
| 155 // with the current page being the last one in the list (so even when | |
| 156 // there's no redirect, there will be one entry in the list. | |
| 157 std::vector<GURL> redirects; | |
| 158 | |
| 159 // Set to false if we want to update the session history but not update | |
| 160 // the browser history. E.g., on unreachable urls. | |
| 161 bool should_update_history; | |
| 162 | |
| 163 // See SearchableFormData for a description of these. | |
| 164 GURL searchable_form_url; | |
| 165 std::string searchable_form_encoding; | |
| 166 | |
| 167 // See password_form.h. | |
| 168 webkit_glue::PasswordForm password_form; | |
| 169 | |
| 170 // Information regarding the security of the connection (empty if the | |
| 171 // connection was not secure). | |
| 172 std::string security_info; | |
| 173 | |
| 174 // The gesture that initiated this navigation. | |
| 175 NavigationGesture gesture; | |
| 176 | |
| 177 // Contents MIME type of main frame. | |
| 178 std::string contents_mime_type; | |
| 179 | |
| 180 // True if this was a post request. | |
| 181 bool is_post; | |
| 182 | |
| 183 // Whether the frame navigation resulted in no change to the documents within | |
| 184 // the page. For example, the navigation may have just resulted in scrolling | |
| 185 // to a named anchor. | |
| 186 bool was_within_same_page; | |
| 187 | |
| 188 // The status code of the HTTP request. | |
| 189 int http_status_code; | |
| 190 | |
| 191 // Remote address of the socket which fetched this resource. | |
| 192 net::HostPortPair socket_address; | |
| 193 | |
| 194 // True if the connection was proxied. In this case, socket_address | |
| 195 // will represent the address of the proxy, rather than the remote host. | |
| 196 bool was_fetched_via_proxy; | |
| 197 | |
| 198 // Serialized history item state to store in the navigation entry. | |
| 199 std::string content_state; | |
| 200 }; | |
| 201 | |
| 202 // Values that may be OR'd together to form the 'flags' parameter of a | |
| 203 // ViewHostMsg_UpdateRect_Params structure. | |
| 204 struct ViewHostMsg_UpdateRect_Flags { | |
| 205 enum { | |
| 206 IS_RESIZE_ACK = 1 << 0, | |
| 207 IS_RESTORE_ACK = 1 << 1, | |
| 208 IS_REPAINT_ACK = 1 << 2, | |
| 209 }; | |
| 210 static bool is_resize_ack(int flags) { | |
| 211 return (flags & IS_RESIZE_ACK) != 0; | |
| 212 } | |
| 213 static bool is_restore_ack(int flags) { | |
| 214 return (flags & IS_RESTORE_ACK) != 0; | |
| 215 } | |
| 216 static bool is_repaint_ack(int flags) { | |
| 217 return (flags & IS_REPAINT_ACK) != 0; | |
| 218 } | |
| 219 }; | |
| 220 | |
| 221 struct ViewHostMsg_UpdateRect_Params { | |
| 222 ViewHostMsg_UpdateRect_Params(); | |
| 223 ~ViewHostMsg_UpdateRect_Params(); | |
| 224 | |
| 225 // The bitmap to be painted into the view at the locations specified by | |
| 226 // update_rects. | |
| 227 TransportDIB::Id bitmap; | |
| 228 | |
| 229 // The position and size of the bitmap. | |
| 230 gfx::Rect bitmap_rect; | |
| 231 | |
| 232 // The scroll offset. Only one of these can be non-zero, and if they are | |
| 233 // both zero, then it means there is no scrolling and the scroll_rect is | |
| 234 // ignored. | |
| 235 int dx; | |
| 236 int dy; | |
| 237 | |
| 238 // The rectangular region to scroll. | |
| 239 gfx::Rect scroll_rect; | |
| 240 | |
| 241 // The scroll offset of the render view. | |
| 242 gfx::Point scroll_offset; | |
| 243 | |
| 244 // The regions of the bitmap (in view coords) that contain updated pixels. | |
| 245 // In the case of scrolling, this includes the scroll damage rect. | |
| 246 std::vector<gfx::Rect> copy_rects; | |
| 247 | |
| 248 // The size of the RenderView when this message was generated. This is | |
| 249 // included so the host knows how large the view is from the perspective of | |
| 250 // the renderer process. This is necessary in case a resize operation is in | |
| 251 // progress. | |
| 252 gfx::Size view_size; | |
| 253 | |
| 254 // The area of the RenderView reserved for resize corner when this message | |
| 255 // was generated. Reported for the same reason as view_size is. | |
| 256 gfx::Rect resizer_rect; | |
| 257 | |
| 258 // New window locations for plugin child windows. | |
| 259 std::vector<webkit::npapi::WebPluginGeometry> plugin_window_moves; | |
| 260 | |
| 261 // The following describes the various bits that may be set in flags: | |
| 262 // | |
| 263 // ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK | |
| 264 // Indicates that this is a response to a ViewMsg_Resize message. | |
| 265 // | |
| 266 // ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK | |
| 267 // Indicates that this is a response to a ViewMsg_WasRestored message. | |
| 268 // | |
| 269 // ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK | |
| 270 // Indicates that this is a response to a ViewMsg_Repaint message. | |
| 271 // | |
| 272 // If flags is zero, then this message corresponds to an unsoliticed paint | |
| 273 // request by the render view. Any of the above bits may be set in flags, | |
| 274 // which would indicate that this paint message is an ACK for multiple | |
| 275 // request messages. | |
| 276 int flags; | |
| 277 }; | |
| 278 | |
| 279 // Parameters for a render request. | 124 // Parameters for a render request. |
| 280 struct ViewMsg_Print_Params { | 125 struct ViewMsg_Print_Params { |
| 281 ViewMsg_Print_Params(); | 126 ViewMsg_Print_Params(); |
| 282 ~ViewMsg_Print_Params(); | 127 ~ViewMsg_Print_Params(); |
| 283 | 128 |
| 284 // Physical size of the page, including non-printable margins, | 129 // Physical size of the page, including non-printable margins, |
| 285 // in pixels according to dpi. | 130 // in pixels according to dpi. |
| 286 gfx::Size page_size; | 131 gfx::Size page_size; |
| 287 | 132 |
| 288 // In pixels according to dpi_x and dpi_y. | 133 // In pixels according to dpi_x and dpi_y. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // Whether the code is JavaScript or CSS. | 272 // Whether the code is JavaScript or CSS. |
| 428 bool is_javascript; | 273 bool is_javascript; |
| 429 | 274 |
| 430 // String of code to execute. | 275 // String of code to execute. |
| 431 std::string code; | 276 std::string code; |
| 432 | 277 |
| 433 // Whether to inject into all frames, or only the root frame. | 278 // Whether to inject into all frames, or only the root frame. |
| 434 bool all_frames; | 279 bool all_frames; |
| 435 }; | 280 }; |
| 436 | 281 |
| 437 struct ViewHostMsg_CreateWindow_Params { | |
| 438 ViewHostMsg_CreateWindow_Params(); | |
| 439 ~ViewHostMsg_CreateWindow_Params(); | |
| 440 | |
| 441 // Routing ID of the view initiating the open. | |
| 442 int opener_id; | |
| 443 | |
| 444 // True if this open request came in the context of a user gesture. | |
| 445 bool user_gesture; | |
| 446 | |
| 447 // Type of window requested. | |
| 448 WindowContainerType window_container_type; | |
| 449 | |
| 450 // The session storage namespace ID this view should use. | |
| 451 int64 session_storage_namespace_id; | |
| 452 | |
| 453 // The name of the resulting frame that should be created (empty if none | |
| 454 // has been specified). | |
| 455 string16 frame_name; | |
| 456 | |
| 457 // The frame identifier of the frame initiating the open. | |
| 458 int64 opener_frame_id; | |
| 459 | |
| 460 // The URL of the frame initiating the open. | |
| 461 GURL opener_url; | |
| 462 | |
| 463 // The security origin of the frame initiating the open. | |
| 464 std::string opener_security_origin; | |
| 465 | |
| 466 // The URL that will be loaded in the new window (empty if none has been | |
| 467 // sepcified). | |
| 468 GURL target_url; | |
| 469 }; | |
| 470 | |
| 471 struct ViewHostMsg_RunFileChooser_Params { | |
| 472 enum Mode { | |
| 473 // Requires that the file exists before allowing the user to pick it. | |
| 474 Open, | |
| 475 | |
| 476 // Like Open, but allows picking multiple files to open. | |
| 477 OpenMultiple, | |
| 478 | |
| 479 // Like Open, but selects a folder. | |
| 480 OpenFolder, | |
| 481 | |
| 482 // Allows picking a nonexistent file, and prompts to overwrite if the file | |
| 483 // already exists. | |
| 484 Save, | |
| 485 }; | |
| 486 | |
| 487 ViewHostMsg_RunFileChooser_Params(); | |
| 488 ~ViewHostMsg_RunFileChooser_Params(); | |
| 489 | |
| 490 Mode mode; | |
| 491 | |
| 492 // Title to be used for the dialog. This may be empty for the default title, | |
| 493 // which will be either "Open" or "Save" depending on the mode. | |
| 494 string16 title; | |
| 495 | |
| 496 // Default file name to select in the dialog. | |
| 497 FilePath default_file_name; | |
| 498 | |
| 499 // A comma-separated MIME types such as "audio/*,text/plain", that is used | |
| 500 // to restrict selectable files to such types. | |
| 501 string16 accept_types; | |
| 502 }; | |
| 503 | |
| 504 struct ViewMsg_ExtensionLoaded_Params { | 282 struct ViewMsg_ExtensionLoaded_Params { |
| 505 ViewMsg_ExtensionLoaded_Params(); | 283 ViewMsg_ExtensionLoaded_Params(); |
| 506 ~ViewMsg_ExtensionLoaded_Params(); | 284 ~ViewMsg_ExtensionLoaded_Params(); |
| 507 explicit ViewMsg_ExtensionLoaded_Params(const Extension* extension); | 285 explicit ViewMsg_ExtensionLoaded_Params(const Extension* extension); |
| 508 | 286 |
| 509 // A copy constructor is needed because this structure can end up getting | 287 // A copy constructor is needed because this structure can end up getting |
| 510 // copied inside the IPC machinery on gcc <= 4.2. | 288 // copied inside the IPC machinery on gcc <= 4.2. |
| 511 ViewMsg_ExtensionLoaded_Params( | 289 ViewMsg_ExtensionLoaded_Params( |
| 512 const ViewMsg_ExtensionLoaded_Params& other); | 290 const ViewMsg_ExtensionLoaded_Params& other); |
| 513 | 291 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 402 |
| 625 template <> | 403 template <> |
| 626 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { | 404 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { |
| 627 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; | 405 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; |
| 628 static void Write(Message* m, const param_type& p); | 406 static void Write(Message* m, const param_type& p); |
| 629 static bool Read(const Message* m, void** iter, param_type* p); | 407 static bool Read(const Message* m, void** iter, param_type* p); |
| 630 static void Log(const param_type& p, std::string* l); | 408 static void Log(const param_type& p, std::string* l); |
| 631 }; | 409 }; |
| 632 | 410 |
| 633 template <> | 411 template <> |
| 634 struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { | |
| 635 typedef ViewHostMsg_FrameNavigate_Params param_type; | |
| 636 static void Write(Message* m, const param_type& p); | |
| 637 static bool Read(const Message* m, void** iter, param_type* p); | |
| 638 static void Log(const param_type& p, std::string* l); | |
| 639 }; | |
| 640 | |
| 641 template <> | |
| 642 struct ParamTraits<ViewHostMsg_UpdateRect_Params> { | |
| 643 typedef ViewHostMsg_UpdateRect_Params param_type; | |
| 644 static void Write(Message* m, const param_type& p); | |
| 645 static bool Read(const Message* m, void** iter, param_type* p); | |
| 646 static void Log(const param_type& p, std::string* l); | |
| 647 }; | |
| 648 | |
| 649 template <> | |
| 650 struct ParamTraits<ViewMsg_Print_Params> { | 412 struct ParamTraits<ViewMsg_Print_Params> { |
| 651 typedef ViewMsg_Print_Params param_type; | 413 typedef ViewMsg_Print_Params param_type; |
| 652 static void Write(Message* m, const param_type& p); | 414 static void Write(Message* m, const param_type& p); |
| 653 static bool Read(const Message* m, void** iter, param_type* p); | 415 static bool Read(const Message* m, void** iter, param_type* p); |
| 654 static void Log(const param_type& p, std::string* l); | 416 static void Log(const param_type& p, std::string* l); |
| 655 }; | 417 }; |
| 656 | 418 |
| 657 template <> | 419 template <> |
| 658 struct ParamTraits<ViewMsg_PrintPage_Params> { | 420 struct ParamTraits<ViewMsg_PrintPage_Params> { |
| 659 typedef ViewMsg_PrintPage_Params param_type; | 421 typedef ViewMsg_PrintPage_Params param_type; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 }; | 457 }; |
| 696 | 458 |
| 697 template <> | 459 template <> |
| 698 struct ParamTraits<ViewMsg_ExecuteCode_Params> { | 460 struct ParamTraits<ViewMsg_ExecuteCode_Params> { |
| 699 typedef ViewMsg_ExecuteCode_Params param_type; | 461 typedef ViewMsg_ExecuteCode_Params param_type; |
| 700 static void Write(Message* m, const param_type& p); | 462 static void Write(Message* m, const param_type& p); |
| 701 static bool Read(const Message* m, void** iter, param_type* p); | 463 static bool Read(const Message* m, void** iter, param_type* p); |
| 702 static void Log(const param_type& p, std::string* l); | 464 static void Log(const param_type& p, std::string* l); |
| 703 }; | 465 }; |
| 704 | 466 |
| 705 template<> | |
| 706 struct ParamTraits<ViewHostMsg_CreateWindow_Params> { | |
| 707 typedef ViewHostMsg_CreateWindow_Params param_type; | |
| 708 static void Write(Message* m, const param_type& p); | |
| 709 static bool Read(const Message* m, void** iter, param_type* p); | |
| 710 static void Log(const param_type& p, std::string* l); | |
| 711 }; | |
| 712 | |
| 713 template<> | |
| 714 struct ParamTraits<ViewHostMsg_RunFileChooser_Params> { | |
| 715 typedef ViewHostMsg_RunFileChooser_Params param_type; | |
| 716 static void Write(Message* m, const param_type& p); | |
| 717 static bool Read(const Message* m, void** iter, param_type* p); | |
| 718 static void Log(const param_type& p, std::string* l); | |
| 719 }; | |
| 720 | |
| 721 template <> | 467 template <> |
| 722 struct ParamTraits<ViewMsg_ExtensionLoaded_Params> { | 468 struct ParamTraits<ViewMsg_ExtensionLoaded_Params> { |
| 723 typedef ViewMsg_ExtensionLoaded_Params param_type; | 469 typedef ViewMsg_ExtensionLoaded_Params param_type; |
| 724 static void Write(Message* m, const param_type& p); | 470 static void Write(Message* m, const param_type& p); |
| 725 static bool Read(const Message* m, void** iter, param_type* p); | 471 static bool Read(const Message* m, void** iter, param_type* p); |
| 726 static void Log(const param_type& p, std::string* l); | 472 static void Log(const param_type& p, std::string* l); |
| 727 }; | 473 }; |
| 728 | 474 |
| 729 template <> | 475 template <> |
| 730 struct ParamTraits<ViewHostMsg_DomMessage_Params> { | 476 struct ParamTraits<ViewHostMsg_DomMessage_Params> { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 754 struct ParamTraits<ViewHostMsg_MalwareDOMDetails_Node> { | 500 struct ParamTraits<ViewHostMsg_MalwareDOMDetails_Node> { |
| 755 typedef ViewHostMsg_MalwareDOMDetails_Node param_type; | 501 typedef ViewHostMsg_MalwareDOMDetails_Node param_type; |
| 756 static void Write(Message* m, const param_type& p); | 502 static void Write(Message* m, const param_type& p); |
| 757 static bool Read(const Message* m, void** iter, param_type* p); | 503 static bool Read(const Message* m, void** iter, param_type* p); |
| 758 static void Log(const param_type& p, std::string* l); | 504 static void Log(const param_type& p, std::string* l); |
| 759 }; | 505 }; |
| 760 | 506 |
| 761 } // namespace IPC | 507 } // namespace IPC |
| 762 | 508 |
| 763 #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ | 509 #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
| OLD | NEW |