summaryrefslogtreecommitdiffstats
path: root/chrome/common/automation_messages.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 17:35:08 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 17:35:08 +0000
commit3b3ec721627391f78747d19bd3cc87792e0210a8 (patch)
tree63db7ee2728988eaf7f445417276daa22aab23f9 /chrome/common/automation_messages.h
parent78e7603d28966adf4d1305e00cdc27ef07ebcc3b (diff)
downloadchromium_src-3b3ec721627391f78747d19bd3cc87792e0210a8.zip
chromium_src-3b3ec721627391f78747d19bd3cc87792e0210a8.tar.gz
chromium_src-3b3ec721627391f78747d19bd3cc87792e0210a8.tar.bz2
Update automation messages to use the new way of declaring message structs, to cut back on unnecessary code.
Review URL: http://codereview.chromium.org/8356020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/automation_messages.h')
-rw-r--r--chrome/common/automation_messages.h390
1 files changed, 99 insertions, 291 deletions
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h
index 590eb6f..3b73501 100644
--- a/chrome/common/automation_messages.h
+++ b/chrome/common/automation_messages.h
@@ -14,146 +14,141 @@
#include "content/common/webkit_param_traits.h"
#include "content/public/common/page_type.h"
#include "content/public/common/security_style.h"
+#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
+#include "net/base/cert_status_flags.h"
#include "net/base/host_port_pair.h"
#include "net/base/upload_data.h"
+#include "net/url_request/url_request_status.h"
#include "ui/gfx/rect.h"
+#include "webkit/glue/window_open_disposition.h"
-// Singly-included section, not yet converted.
-#ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H__
-#define CHROME_COMMON_AUTOMATION_MESSAGES_H__
-
-struct AutomationMsg_Find_Params {
- // Unused value, which exists only for backwards compat.
- int unused;
+IPC_ENUM_TRAITS(AutomationMsg_NavigationResponseValues)
+IPC_ENUM_TRAITS(AutomationMsg_ExtensionProperty)
+IPC_ENUM_TRAITS(content::PageType)
+IPC_ENUM_TRAITS(content::SecurityStyle)
+IPC_STRUCT_BEGIN(AutomationMsg_Find_Params)
// The word(s) to find on the page.
- string16 search_string;
+ IPC_STRUCT_MEMBER(string16, search_string)
// Whether to search forward or backward within the page.
- bool forward;
+ IPC_STRUCT_MEMBER(bool, forward)
// Whether search should be Case sensitive.
- bool match_case;
+ IPC_STRUCT_MEMBER(bool, match_case)
// Whether this operation is first request (Find) or a follow-up (FindNext).
- bool find_next;
-};
-
-struct AutomationURLResponse {
- AutomationURLResponse();
- AutomationURLResponse(const std::string& mime_type,
- const std::string& headers,
- int64 content_length,
- const base::Time& last_modified,
- const std::string& redirect_url,
- int redirect_status,
- const net::HostPortPair& host_socket_address);
- ~AutomationURLResponse();
-
- std::string mime_type;
- std::string headers;
- int64 content_length;
- base::Time last_modified;
- std::string redirect_url;
- int redirect_status;
- net::HostPortPair socket_address;
-};
-
-struct ExternalTabSettings {
- ExternalTabSettings();
- ExternalTabSettings(gfx::NativeWindow parent,
- const gfx::Rect& dimensions,
- unsigned int style,
- bool is_incognito,
- bool load_requests_via_automation,
- bool handle_top_level_requests,
- const GURL& initial_url,
- const GURL& referrer,
- bool infobars_enabled,
- bool route_all_top_level_navigations);
- ~ExternalTabSettings();
-
- gfx::NativeWindow parent;
- gfx::Rect dimensions;
- unsigned int style;
- bool is_incognito;
- bool load_requests_via_automation;
- bool handle_top_level_requests;
- GURL initial_url;
- GURL referrer;
- bool infobars_enabled;
- bool route_all_top_level_navigations;
-};
-
-struct NavigationInfo {
- NavigationInfo();
- NavigationInfo(int navigation_type,
- int relative_offset,
- int navigation_index,
- const std::wstring& title,
- const GURL& url,
- const GURL& referrer,
- content::SecurityStyle security_style,
- bool displayed_insecure_content,
- bool ran_insecure_content);
- ~NavigationInfo();
-
- int navigation_type;
- int relative_offset;
- int navigation_index;
- std::wstring title;
- GURL url;
- GURL referrer;
- content::SecurityStyle security_style;
- bool displayed_insecure_content;
- bool ran_insecure_content;
-};
+ IPC_STRUCT_MEMBER(bool, find_next)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(AutomationURLResponse)
+ IPC_STRUCT_MEMBER(std::string, mime_type)
+ IPC_STRUCT_MEMBER(std::string, headers)
+ IPC_STRUCT_MEMBER(int64, content_length)
+ IPC_STRUCT_MEMBER(base::Time, last_modified)
+ IPC_STRUCT_MEMBER(std::string, redirect_url)
+ IPC_STRUCT_MEMBER(int, redirect_status)
+ IPC_STRUCT_MEMBER(net::HostPortPair, socket_address)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(ExternalTabSettings)
+ IPC_STRUCT_MEMBER(gfx::NativeWindow, parent)
+ IPC_STRUCT_MEMBER(gfx::Rect, dimensions)
+ IPC_STRUCT_MEMBER(unsigned int, style)
+ IPC_STRUCT_MEMBER(bool, is_incognito)
+ IPC_STRUCT_MEMBER(bool, load_requests_via_automation)
+ IPC_STRUCT_MEMBER(bool, handle_top_level_requests)
+ IPC_STRUCT_MEMBER(GURL, initial_url)
+ IPC_STRUCT_MEMBER(GURL, referrer)
+ IPC_STRUCT_MEMBER(bool, infobars_enabled)
+ IPC_STRUCT_MEMBER(bool, route_all_top_level_navigations)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(NavigationInfo)
+ IPC_STRUCT_MEMBER(int, navigation_type)
+ IPC_STRUCT_MEMBER(int, relative_offset)
+ IPC_STRUCT_MEMBER(int, navigation_index)
+ IPC_STRUCT_MEMBER(std::wstring, title)
+ IPC_STRUCT_MEMBER(GURL, url)
+ IPC_STRUCT_MEMBER(GURL, referrer)
+ IPC_STRUCT_MEMBER(content::SecurityStyle, security_style)
+ IPC_STRUCT_MEMBER(bool, displayed_insecure_content)
+ IPC_STRUCT_MEMBER(bool, ran_insecure_content)
+IPC_STRUCT_END()
// A stripped down version of ContextMenuParams in webkit/glue/context_menu.h.
-struct MiniContextMenuParams {
- MiniContextMenuParams();
- MiniContextMenuParams(int screen_x,
- int screen_y,
- const GURL& link_url,
- const GURL& unfiltered_link_url,
- const GURL& src_url,
- const GURL& page_url,
- const GURL& keyword_url,
- const GURL& frame_url);
- ~MiniContextMenuParams();
-
+IPC_STRUCT_BEGIN(MiniContextMenuParams)
// The x coordinate for displaying the menu.
- int screen_x;
+ IPC_STRUCT_MEMBER(int, screen_x)
// The y coordinate for displaying the menu.
- int screen_y;
+ IPC_STRUCT_MEMBER(int, screen_y)
// This is the URL of the link that encloses the node the context menu was
// invoked on.
- GURL link_url;
+ IPC_STRUCT_MEMBER(GURL, link_url)
// The link URL to be used ONLY for "copy link address". We don't validate
// this field in the frontend process.
- GURL unfiltered_link_url;
+ IPC_STRUCT_MEMBER(GURL, unfiltered_link_url)
// This is the source URL for the element that the context menu was
// invoked on. Example of elements with source URLs are img, audio, and
// video.
- GURL src_url;
+ IPC_STRUCT_MEMBER(GURL, src_url)
// This is the URL of the top level page that the context menu was invoked
// on.
- GURL page_url;
+ IPC_STRUCT_MEMBER(GURL, page_url)
// This is the absolute keyword search URL including the %s search tag when
// the "Add as search engine..." option is clicked (left empty if not used).
- GURL keyword_url;
+ IPC_STRUCT_MEMBER(GURL, keyword_url)
// This is the URL of the subframe that the context menu was invoked on.
- GURL frame_url;
-};
+ IPC_STRUCT_MEMBER(GURL, frame_url)
+IPC_STRUCT_END()
+
+IPC_STRUCT_BEGIN(AttachExternalTabParams)
+ IPC_STRUCT_MEMBER(uint64, cookie)
+ IPC_STRUCT_MEMBER(GURL, url)
+ IPC_STRUCT_MEMBER(gfx::Rect, dimensions)
+ IPC_STRUCT_MEMBER(int, disposition)
+ IPC_STRUCT_MEMBER(bool, user_gesture)
+ IPC_STRUCT_MEMBER(std::string, profile_name)
+IPC_STRUCT_END()
+
+#if defined(OS_WIN) && !defined(USE_AURA)
+
+IPC_STRUCT_BEGIN(Reposition_Params)
+ IPC_STRUCT_MEMBER(HWND, window)
+ IPC_STRUCT_MEMBER(HWND, window_insert_after)
+ IPC_STRUCT_MEMBER(int, left)
+ IPC_STRUCT_MEMBER(int, top)
+ IPC_STRUCT_MEMBER(int, width)
+ IPC_STRUCT_MEMBER(int, height)
+ IPC_STRUCT_MEMBER(int, flags)
+ IPC_STRUCT_MEMBER(bool, set_parent)
+ IPC_STRUCT_MEMBER(HWND, parent_window)
+IPC_STRUCT_END()
+
+#endif // defined(OS_WIN)
+
+IPC_STRUCT_BEGIN(AutomationURLRequest)
+ IPC_STRUCT_MEMBER(std::string, url)
+ IPC_STRUCT_MEMBER(std::string, method)
+ IPC_STRUCT_MEMBER(std::string, referrer)
+ IPC_STRUCT_MEMBER(std::string, extra_request_headers)
+ IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data)
+ IPC_STRUCT_MEMBER(int, resource_type) // see webkit/glue/resource_type.h
+ IPC_STRUCT_MEMBER(int, load_flags) // see net/base/load_flags.h
+IPC_STRUCT_END()
+
+// Singly-included section for struct and custom IPC traits.
+#ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H_
+#define CHROME_COMMON_AUTOMATION_MESSAGES_H_
// This struct passes information about the context menu in Chrome stored
// as a ui::MenuModel to Chrome Frame. It is basically a container of
@@ -191,187 +186,8 @@ struct ContextMenuModel {
std::vector<Item> items;
};
-struct AttachExternalTabParams {
- AttachExternalTabParams();
- AttachExternalTabParams(uint64 cookie,
- const GURL& url,
- const gfx::Rect& dimensions,
- int disposition,
- bool user_gesture,
- const std::string& profile_name);
- ~AttachExternalTabParams();
-
- uint64 cookie;
- GURL url;
- gfx::Rect dimensions;
- int disposition;
- bool user_gesture;
- std::string profile_name;
-};
-
-#if defined(OS_WIN) && !defined(USE_AURA)
-
-struct Reposition_Params {
- HWND window;
- HWND window_insert_after;
- int left;
- int top;
- int width;
- int height;
- int flags;
- bool set_parent;
- HWND parent_window;
-};
-
-#endif // defined(OS_WIN)
-
-struct AutomationURLRequest {
- AutomationURLRequest();
- AutomationURLRequest(const std::string& url,
- const std::string& method,
- const std::string& referrer,
- const std::string& extra_request_headers,
- scoped_refptr<net::UploadData> upload_data,
- int resource_type,
- int load_flags);
- ~AutomationURLRequest();
-
- std::string url;
- std::string method;
- std::string referrer;
- std::string extra_request_headers;
- scoped_refptr<net::UploadData> upload_data;
- int resource_type; // see webkit/glue/resource_type.h
- int load_flags; // see net/base/load_flags.h
-};
-
namespace IPC {
-template <>
-struct ParamTraits<AutomationMsg_Find_Params> {
- typedef AutomationMsg_Find_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct SimilarTypeTraits<AutomationMsg_NavigationResponseValues> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<AutomationMsg_ExtensionProperty> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<content::SecurityStyle> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<content::PageType> {
- typedef int Type;
-};
-
-#if defined(OS_WIN) && !defined(USE_AURA)
-
-// Traits for SetWindowPos_Params structure to pack/unpack.
-template <>
-struct ParamTraits<Reposition_Params> {
- typedef Reposition_Params param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.window);
- WriteParam(m, p.window_insert_after);
- WriteParam(m, p.left);
- WriteParam(m, p.top);
- WriteParam(m, p.width);
- WriteParam(m, p.height);
- WriteParam(m, p.flags);
- WriteParam(m, p.set_parent);
- WriteParam(m, p.parent_window);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->window) &&
- ReadParam(m, iter, &p->window_insert_after) &&
- ReadParam(m, iter, &p->left) &&
- ReadParam(m, iter, &p->top) &&
- ReadParam(m, iter, &p->width) &&
- ReadParam(m, iter, &p->height) &&
- ReadParam(m, iter, &p->flags) &&
- ReadParam(m, iter, &p->set_parent) &&
- ReadParam(m, iter, &p->parent_window);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.window, l);
- l->append(", ");
- LogParam(p.window_insert_after, l);
- l->append(", ");
- LogParam(p.left, l);
- l->append(", ");
- LogParam(p.top, l);
- l->append(", ");
- LogParam(p.width, l);
- l->append(", ");
- LogParam(p.height, l);
- l->append(", ");
- LogParam(p.flags, l);
- l->append(", ");
- LogParam(p.set_parent, l);
- l->append(", ");
- LogParam(p.parent_window, l);
- l->append(")");
- }
-};
-#endif // defined(OS_WIN)
-
-// Traits for AutomationURLRequest structure to pack/unpack.
-template <>
-struct ParamTraits<AutomationURLRequest> {
- typedef AutomationURLRequest param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-// Traits for AutomationURLResponse structure to pack/unpack.
-template <>
-struct ParamTraits<AutomationURLResponse> {
- typedef AutomationURLResponse param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-// Traits for ExternalTabSettings structure to pack/unpack.
-template <>
-struct ParamTraits<ExternalTabSettings> {
- typedef ExternalTabSettings param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-// Traits for NavigationInfo structure to pack/unpack.
-template <>
-struct ParamTraits<NavigationInfo> {
- typedef NavigationInfo param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-// Traits for MiniContextMenuParams structure to pack/unpack.
-template <>
-struct ParamTraits<MiniContextMenuParams> {
- typedef MiniContextMenuParams param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
// Traits for ContextMenuModel structure to pack/unpack.
template <>
struct ParamTraits<ContextMenuModel> {
@@ -381,17 +197,9 @@ struct ParamTraits<ContextMenuModel> {
static void Log(const param_type& p, std::string* l);
};
-template <>
-struct ParamTraits<AttachExternalTabParams> {
- typedef AttachExternalTabParams param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
} // namespace IPC
-#endif // CHROME_COMMON_AUTOMATION_MESSAGES_H__
+#endif // CHROME_COMMON_AUTOMATION_MESSAGES_H_
// Keep this internal message file unchanged to preserve line numbering
// (and hence the dubious __LINE__-based message numberings) across versions.