diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 05:08:58 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 05:08:58 +0000 |
commit | 19d6e1e899e883144d7f8173bef2f1b90be5b883 (patch) | |
tree | 3dd5865f1aed37fde3a895d2acf7da872aa42ee3 | |
parent | 2b4b52764d0bb86b36ed82c058ed5b574c45840b (diff) | |
download | chromium_src-19d6e1e899e883144d7f8173bef2f1b90be5b883.zip chromium_src-19d6e1e899e883144d7f8173bef2f1b90be5b883.tar.gz chromium_src-19d6e1e899e883144d7f8173bef2f1b90be5b883.tar.bz2 |
Move AutoFill messages into a separate file.
Review URL: http://codereview.chromium.org/6294016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72610 0039d316-1c4b-4281-b951-d872f2087c98
21 files changed, 322 insertions, 300 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index 31a6e05..2acdcfc 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -14,8 +14,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" #include "webkit/glue/form_data.h" using webkit_glue::FormData; @@ -91,7 +91,7 @@ bool AutocompleteHistoryManager::OnMessageReceived( const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutocompleteHistoryManager, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutocompleteEntry, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_RemoveAutocompleteEntry, OnRemoveAutocompleteEntry) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -234,12 +234,12 @@ void AutocompleteHistoryManager::SendSuggestions( RenderViewHost* host = tab_contents_->render_view_host(); if (host) { - host->Send(new ViewMsg_AutoFillSuggestionsReturned(host->routing_id(), - query_id_, - autofill_values_, - autofill_labels_, - autofill_icons_, - autofill_unique_ids_)); + host->Send(new AutoFillMsg_SuggestionsReturned(host->routing_id(), + query_id_, + autofill_values_, + autofill_labels_, + autofill_icons_, + autofill_unique_ids_)); } query_id_ = 0; diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index b613fea..98718c3 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -25,13 +25,13 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/guid.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -180,16 +180,17 @@ void AutoFillManager::DidNavigateMainFramePostCommit( bool AutoFillManager::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutoFillManager, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_FormsSeen, OnFormsSeen) - IPC_MESSAGE_HANDLER(ViewHostMsg_FormSubmitted, OnFormSubmitted) - IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_FormsSeen, OnFormsSeen) + IPC_MESSAGE_HANDLER(AutoFillHostMsg_FormSubmitted, OnFormSubmitted) + IPC_MESSAGE_HANDLER(AutoFillHostMsg_QueryFormFieldAutoFill, OnQueryFormFieldAutoFill) - IPC_MESSAGE_HANDLER(ViewHostMsg_ShowAutoFillDialog, OnShowAutoFillDialog) - IPC_MESSAGE_HANDLER(ViewHostMsg_FillAutoFillFormData, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_ShowAutoFillDialog, + OnShowAutoFillDialog) + IPC_MESSAGE_HANDLER(AutoFillHostMsg_FillAutoFillFormData, OnFillAutoFillFormData) - IPC_MESSAGE_HANDLER(ViewHostMsg_DidFillAutoFillFormData, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_DidFillAutoFillFormData, OnDidFillAutoFillFormData) - IPC_MESSAGE_HANDLER(ViewHostMsg_DidShowAutoFillSuggestions, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_DidShowAutoFillSuggestions, OnDidShowAutoFillSuggestions) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -375,7 +376,7 @@ void AutoFillManager::OnFillAutoFillFormData(int query_id, } } - host->Send(new ViewMsg_AutoFillFormDataFilled( + host->Send(new AutoFillMsg_FormDataFilled( host->routing_id(), query_id, result)); return; } @@ -418,8 +419,8 @@ void AutoFillManager::OnFillAutoFillFormData(int query_id, } autofilled_forms_signatures_.push_front(form_structure->FormSignature()); - host->Send(new ViewMsg_AutoFillFormDataFilled( - host->routing_id(), query_id, result)); + host->Send(new AutoFillMsg_FormDataFilled( + host->routing_id(), query_id, result)); } void AutoFillManager::OnShowAutoFillDialog() { diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 9a3aa8f5..e7a1581 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -24,7 +24,7 @@ #include "chrome/browser/tab_contents/test_tab_contents.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/autofill_messages.h" #include "chrome/test/testing_profile.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" @@ -479,14 +479,14 @@ class AutoFillManagerTest : public RenderViewHostTestHarness { std::vector<string16>* labels, std::vector<string16>* icons, std::vector<int>* unique_ids) { - const uint32 kMsgID = ViewMsg_AutoFillSuggestionsReturned::ID; + const uint32 kMsgID = AutoFillMsg_SuggestionsReturned::ID; const IPC::Message* message = process()->sink().GetFirstMessageMatching(kMsgID); if (!message) return false; AutoFillParam autofill_param; - ViewMsg_AutoFillSuggestionsReturned::Read(message, &autofill_param); + AutoFillMsg_SuggestionsReturned::Read(message, &autofill_param); if (page_id) *page_id = autofill_param.a; if (values) @@ -505,13 +505,13 @@ class AutoFillManagerTest : public RenderViewHostTestHarness { } bool GetAutoFillFormDataFilledMessage(int *page_id, FormData* results) { - const uint32 kMsgID = ViewMsg_AutoFillFormDataFilled::ID; + const uint32 kMsgID = AutoFillMsg_FormDataFilled::ID; const IPC::Message* message = process()->sink().GetFirstMessageMatching(kMsgID); if (!message) return false; Tuple2<int, FormData> autofill_param; - ViewMsg_AutoFillFormDataFilled::Read(message, &autofill_param); + AutoFillMsg_FormDataFilled::Read(message, &autofill_param); if (page_id) *page_id = autofill_param.a; if (results) diff --git a/chrome/browser/chromeos/login/account_creation_view.cc b/chrome/browser/chromeos/login/account_creation_view.cc index ee7a137..d9d5124 100644 --- a/chrome/browser/chromeos/login/account_creation_view.cc +++ b/chrome/browser/chromeos/login/account_creation_view.cc @@ -5,7 +5,7 @@ #include "chrome/browser/chromeos/login/account_creation_view.h" #include "base/string_util.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/autofill_messages.h" #include "webkit/glue/form_data.h" using webkit_glue::FormData; @@ -30,13 +30,13 @@ class AccountCreationTabContents : public WizardWebPageViewTabContents { virtual bool OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AccountCreationTabContents, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_FormSubmitted, OnFormSubmitted) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FormsSeen, ) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_QueryFormFieldAutoFill, ) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ShowAutoFillDialog, ) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FillAutoFillFormData, ) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_DidFillAutoFillFormData, ) - IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_DidShowAutoFillSuggestions, ) + IPC_MESSAGE_HANDLER(AutoFillHostMsg_FormSubmitted, OnFormSubmitted) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_FormsSeen, ) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_QueryFormFieldAutoFill, ) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_ShowAutoFillDialog, ) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_FillAutoFillFormData, ) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_DidFillAutoFillFormData, ) + IPC_MESSAGE_HANDLER_GENERIC(AutoFillHostMsg_DidShowAutoFillSuggestions, ) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index afbc875..cd7b16e 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -14,9 +14,9 @@ #include "chrome/browser/password_manager/password_manager_delegate.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "grit/generated_resources.h" @@ -162,8 +162,9 @@ void PasswordManager::DidNavigateAnyFramePostCommit( bool PasswordManager::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PasswordManager, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsFound, OnPasswordFormsFound) - IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsVisible, + IPC_MESSAGE_HANDLER(AutoFillHostMsg_PasswordFormsFound, + OnPasswordFormsFound) + IPC_MESSAGE_HANDLER(AutoFillHostMsg_PasswordFormsVisible, OnPasswordFormsVisible) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc index 70c263cf..8340f11 100644 --- a/chrome/browser/password_manager_delegate_impl.cc +++ b/chrome/browser/password_manager_delegate_impl.cc @@ -11,6 +11,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/autofill_messages.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -118,7 +119,8 @@ bool SavePasswordInfoBarDelegate::Cancel() { void PasswordManagerDelegateImpl::FillPasswordForm( const webkit_glue::PasswordFormFillData& form_data) { - tab_contents_->render_view_host()->FillPasswordForm(form_data); + tab_contents_->render_view_host()->Send(new AutoFillMsg_FillPasswordForm( + tab_contents_->render_view_host()->routing_id(), form_data)); } void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 566f1fc..e6178d8 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -57,18 +57,10 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" #include "webkit/glue/context_menu.h" -#include "webkit/glue/form_data.h" -#include "webkit/glue/form_field.h" -#include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webdropdata.h" using base::TimeDelta; -using webkit_glue::FormData; -using webkit_glue::FormField; -using webkit_glue::PasswordForm; -using webkit_glue::PasswordFormDomManager; -using webkit_glue::PasswordFormFillData; using WebKit::WebConsoleMessage; using WebKit::WebDragOperation; using WebKit::WebDragOperationNone; @@ -429,11 +421,6 @@ void RenderViewHost::SetAlternateErrorPageURL(const GURL& url) { Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); } -void RenderViewHost::FillPasswordForm( - const webkit_glue::PasswordFormFillData& form_data) { - Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); -} - void RenderViewHost::DragTargetDragEnter( const WebDropData& drop_data, const gfx::Point& client_pt, diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 0864905..bb49437 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -59,10 +59,6 @@ class Point; } // namespace gfx namespace webkit_glue { -struct FormData; -class FormField; -struct PasswordForm; -struct PasswordFormFillData; struct WebAccessibility; } // namespace webkit_glue @@ -245,11 +241,6 @@ class RenderViewHost : public RenderWidgetHost { // alternate error pages. void SetAlternateErrorPageURL(const GURL& url); - // Fill out a password form and trigger DOM autocomplete in the case - // of multiple matching logins. - void FillPasswordForm( - const webkit_glue::PasswordFormFillData& form_data); - // D&d drop target messages that get sent to WebKit. void DragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_pt, diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index a9c366b..2cb8e92 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -27,6 +27,8 @@ 'common/about_handler.h', 'common/app_mode_common_mac.h', 'common/app_mode_common_mac.mm', + 'common/autofill_messages.cc', + 'common/autofill_messages.h', 'common/bindings_policy.h', 'common/child_process.cc', 'common/child_process.h', diff --git a/chrome/common/autofill_messages.cc b/chrome/common/autofill_messages.cc new file mode 100644 index 0000000..80b43f3 --- /dev/null +++ b/chrome/common/autofill_messages.cc @@ -0,0 +1,104 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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 "webkit/glue/form_data.h" +#include "webkit/glue/form_field.h" +#include "webkit/glue/password_form.h" +#include "webkit/glue/password_form_dom_manager.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/autofill_messages.h" + +namespace IPC { + +void ParamTraits<webkit_glue::FormField>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.label()); + WriteParam(m, p.name()); + WriteParam(m, p.value()); + WriteParam(m, p.form_control_type()); + WriteParam(m, p.max_length()); + WriteParam(m, p.is_autofilled()); + WriteParam(m, p.option_strings()); +} + +bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, + param_type* p) { + string16 label, name, value, form_control_type; + int max_length = 0; + bool is_autofilled; + std::vector<string16> options; + bool result = ReadParam(m, iter, &label); + result = result && ReadParam(m, iter, &name); + result = result && ReadParam(m, iter, &value); + result = result && ReadParam(m, iter, &form_control_type); + result = result && ReadParam(m, iter, &max_length); + result = result && ReadParam(m, iter, &is_autofilled); + result = result && ReadParam(m, iter, &options); + if (!result) + return false; + + p->set_label(label); + p->set_name(name); + p->set_value(value); + p->set_form_control_type(form_control_type); + p->set_max_length(max_length); + p->set_autofilled(is_autofilled); + p->set_option_strings(options); + return true; +} + +void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, + std::string* l) { + l->append("<FormField>"); +} + +void ParamTraits<webkit_glue::FormData>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.method); + WriteParam(m, p.origin); + WriteParam(m, p.action); + WriteParam(m, p.user_submitted); + WriteParam(m, p.fields); +} + +bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->method) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->action) && + ReadParam(m, iter, &p->user_submitted) && + ReadParam(m, iter, &p->fields); +} + +void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, + std::string* l) { + l->append("<FormData>"); +} + +void ParamTraits<webkit_glue::PasswordFormFillData>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.basic_data); + WriteParam(m, p.additional_logins); + WriteParam(m, p.wait_for_username); +} + +bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( + const Message* m, void** iter, param_type* r) { + return + ReadParam(m, iter, &r->basic_data) && + ReadParam(m, iter, &r->additional_logins) && + ReadParam(m, iter, &r->wait_for_username); +} + +void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, + std::string* l) { + l->append("<PasswordFormFillData>"); +} + +} // namespace IPC diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h new file mode 100644 index 0000000..4e2f9bc --- /dev/null +++ b/chrome/common/autofill_messages.h @@ -0,0 +1,125 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_AUTOFILL_MESSAGES_H_ +#define CHROME_COMMON_AUTOFILL_MESSAGES_H_ +#pragma once + +#include <string> + +#include "ipc/ipc_message_macros.h" + +#define IPC_MESSAGE_START AutoFillMsgStart + +namespace webkit_glue { +class FormField; +struct FormData; +struct PasswordForm; +struct PasswordFormFillData; +} + +namespace IPC { + +template <> +struct ParamTraits<webkit_glue::FormField> { + typedef webkit_glue::FormField 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 FormData structure to pack/unpack. +template <> +struct ParamTraits<webkit_glue::FormData> { + typedef webkit_glue::FormData 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 ParamTraits<webkit_glue::PasswordFormFillData> { + typedef webkit_glue::PasswordFormFillData param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +// AutoFill messages sent from the browser to the renderer. + +// Reply to the AutoFillHostMsg_QueryFormFieldAutoFill message with the +// AutoFill suggestions. +IPC_MESSAGE_ROUTED5(AutoFillMsg_SuggestionsReturned, + int /* id of the request message */, + std::vector<string16> /* names */, + std::vector<string16> /* labels */, + std::vector<string16> /* icons */, + std::vector<int> /* unique_ids */) + +// Reply to the AutoFillHostMsg_FillAutoFillFormData message with the +// AutoFill form data. +IPC_MESSAGE_ROUTED2(AutoFillMsg_FormDataFilled, + int /* id of the request message */, + webkit_glue::FormData /* form data */) + +// Fill a password form and prepare field autocomplete for multiple +// matching logins. +IPC_MESSAGE_ROUTED1(AutoFillMsg_FillPasswordForm, + webkit_glue::PasswordFormFillData) + + +// AutoFill messages sent from the renderer to the browser. + +// Notification that forms have been seen that are candidates for +// filling/submitting by the AutoFillManager. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_FormsSeen, + std::vector<webkit_glue::FormData> /* forms */) + +// Notification that password forms have been seen that are candidates for +// filling/submitting by the password manager. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_PasswordFormsFound, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that initial layout has occurred and the following password +// forms are visible on the page (e.g. not set to display:none.) +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_PasswordFormsVisible, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that a form has been submitted. The user hit the button. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_FormSubmitted, + webkit_glue::FormData /* form */) + +// Queries the browser for AutoFill suggestions for a form input field. +IPC_MESSAGE_ROUTED3(AutoFillHostMsg_QueryFormFieldAutoFill, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */) + +// Sent when the popup with AutoFill suggestions for a form is shown. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_DidShowAutoFillSuggestions) + +// Instructs the browser to fill in the values for a form using AutoFill +// profile data. +IPC_MESSAGE_ROUTED4(AutoFillHostMsg_FillAutoFillFormData, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */, + int /* profile unique ID */) + +// Sent when a form is previewed or filled with AutoFill suggestions. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_DidFillAutoFillFormData) + +// Instructs the browser to remove the specified Autocomplete entry from the +// database. +IPC_MESSAGE_ROUTED2(AutoFillHostMsg_RemoveAutocompleteEntry, + string16 /* field name */, + string16 /* value */) + +// Instructs the browser to show the AutoFill dialog. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_ShowAutoFillDialog) + +#endif // CHROME_COMMON_AUTOFILL_MESSAGES_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index bab7445..d872fec 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -20,8 +20,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_data.h" -#include "webkit/glue/form_field.h" -#include "webkit/glue/password_form.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcookie.h" @@ -71,49 +69,6 @@ struct ParamTraits<WebMenuItem::Type> { } }; - -void ParamTraits<webkit_glue::FormField>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.label()); - WriteParam(m, p.name()); - WriteParam(m, p.value()); - WriteParam(m, p.form_control_type()); - WriteParam(m, p.max_length()); - WriteParam(m, p.is_autofilled()); - WriteParam(m, p.option_strings()); -} - -bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, - param_type* p) { - string16 label, name, value, form_control_type; - int max_length = 0; - bool is_autofilled; - std::vector<string16> options; - bool result = ReadParam(m, iter, &label); - result = result && ReadParam(m, iter, &name); - result = result && ReadParam(m, iter, &value); - result = result && ReadParam(m, iter, &form_control_type); - result = result && ReadParam(m, iter, &max_length); - result = result && ReadParam(m, iter, &is_autofilled); - result = result && ReadParam(m, iter, &options); - if (!result) - return false; - - p->set_label(label); - p->set_name(name); - p->set_value(value); - p->set_form_control_type(form_control_type); - p->set_max_length(max_length); - p->set_autofilled(is_autofilled); - p->set_option_strings(options); - return true; -} - -void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, - std::string* l) { - l->append("<FormField>"); -} - #if defined(OS_MACOSX) void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { WriteParam(m, p.font_name); @@ -299,26 +254,6 @@ void ParamTraits<webkit::npapi::WebPluginInfo>::Log(const param_type& p, l->append(")"); } -void ParamTraits<webkit_glue::PasswordFormFillData>::Write( - Message* m, const param_type& p) { - WriteParam(m, p.basic_data); - WriteParam(m, p.additional_logins); - WriteParam(m, p.wait_for_username); -} - -bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( - const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->basic_data) && - ReadParam(m, iter, &r->additional_logins) && - ReadParam(m, iter, &r->wait_for_username); -} - -void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, - std::string* l) { - l->append("<PasswordFormFillData>"); -} - void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( Message* m, const param_type& p) { WriteParam(m, p.get() != NULL); @@ -563,48 +498,22 @@ void ParamTraits<ResourceResponseHead>::Log(const param_type& p, } void ParamTraits<SyncLoadResult>::Write(Message* m, const param_type& p) { - ParamTraits<ResourceResponseHead>::Write(m, p); - WriteParam(m, p.final_url); - WriteParam(m, p.data); - } + ParamTraits<ResourceResponseHead>::Write(m, p); + WriteParam(m, p.final_url); + WriteParam(m, p.data); +} bool ParamTraits<SyncLoadResult>::Read(const Message* m, void** iter, param_type* r) { - return - ParamTraits<ResourceResponseHead>::Read(m, iter, r) && - ReadParam(m, iter, &r->final_url) && - ReadParam(m, iter, &r->data); - } - -void ParamTraits<SyncLoadResult>::Log(const param_type& p, std::string* l) { - // log more? - ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); - } - -void ParamTraits<webkit_glue::FormData>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.method); - WriteParam(m, p.origin); - WriteParam(m, p.action); - WriteParam(m, p.user_submitted); - WriteParam(m, p.fields); -} - -bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, - param_type* p) { return - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->action) && - ReadParam(m, iter, &p->user_submitted) && - ReadParam(m, iter, &p->fields); + ParamTraits<ResourceResponseHead>::Read(m, iter, r) && + ReadParam(m, iter, &r->final_url) && + ReadParam(m, iter, &r->data); } -void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, - std::string* l) { - l->append("<FormData>"); +void ParamTraits<SyncLoadResult>::Log(const param_type& p, std::string* l) { + // log more? + ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); } void ParamTraits<RendererPreferences>::Write(Message* m, const param_type& p) { diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 8cc75ff..f0ce905 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -49,9 +49,6 @@ class BlobData; } namespace webkit_glue { -struct FormData; -class FormField; -struct PasswordFormFillData; struct ResourceDevToolsInfo; struct ResourceLoadTimingInfo; struct ResourceResponseInfo; @@ -136,15 +133,6 @@ enum ViewHostMsg_JavaScriptStressTestControl_Commands { namespace IPC { -// Traits for FormField_Params structure to pack/unpack. -template <> -struct ParamTraits<webkit_glue::FormField> { - typedef webkit_glue::FormField 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); -}; - #if defined(OS_MACOSX) // Traits for FontDescriptor structure to pack/unpack. template <> @@ -189,15 +177,6 @@ struct ParamTraits<webkit::npapi::WebPluginInfo> { static void Log(const param_type& p, std::string* l); }; -// Traits for webkit_glue::PasswordFormDomManager::FillData. -template <> -struct ParamTraits<webkit_glue::PasswordFormFillData> { - typedef webkit_glue::PasswordFormFillData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - template <> struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { typedef scoped_refptr<net::HttpResponseHeaders> param_type; @@ -248,15 +227,6 @@ struct ParamTraits<SyncLoadResult> { static void Log(const param_type& p, std::string* l); }; -// Traits for FormData structure to pack/unpack. -template <> -struct ParamTraits<webkit_glue::FormData> { - typedef webkit_glue::FormData 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 reading/writing CSS Colors template <> struct ParamTraits<CSSColors::CSSColorName> { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index b93e606..6d331d0 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -27,8 +27,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "webkit/glue/context_menu.h" -#include "webkit/glue/form_data.h" -#include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/webdropdata.h" #include "webkit/plugins/npapi/webplugininfo.h" @@ -465,15 +463,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_ResetPageEncodingToDefault) IPC_MESSAGE_ROUTED1(ViewMsg_ReservePageIDRange, int /* size_of_range */) -// Fill a form with data and optionally submit it -IPC_MESSAGE_ROUTED1(ViewMsg_FormFill, - webkit_glue::FormData /* form */) - -// Fill a password form and prepare field autocomplete for multiple -// matching logins. -IPC_MESSAGE_ROUTED1(ViewMsg_FillPasswordForm, - webkit_glue::PasswordFormFillData) - // D&d drop target messages. IPC_MESSAGE_ROUTED4(ViewMsg_DragTargetDragEnter, WebDropData /* drop_data */, @@ -699,21 +688,6 @@ IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked, int /* host_id */, GURL /* manifest_url */) -// Reply to the ViewHostMsg_QueryFormFieldAutoFill message with the -// AutoFill suggestions. -IPC_MESSAGE_ROUTED5(ViewMsg_AutoFillSuggestionsReturned, - int /* id of the request message */, - std::vector<string16> /* names */, - std::vector<string16> /* labels */, - std::vector<string16> /* icons */, - std::vector<int> /* unique_ids */) - -// Reply to the ViewHostMsg_FillAutoFillFormData message with the -// AutoFill form data. -IPC_MESSAGE_ROUTED2(ViewMsg_AutoFillFormDataFilled, - int /* id of the request message */, - webkit_glue::FormData /* form data */) - // Sent by the Browser process to alert a window about whether a it should // allow a scripted window.close(). The renderer assumes every new window is a // blocked popup until notified otherwise. @@ -1664,25 +1638,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_SelectionChanged, IPC_MESSAGE_ROUTED1(ViewHostMsg_RunFileChooser, ViewHostMsg_RunFileChooser_Params) -// Notification that forms have been seen that are candidates for -// filling/submitting by the AutoFillManager. -IPC_MESSAGE_ROUTED1(ViewHostMsg_FormsSeen, - std::vector<webkit_glue::FormData> /* forms */) - -// Notification that password forms have been seen that are candidates for -// filling/submitting by the password manager. -IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsFound, - std::vector<webkit_glue::PasswordForm> /* forms */) - -// Notification that initial layout has occurred and the following password -// forms are visible on the page (e.g. not set to display:none.) -IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsVisible, - std::vector<webkit_glue::PasswordForm> /* forms */) - -// Notification that a form has been submitted. The user hit the button. -IPC_MESSAGE_ROUTED1(ViewHostMsg_FormSubmitted, - webkit_glue::FormData /* form */) - // Used to tell the parent the user started dragging in the content area. The // WebDropData struct contains contextual information about the pieces of the // page the user dragged. The parent uses this notification to initiate a @@ -2027,35 +1982,6 @@ IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetResourceList, std::vector<appcache::AppCacheResourceInfo> /* resources out */) -// Queries the browser for AutoFill suggestions for a form input field. -IPC_MESSAGE_ROUTED3(ViewHostMsg_QueryFormFieldAutoFill, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */) - -// Sent when the popup with AutoFill suggestions for a form is shown. -IPC_MESSAGE_ROUTED0(ViewHostMsg_DidShowAutoFillSuggestions) - -// Instructs the browser to fill in the values for a form using AutoFill -// profile data. -IPC_MESSAGE_ROUTED4(ViewHostMsg_FillAutoFillFormData, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */, - int /* profile unique ID */) - -// Sent when a form is previewed or filled with AutoFill suggestions. -IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFillAutoFillFormData) - -// Instructs the browser to remove the specified Autocomplete entry from the -// database. -IPC_MESSAGE_ROUTED2(ViewHostMsg_RemoveAutocompleteEntry, - string16 /* field name */, - string16 /* value */) - -// Instructs the browser to show the AutoFill dialog. -IPC_MESSAGE_ROUTED0(ViewHostMsg_ShowAutoFillDialog) - // Get the list of proxies to use for |url|, as a semicolon delimited list // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also // PluginProcessHostMsg_ResolveProxy which does the same thing. diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc index f93e8c0..462aeb8 100644 --- a/chrome/renderer/autofill_helper.cc +++ b/chrome/renderer/autofill_helper.cc @@ -5,8 +5,8 @@ #include "chrome/renderer/autofill_helper.h" #include "base/utf_string_conversions.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_constants.h" -#include "chrome/common/render_messages.h" #include "chrome/renderer/form_manager.h" #include "chrome/renderer/password_autocomplete_manager.h" #include "chrome/renderer/render_view.h" @@ -55,9 +55,8 @@ AutoFillHelper::AutoFillHelper( bool AutoFillHelper::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutoFillHelper, message) - IPC_MESSAGE_HANDLER(ViewMsg_AutoFillSuggestionsReturned, - OnSuggestionsReturned) - IPC_MESSAGE_HANDLER(ViewMsg_AutoFillFormDataFilled, OnFormDataFilled) + IPC_MESSAGE_HANDLER(AutoFillMsg_SuggestionsReturned, OnSuggestionsReturned) + IPC_MESSAGE_HANDLER(AutoFillMsg_FormDataFilled, OnFormDataFilled) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -99,7 +98,7 @@ void AutoFillHelper::didAcceptAutoFillSuggestion(const WebKit::WebNode& node, if (suggestions_options_index_ != -1 && index == static_cast<unsigned>(suggestions_options_index_)) { // User selected 'AutoFill Options'. - Send(new ViewHostMsg_ShowAutoFillDialog(routing_id())); + Send(new AutoFillHostMsg_ShowAutoFillDialog(routing_id())); } else if (suggestions_clear_index_ != -1 && index == static_cast<unsigned>(suggestions_clear_index_)) { // User selected 'Clear form'. @@ -149,7 +148,7 @@ void AutoFillHelper::removeAutocompleteSuggestion( if (suggestions_options_index_ != -1) suggestions_options_index_--; - Send(new ViewHostMsg_RemoveAutocompleteEntry(routing_id(), name, value)); + Send(new AutoFillHostMsg_RemoveAutocompleteEntry(routing_id(), name, value)); } void AutoFillHelper::textFieldDidEndEditing( @@ -262,7 +261,7 @@ void AutoFillHelper::OnSuggestionsReturned( autofill_query_node_, v, l, i, ids, separator_index); } - Send(new ViewHostMsg_DidShowAutoFillSuggestions(routing_id())); + Send(new AutoFillHostMsg_DidShowAutoFillSuggestions(routing_id())); } void AutoFillHelper::OnFormDataFilled( @@ -281,7 +280,7 @@ void AutoFillHelper::OnFormDataFilled( NOTREACHED(); } autofill_action_ = AUTOFILL_NONE; - Send(new ViewHostMsg_DidFillAutoFillFormData(routing_id())); + Send(new AutoFillHostMsg_DidFillAutoFillFormData(routing_id())); } void AutoFillHelper::ShowSuggestions(const WebInputElement& element, @@ -330,7 +329,7 @@ void AutoFillHelper::QueryAutoFillSuggestions( &field); } - Send(new ViewHostMsg_QueryFormFieldAutoFill( + Send(new AutoFillHostMsg_QueryFormFieldAutoFill( routing_id(), autofill_query_id_, form, field)); } @@ -347,7 +346,7 @@ void AutoFillHelper::FillAutoFillFormData(const WebNode& node, autofill_action_ = action; was_query_node_autofilled_ = field.is_autofilled(); - Send(new ViewHostMsg_FillAutoFillFormData( + Send(new AutoFillHostMsg_FillAutoFillFormData( routing_id(), autofill_query_id_, form, field, unique_id)); } @@ -370,7 +369,7 @@ void AutoFillHelper::SendForms(WebFrame* frame) { } if (!forms.empty()) - Send(new ViewHostMsg_FormsSeen(routing_id(), forms)); + Send(new AutoFillHostMsg_FormsSeen(routing_id(), forms)); } bool AutoFillHelper::FindFormAndFieldForNode(const WebNode& node, diff --git a/chrome/renderer/form_autocomplete_browsertest.cc b/chrome/renderer/form_autocomplete_browsertest.cc index 9f79adc..1041e76 100644 --- a/chrome/renderer/form_autocomplete_browsertest.cc +++ b/chrome/renderer/form_autocomplete_browsertest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/render_messages.h" +#include "chrome/common/autofill_messages.h" #include "chrome/test/render_view_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" @@ -32,11 +32,11 @@ TEST_F(FormAutocompleteTest, NormalFormSubmit) { ProcessPendingMessages(); const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormSubmitted::ID); + AutoFillHostMsg_FormSubmitted::ID); ASSERT_TRUE(message != NULL); Tuple1<FormData> forms; - ViewHostMsg_FormSubmitted::Read(message, &forms); + AutoFillHostMsg_FormSubmitted::Read(message, &forms); ASSERT_EQ(2U, forms.a.fields.size()); webkit_glue::FormField& form_field = forms.a.fields[0]; @@ -63,7 +63,7 @@ TEST_F(FormAutocompleteTest, AutoCompleteOffFormSubmit) { // No FormSubmitted message should have been sent. EXPECT_FALSE(render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormSubmitted::ID)); + AutoFillHostMsg_FormSubmitted::ID)); } // Tests that fields with autocomplete off are not submitted. @@ -80,11 +80,11 @@ TEST_F(FormAutocompleteTest, AutoCompleteOffInputSubmit) { // No FormSubmitted message should have been sent. const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormSubmitted::ID); + AutoFillHostMsg_FormSubmitted::ID); ASSERT_TRUE(message != NULL); Tuple1<FormData> forms; - ViewHostMsg_FormSubmitted::Read(message, &forms); + AutoFillHostMsg_FormSubmitted::Read(message, &forms); ASSERT_EQ(1U, forms.a.fields.size()); webkit_glue::FormField& form_field = forms.a.fields[0]; @@ -117,5 +117,5 @@ TEST_F(FormAutocompleteTest, FAILS_DynamicAutoCompleteOffFormSubmit) { // No FormSubmitted message should have been sent. EXPECT_FALSE(render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormSubmitted::ID)); + AutoFillHostMsg_FormSubmitted::ID)); } diff --git a/chrome/renderer/password_autocomplete_manager.cc b/chrome/renderer/password_autocomplete_manager.cc index 93680eb..24d8cabf 100644 --- a/chrome/renderer/password_autocomplete_manager.cc +++ b/chrome/renderer/password_autocomplete_manager.cc @@ -6,7 +6,7 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/autofill_messages.h" #include "chrome/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" @@ -341,9 +341,10 @@ void PasswordAutocompleteManager::SendPasswordForms(WebKit::WebFrame* frame, return; if (only_visible) { - Send(new ViewHostMsg_PasswordFormsVisible(routing_id(), password_forms)); + Send(new AutoFillHostMsg_PasswordFormsVisible( + routing_id(), password_forms)); } else { - Send(new ViewHostMsg_PasswordFormsFound(routing_id(), password_forms)); + Send(new AutoFillHostMsg_PasswordFormsFound(routing_id(), password_forms)); } } @@ -351,7 +352,7 @@ bool PasswordAutocompleteManager::OnMessageReceived( const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PasswordAutocompleteManager, message) - IPC_MESSAGE_HANDLER(ViewMsg_FillPasswordForm, OnFillPasswordForm) + IPC_MESSAGE_HANDLER(AutoFillMsg_FillPasswordForm, OnFillPasswordForm) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/chrome/renderer/password_autocomplete_manager_unittest.cc b/chrome/renderer/password_autocomplete_manager_unittest.cc index d4609a7..ea4b93d 100644 --- a/chrome/renderer/password_autocomplete_manager_unittest.cc +++ b/chrome/renderer/password_autocomplete_manager_unittest.cc @@ -4,6 +4,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/common/autofill_messages.h" #include "chrome/renderer/autofill_helper.h" #include "chrome/renderer/password_autocomplete_manager.h" #include "chrome/test/render_view_test.h" @@ -62,7 +63,7 @@ class PasswordAutocompleteManagerTest : public RenderViewTest { // protected. void SimulateOnFillPasswordForm( const PasswordFormFillData& fill_data) { - ViewMsg_FillPasswordForm msg(0, fill_data); + AutoFillMsg_FillPasswordForm msg(0, fill_data); password_autocomplete_->OnMessageReceived(msg); } @@ -176,11 +177,11 @@ TEST_F(PasswordAutocompleteManagerTest, InitialAutocomplete) { // The form has been loaded, we should have sent the browser a message about // the form. const IPC::Message* msg = render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_PasswordFormsFound::ID); + AutoFillHostMsg_PasswordFormsFound::ID); ASSERT_TRUE(msg != NULL); Tuple1<std::vector<PasswordForm> > forms; - ViewHostMsg_PasswordFormsFound::Read(msg, &forms); + AutoFillHostMsg_PasswordFormsFound::Read(msg, &forms); ASSERT_EQ(1U, forms.a.size()); PasswordForm password_form = forms.a[0]; EXPECT_EQ(PasswordForm::SCHEME_HTML, password_form.scheme); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 9d61c0f..afb344d 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -22,6 +22,7 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/appcache/appcache_dispatcher.h" #include "chrome/common/bindings_policy.h" #include "chrome/common/child_process_logging.h" @@ -3124,7 +3125,7 @@ void RenderView::willSubmitForm(WebFrame* frame, const WebFormElement& form) { static_cast<FormManager::ExtractMask>(FormManager::EXTRACT_VALUE | FormManager::EXTRACT_OPTION_TEXT), &form_data)) { - Send(new ViewHostMsg_FormSubmitted(routing_id_, form_data)); + Send(new AutoFillHostMsg_FormSubmitted(routing_id_, form_data)); } } diff --git a/chrome/renderer/render_view_browsertest.cc b/chrome/renderer/render_view_browsertest.cc index c44174d..484f659 100644 --- a/chrome/renderer/render_view_browsertest.cc +++ b/chrome/renderer/render_view_browsertest.cc @@ -8,6 +8,7 @@ #include "base/shared_memory.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/common/autofill_messages.h" #include "chrome/common/content_settings.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/render_messages.h" @@ -1027,10 +1028,10 @@ TEST_F(RenderViewTest, SendForms) { // Verify that "FormsSeen" sends the expected number of fields. ProcessPendingMessages(); const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormsSeen::ID); + AutoFillHostMsg_FormsSeen::ID); ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_FormsSeen::Param params; - ViewHostMsg_FormsSeen::Read(message, ¶ms); + AutoFillHostMsg_FormsSeen::Param params; + AutoFillHostMsg_FormsSeen::Read(message, ¶ms); const std::vector<FormData>& forms = params.a; ASSERT_EQ(1UL, forms.size()); ASSERT_EQ(3UL, forms[0].fields.size()); @@ -1065,7 +1066,7 @@ TEST_F(RenderViewTest, SendForms) { // Accept suggestion that contains a label. Labeled items indicate AutoFill // as opposed to Autocomplete. We're testing this distinction below with - // the |ViewHostMsg_FillAutoFillFormData::ID| message. + // the |AutoFillHostMsg_FillAutoFillFormData::ID| message. autofill_helper_->didAcceptAutoFillSuggestion( firstname, WebKit::WebString::fromUTF8("Johnny"), @@ -1075,10 +1076,10 @@ TEST_F(RenderViewTest, SendForms) { ProcessPendingMessages(); const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_FillAutoFillFormData::ID); + AutoFillHostMsg_FillAutoFillFormData::ID); ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); - ViewHostMsg_FillAutoFillFormData::Param params2; - ViewHostMsg_FillAutoFillFormData::Read(message2, ¶ms2); + AutoFillHostMsg_FillAutoFillFormData::Param params2; + AutoFillHostMsg_FillAutoFillFormData::Read(message2, ¶ms2); const FormData& form2 = params2.b; ASSERT_EQ(3UL, form2.fields.size()); EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack( @@ -1118,10 +1119,10 @@ TEST_F(RenderViewTest, FillFormElement) { // Verify that "FormsSeen" sends the expected number of fields. ProcessPendingMessages(); const IPC::Message* message = render_thread_.sink().GetFirstMessageMatching( - ViewHostMsg_FormsSeen::ID); + AutoFillHostMsg_FormsSeen::ID); ASSERT_NE(static_cast<IPC::Message*>(NULL), message); - ViewHostMsg_FormsSeen::Param params; - ViewHostMsg_FormsSeen::Read(message, ¶ms); + AutoFillHostMsg_FormsSeen::Param params; + AutoFillHostMsg_FormsSeen::Read(message, ¶ms); const std::vector<FormData>& forms = params.a; ASSERT_EQ(1UL, forms.size()); ASSERT_EQ(2UL, forms[0].fields.size()); @@ -1161,7 +1162,7 @@ TEST_F(RenderViewTest, FillFormElement) { ProcessPendingMessages(); const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( - ViewHostMsg_FillAutoFillFormData::ID); + AutoFillHostMsg_FillAutoFillFormData::ID); // No message should be sent in this case. |firstname| is filled directly. ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index b391e6d..723a0b3 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -67,6 +67,7 @@ enum IPCMessageStart { PepperFileMsgStart, SpeechInputMsgStart, PepperMsgStart, + AutoFillMsgStart, }; class DictionaryValue; |