diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/url_request_automation_job.cc | 16 | ||||
-rw-r--r-- | chrome/browser/external_tab_container_win.cc | 18 | ||||
-rw-r--r-- | chrome/common/all_messages.h | 1 | ||||
-rw-r--r-- | chrome/common/automation_messages.cc | 484 | ||||
-rw-r--r-- | chrome/common/automation_messages.h | 390 | ||||
-rw-r--r-- | chrome/common/automation_messages_internal.h | 28 | ||||
-rw-r--r-- | chrome/common/common_message_generator.h | 1 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 78 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.h | 6 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 3 |
11 files changed, 178 insertions, 849 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 16dca92..1af990d 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -453,14 +453,14 @@ void URLRequestAutomationJob::StartAsync() { } // Ask automation to start this request. - AutomationURLRequest automation_request( - request_->url().spec(), - request_->method(), - referrer.spec(), - new_request_headers.ToString(), - request_->get_upload(), - resource_type, - request_->load_flags()); + AutomationURLRequest automation_request; + automation_request.url = request_->url().spec(); + automation_request.method = request_->method(); + automation_request.referrer = referrer.spec(); + automation_request.extra_request_headers = new_request_headers.ToString(); + automation_request.upload_data =request_->get_upload(); + automation_request.resource_type = resource_type; + automation_request.load_flags = request_->load_flags(); DCHECK(message_filter_); message_filter_->Send(new AutomationMsg_RequestStart( diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index efa0c95..dc8992c 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -659,15 +659,15 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { POINT screen_pt = { params.x, params.y }; MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); - MiniContextMenuParams ipc_params( - screen_pt.x, - screen_pt.y, - params.link_url, - params.unfiltered_link_url, - params.src_url, - params.page_url, - params.keyword_url, - params.frame_url); + MiniContextMenuParams ipc_params; + ipc_params.screen_x = screen_pt.x; + ipc_params.screen_y = screen_pt.y; + ipc_params.link_url = params.link_url; + ipc_params.unfiltered_link_url = params.unfiltered_link_url; + ipc_params.src_url = params.src_url; + ipc_params.page_url = params.page_url; + ipc_params.keyword_url = params.keyword_url; + ipc_params.frame_url = params.frame_url; bool rtl = base::i18n::IsRTL(); automation_->Send( diff --git a/chrome/common/all_messages.h b/chrome/common/all_messages.h index db770b1..63ea676 100644 --- a/chrome/common/all_messages.h +++ b/chrome/common/all_messages.h @@ -11,5 +11,4 @@ #include "chrome/common/common_message_generator.h" #include "chrome/common/nacl_messages.h" #include "content/common/content_message_generator.h" -#include "content/common/pepper_messages.h" #include "ppapi/proxy/ppapi_messages.h" diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc index f14c6f63..f06d3fa 100644 --- a/chrome/common/automation_messages.cc +++ b/chrome/common/automation_messages.cc @@ -2,152 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/common_param_traits.h" -#include "content/common/common_param_traits.h" -#include "ui/base/models/menu_model.h" - -#define IPC_MESSAGE_IMPL #include "chrome/common/automation_messages.h" - -AutomationURLRequest::AutomationURLRequest() - : resource_type(0), - load_flags(0) { -} - -AutomationURLRequest::AutomationURLRequest( - const std::string& in_url, - const std::string& in_method, - const std::string& in_referrer, - const std::string& in_extra_request_headers, - scoped_refptr<net::UploadData> in_upload_data, - int in_resource_type, - int in_load_flags) - : url(in_url), - method(in_method), - referrer(in_referrer), - extra_request_headers(in_extra_request_headers), - upload_data(in_upload_data), - resource_type(in_resource_type), - load_flags(in_load_flags) { -} - -AutomationURLRequest::~AutomationURLRequest() {} - -AutomationURLResponse::AutomationURLResponse() - : content_length(0), - redirect_status(0) { -} - -AutomationURLResponse::AutomationURLResponse( - const std::string& in_mime_type, const std::string& in_headers, - int64 in_content_length, const base::Time& in_last_modified, - const std::string& in_redirect_url, int in_redirect_status, - const net::HostPortPair& host_socket_address) - : mime_type(in_mime_type), - headers(in_headers), - content_length(in_content_length), - last_modified(in_last_modified), - redirect_url(in_redirect_url), - redirect_status(in_redirect_status), - socket_address(host_socket_address) { -} - - -AutomationURLResponse::~AutomationURLResponse() {} - -ExternalTabSettings::ExternalTabSettings() - : parent(NULL), - dimensions(), - style(0), - is_incognito(false), - load_requests_via_automation(false), - handle_top_level_requests(false), - initial_url(), - referrer(), - infobars_enabled(false), - route_all_top_level_navigations(false) { -} - -ExternalTabSettings::ExternalTabSettings( - gfx::NativeWindow in_parent, - const gfx::Rect& in_dimensions, - unsigned int in_style, - bool in_is_incognito, - bool in_load_requests_via_automation, - bool in_handle_top_level_requests, - const GURL& in_initial_url, - const GURL& in_referrer, - bool in_infobars_enabled, - bool in_route_all_top_level_navigations) - : parent(in_parent), - dimensions(in_dimensions), - style(in_style), - is_incognito(in_is_incognito), - load_requests_via_automation(in_load_requests_via_automation), - handle_top_level_requests(in_handle_top_level_requests), - initial_url(in_initial_url), - referrer(in_referrer), - infobars_enabled(in_infobars_enabled), - route_all_top_level_navigations(in_route_all_top_level_navigations) { -} - -ExternalTabSettings::~ExternalTabSettings() {} - -NavigationInfo::NavigationInfo() - : navigation_type(0), - relative_offset(0), - navigation_index(0), - security_style(content::SECURITY_STYLE_UNKNOWN), - displayed_insecure_content(0), - ran_insecure_content(0) { -} - -NavigationInfo::NavigationInfo(int in_navigation_type, - int in_relative_offset, - int in_navigation_index, - const std::wstring& in_title, - const GURL& in_url, - const GURL& in_referrer, - content::SecurityStyle in_security_style, - bool in_displayed_insecure_content, - bool in_ran_insecure_content) - : navigation_type(in_navigation_type), - relative_offset(in_relative_offset), - navigation_index(in_navigation_index), - title(in_title), - url(in_url), - referrer(in_referrer), - security_style(in_security_style), - displayed_insecure_content(in_displayed_insecure_content), - ran_insecure_content(in_ran_insecure_content) { -} - -NavigationInfo::~NavigationInfo() {} - -MiniContextMenuParams::MiniContextMenuParams() - : screen_x(0), - screen_y(0) { -} - -MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, - int in_screen_y, - const GURL& in_link_url, - const GURL& in_unfiltered_link_url, - const GURL& in_src_url, - const GURL& in_page_url, - const GURL& in_keyword_url, - const GURL& in_frame_url) - : screen_x(in_screen_x), - screen_y(in_screen_y), - link_url(in_link_url), - unfiltered_link_url(in_unfiltered_link_url), - src_url(in_src_url), - page_url(in_page_url), - keyword_url(in_keyword_url), - frame_url(in_frame_url) { -} - -MiniContextMenuParams::~MiniContextMenuParams() {} +#include "ui/base/models/menu_model.h" ContextMenuModel::ContextMenuModel() { } @@ -165,306 +21,9 @@ ContextMenuModel::Item::Item() submenu(NULL) { } -AttachExternalTabParams::AttachExternalTabParams() - : cookie(0), - disposition(0), - user_gesture(false) { -} - -AttachExternalTabParams::AttachExternalTabParams( - uint64 in_cookie, - const GURL& in_url, - const gfx::Rect& in_dimensions, - int in_disposition, - bool in_user_gesture, - const std::string& in_profile_name) - : cookie(in_cookie), - url(in_url), - dimensions(in_dimensions), - disposition(in_disposition), - user_gesture(in_user_gesture), - profile_name(in_profile_name) { -} - -AttachExternalTabParams::~AttachExternalTabParams() {} - namespace IPC { // static -void ParamTraits<AutomationMsg_Find_Params>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.unused); - WriteParam(m, p.search_string); - WriteParam(m, p.forward); - WriteParam(m, p.match_case); - WriteParam(m, p.find_next); -} - -// static -bool ParamTraits<AutomationMsg_Find_Params>::Read(const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->unused) && - ReadParam(m, iter, &p->search_string) && - ReadParam(m, iter, &p->forward) && - ReadParam(m, iter, &p->match_case) && - ReadParam(m, iter, &p->find_next); -} - -// static -void ParamTraits<AutomationMsg_Find_Params>::Log(const param_type& p, - std::string* l) { - l->append("<AutomationMsg_Find_Params>"); -} - -// static -void ParamTraits<AutomationURLRequest>::Write(Message* m, const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.method); - WriteParam(m, p.referrer); - WriteParam(m, p.extra_request_headers); - WriteParam(m, p.upload_data); - WriteParam(m, p.resource_type); - WriteParam(m, p.load_flags); -} - -// static -bool ParamTraits<AutomationURLRequest>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->extra_request_headers) && - ReadParam(m, iter, &p->upload_data) && - ReadParam(m, iter, &p->resource_type) && - ReadParam(m, iter, &p->load_flags); -} - -// static -void ParamTraits<AutomationURLRequest>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.url, l); - l->append(", "); - LogParam(p.method, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.extra_request_headers, l); - l->append(", "); - LogParam(p.upload_data, l); - l->append(", "); - LogParam(p.resource_type, l); - l->append(", "); - LogParam(p.load_flags, l); - l->append(")"); -} - -// static -void ParamTraits<AutomationURLResponse>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.mime_type); - WriteParam(m, p.headers); - WriteParam(m, p.content_length); - WriteParam(m, p.last_modified); - WriteParam(m, p.redirect_url); - WriteParam(m, p.redirect_status); - WriteParam(m, p.socket_address); -} - -// static -bool ParamTraits<AutomationURLResponse>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->mime_type) && - ReadParam(m, iter, &p->headers) && - ReadParam(m, iter, &p->content_length) && - ReadParam(m, iter, &p->last_modified) && - ReadParam(m, iter, &p->redirect_url) && - ReadParam(m, iter, &p->redirect_status) && - ReadParam(m, iter, &p->socket_address); -} - -// static -void ParamTraits<AutomationURLResponse>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.mime_type, l); - l->append(", "); - LogParam(p.headers, l); - l->append(", "); - LogParam(p.content_length, l); - l->append(", "); - LogParam(p.last_modified, l); - l->append(", "); - LogParam(p.redirect_url, l); - l->append(", "); - LogParam(p.redirect_status, l); - l->append(", "); - LogParam(p.socket_address, l); - l->append(")"); -} - -// static -void ParamTraits<ExternalTabSettings>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.parent); - WriteParam(m, p.dimensions); - WriteParam(m, p.style); - WriteParam(m, p.is_incognito); - WriteParam(m, p.load_requests_via_automation); - WriteParam(m, p.handle_top_level_requests); - WriteParam(m, p.initial_url); - WriteParam(m, p.referrer); - WriteParam(m, p.infobars_enabled); - WriteParam(m, p.route_all_top_level_navigations); -} - -// static -bool ParamTraits<ExternalTabSettings>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->parent) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->style) && - ReadParam(m, iter, &p->is_incognito) && - ReadParam(m, iter, &p->load_requests_via_automation) && - ReadParam(m, iter, &p->handle_top_level_requests) && - ReadParam(m, iter, &p->initial_url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->infobars_enabled) && - ReadParam(m, iter, &p->route_all_top_level_navigations); -} - -// static -void ParamTraits<ExternalTabSettings>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.parent, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.style, l); - l->append(", "); - LogParam(p.is_incognito, l); - l->append(", "); - LogParam(p.load_requests_via_automation, l); - l->append(", "); - LogParam(p.handle_top_level_requests, l); - l->append(", "); - LogParam(p.initial_url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.infobars_enabled, l); - l->append(", "); - LogParam(p.route_all_top_level_navigations, l); - l->append(")"); -} - -// static -void ParamTraits<NavigationInfo>::Write(Message* m, const param_type& p) { - WriteParam(m, p.navigation_type); - WriteParam(m, p.relative_offset); - WriteParam(m, p.navigation_index); - WriteParam(m, p.title); - WriteParam(m, p.url); - WriteParam(m, p.referrer); - WriteParam(m, p.security_style); - WriteParam(m, p.displayed_insecure_content); - WriteParam(m, p.ran_insecure_content); -} - -// static -bool ParamTraits<NavigationInfo>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->navigation_type) && - ReadParam(m, iter, &p->relative_offset) && - ReadParam(m, iter, &p->navigation_index) && - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->security_style) && - ReadParam(m, iter, &p->displayed_insecure_content) && - ReadParam(m, iter, &p->ran_insecure_content); -} - -// static -void ParamTraits<NavigationInfo>::Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.navigation_type, l); - l->append(", "); - LogParam(p.relative_offset, l); - l->append(", "); - LogParam(p.navigation_index, l); - l->append(", "); - LogParam(p.title, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.security_style, l); - l->append(", "); - LogParam(p.displayed_insecure_content, l); - l->append(", "); - LogParam(p.ran_insecure_content, l); - l->append(")"); -} - -// static -void ParamTraits<MiniContextMenuParams>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.screen_x); - WriteParam(m, p.screen_y); - WriteParam(m, p.link_url); - WriteParam(m, p.unfiltered_link_url); - WriteParam(m, p.src_url); - WriteParam(m, p.page_url); - WriteParam(m, p.keyword_url); - WriteParam(m, p.frame_url); -} - -// static -bool ParamTraits<MiniContextMenuParams>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->screen_x) && - ReadParam(m, iter, &p->screen_y) && - ReadParam(m, iter, &p->link_url) && - ReadParam(m, iter, &p->unfiltered_link_url) && - ReadParam(m, iter, &p->src_url) && - ReadParam(m, iter, &p->page_url) && - ReadParam(m, iter, &p->keyword_url) && - ReadParam(m, iter, &p->frame_url); -} - -// static -void ParamTraits<MiniContextMenuParams>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.screen_x, l); - l->append(", "); - LogParam(p.screen_y, l); - l->append(", "); - LogParam(p.link_url, l); - l->append(", "); - LogParam(p.unfiltered_link_url, l); - l->append(", "); - LogParam(p.src_url, l); - l->append(", "); - LogParam(p.page_url, l); - l->append(", "); - LogParam(p.keyword_url, l); - l->append(", "); - LogParam(p.frame_url, l); - l->append(")"); -} - -// static void ParamTraits<ContextMenuModel>::Write(Message* m, const param_type& p) { WriteParam(m, p.items.size()); @@ -545,45 +104,4 @@ void ParamTraits<ContextMenuModel>::Log(const param_type& p, l->append(")"); } -// static -void ParamTraits<AttachExternalTabParams>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.cookie); - WriteParam(m, p.url); - WriteParam(m, p.dimensions); - WriteParam(m, p.disposition); - WriteParam(m, p.user_gesture); - WriteParam(m, p.profile_name); -} - -// static -bool ParamTraits<AttachExternalTabParams>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->cookie) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->disposition) && - ReadParam(m, iter, &p->user_gesture) && - ReadParam(m, iter, &p->profile_name); -} - -// static -void ParamTraits<AttachExternalTabParams>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.cookie, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.disposition, l); - l->append(", "); - LogParam(p.user_gesture, l); - l->append(","); - LogParam(p.profile_name, l); - l->append(")"); -} - } // namespace IPC 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. diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index 63da146..ee904a1 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -4,18 +4,6 @@ // Defines the IPC messages used by the automation interface. -#include <string> -#include <vector> - -#include "base/string16.h" -#include "chrome/common/content_settings.h" -#include "googleurl/src/gurl.h" -#include "ipc/ipc_message_macros.h" -#include "net/base/cert_status_flags.h" -#include "net/url_request/url_request_status.h" -#include "ui/gfx/rect.h" -#include "webkit/glue/window_open_disposition.h" - // NOTE: All IPC messages have either a routing_id of 0 (for asynchronous // messages), or one that's been assigned by the proxy (for calls // which expect a response). The routing_id shouldn't be used for @@ -26,8 +14,20 @@ // define the IDs based on __LINE__, to allow these IPC messages to be // used to control an old version of Chrome we need the message IDs to // remain the same. This means that you should not change the line number -// of any of the messages below. This will be fixed once Xcode supports -// __COUNTER__, in which case we can get rid of the __LINE__. +// of any of the messages below. + + + + + + + + + + + + + diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h index 4b231f2..6cb3877 100644 --- a/chrome/common/common_message_generator.h +++ b/chrome/common/common_message_generator.h @@ -5,6 +5,7 @@ // Multiply-included file, hence no include guard. #include "chrome/common/autofill_messages.h" +#include "chrome/common/automation_messages.h" #include "chrome/common/benchmarking_messages.h" #include "chrome/common/chrome_plugin_messages.h" #include "chrome/common/chrome_utility_messages.h" diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 03ca1aa..ff8d403 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -8,8 +8,6 @@ #include <string> #include <vector> -// TODO(erg): This list has been temporarily annotated by erg while doing work -// on which headers to pull out. #include "base/basictypes.h" #include "base/file_path.h" #include "base/process.h" diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index e70a746..22ed307 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -709,9 +709,11 @@ void ExternalTabUITestMockClient::ReplyEnd(const net::URLRequestStatus& status, } void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { - const AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, - base::Time(), "", 0, - net::HostPortPair()); + AutomationURLResponse notfound; + notfound.headers = "HTTP/1.1 404\r\n\r\n"; + notfound.content_length = 0; + notfound.redirect_status = 0; + ReplyStarted(¬found, tab_handle, request_id); ReplyEOF(tab_handle, request_id); } @@ -724,7 +726,7 @@ void ExternalTabUITestMockClient::ServeHTMLData(int tab_handle, testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, - &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); + &ExternalTabUITestMockClient::ReplyStarted, &GetHttp200Response())))); EXPECT_CALL(*this, OnRequestRead(tab_handle, testing::Gt(0))) .Times(2) @@ -757,27 +759,27 @@ void ExternalTabUITestMockClient::InvalidateHandle( HandleClosed(handle); } -// Most of the time we need external tab with these settings. -const ExternalTabSettings ExternalTabUITestMockClient::default_settings( - NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab - WS_CHILD | WS_VISIBLE, - false, // is_incognito - true, // load_requests_via_automation - true, // handle_top_level_requests - GURL(), // initial_url - GURL(), // referrer - false, // infobars_enabled - false); // route_all_top_level_navigations +// static +ExternalTabSettings ExternalTabUITestMockClient::GetDefaultSettings() { + ExternalTabSettings settings; + settings.parent = NULL; + settings.style = WS_CHILD | WS_VISIBLE; + settings.is_incognito = false; + settings.load_requests_via_automation = true; + settings.handle_top_level_requests = true; + settings.infobars_enabled = false; + settings.route_all_top_level_navigations = false; + return settings; +} // static -const AutomationURLResponse ExternalTabUITestMockClient::http_200( - "", - "HTTP/0.9 200\r\n\r\n", - 0, - base::Time(), - "", - 0, - net::HostPortPair()); +AutomationURLResponse ExternalTabUITestMockClient::GetHttp200Response() { + AutomationURLResponse response; + response.headers = "HTTP/0.9 200\r\n\r\n"; + response.content_length = 0; + response.redirect_status = 0; + return response; +} bool ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { bool handled = true; @@ -826,8 +828,7 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( const GURL& initial_url) { - ExternalTabSettings settings = - ExternalTabUITestMockClient::default_settings; + ExternalTabSettings settings = GetDefaultSettings(); settings.initial_url = initial_url; return CreateHostWindowAndTab(settings); } @@ -852,7 +853,7 @@ void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, RECT rect; ::GetClientRect(parent, &rect); - Reposition_Params params = {0}; + Reposition_Params params; params.window = tab_container; params.flags = SWP_NOZORDER | SWP_SHOWWINDOW; params.width = rect.right - rect.left; @@ -968,7 +969,7 @@ TEST_F(ExternalTabUITest, FLAKY_IncognitoMode) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); ExternalTabSettings incognito = - ExternalTabUITestMockClient::default_settings; + ExternalTabUITestMockClient::GetDefaultSettings(); incognito.is_incognito = true; // SetCookie is a sync call and deadlock can happen if window is visible, // since it shares same thread with AutomationProxy. @@ -1078,7 +1079,7 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; + ExternalTabSettings s = ExternalTabUITestMockClient::GetDefaultSettings(); s.load_requests_via_automation = false; s.initial_url = GURL("http://localhost:1337/files/post_message.html"); tab = mock_->CreateHostWindowAndTab(s); @@ -1101,11 +1102,12 @@ TEST_F(ExternalTabUITest, DISABLED_HostNetworkStack) { testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) - // We can simply do CreateFunctor(1, 2, &http_200) since we know the - // tab handle and request id, but using WithArgs<> is much more fancy :) + // We can simply do CreateFunctor(1, 2, &GetHttp200Response()) since we + // know the tab handle and request id, but using WithArgs<> is much more + // fancy :) .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, - &ExternalTabUITestMockClient::http_200)))); + &ExternalTabUITestMockClient::GetHttp200Response())))); // Return some trivial page, that have a link to a "logo.gif" image const std::string data = "<!DOCTYPE html><title>Hello</title>" @@ -1171,11 +1173,12 @@ TEST_F(ExternalTabUITest, DISABLED_HostNetworkStackAbortRequest) { testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) - // We can simply do CreateFunctor(1, 2, &http_200) since we know the - // tab handle and request id, but using WithArgs<> is much more fancy :) + // We can simply do CreateFunctor(1, 2, &GetHttp200Response()) since we + // know the tab handle and request id, but using WithArgs<> is much more + // fancy :) .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, - &ExternalTabUITestMockClient::http_200)))); + &ExternalTabUITestMockClient::GetHttp200Response())))); // Return some trivial page, that have a link to a "logo.gif" image const std::string data = "<!DOCTYPE html><title>Hello"; @@ -1218,11 +1221,12 @@ TEST_F(ExternalTabUITest, DISABLED_HostNetworkStackUnresponsiveRenderer) { testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) - // We can simply do CreateFunctor(1, 2, &http_200) since we know the - // tab handle and request id, but using WithArgs<> is much more fancy :) + // We can simply do CreateFunctor(1, 2, &GetHttp200Response()) since we + // know the tab handle and request id, but using WithArgs<> is much more + // fancy :) .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, - &ExternalTabUITestMockClient::http_200)))); + &ExternalTabUITestMockClient::GetHttp200Response())))); const std::string head = "<html><title>Hello</title><body>"; diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index 39fbb42..cf4e05f 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -91,13 +91,15 @@ class ExternalTabUITestMockClient : public AutomationProxy { void DestroyHostWindow(); // Returns true if the host window exists. bool HostWindowExists(); + + static ExternalTabSettings GetDefaultSettings(); + static AutomationURLResponse GetHttp200Response(); + // It's overlapped and visible by default. For Incognito mode test though we // want invisible window since SetCookie is a sync call and a deadlock is // very possible. unsigned long host_window_style_; - static const AutomationURLResponse http_200; - static const ExternalTabSettings default_settings; protected: gfx::NativeWindow host_window_; diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index a5d70a0..3babb9c 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -84,7 +84,6 @@ int TabProxy::FindInPage(const std::wstring& search_string, return -1; AutomationMsg_Find_Params params; - params.unused = 0; params.search_string = WideToUTF16Hack(search_string); params.find_next = find_next; params.match_case = (match_case == CASE_SENSITIVE); @@ -738,7 +737,7 @@ bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, int top, int width, int height, int flags, HWND parent_window) { - Reposition_Params params = {0}; + Reposition_Params params; params.window = window; params.window_insert_after = window_insert_after; params.left = left; |