diff options
Diffstat (limited to 'components/autofill/content')
5 files changed, 25 insertions, 0 deletions
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc index 62c64b2..54b095e 100644 --- a/components/autofill/content/browser/content_autofill_driver.cc +++ b/components/autofill/content/browser/content_autofill_driver.cc @@ -108,6 +108,13 @@ void ContentAutofillDriver::SendFormDataToRenderer( } } +void ContentAutofillDriver::PingRenderer() { + if (!RendererIsAvailable()) + return; + content::RenderViewHost* host = web_contents()->GetRenderViewHost(); + host->Send(new AutofillMsg_Ping(host->GetRoutingID())); +} + void ContentAutofillDriver::SendAutofillTypePredictionsToRenderer( const std::vector<FormStructure*>& forms) { if (!CommandLine::ForCurrentProcess()->HasSwitch( @@ -181,6 +188,9 @@ bool ContentAutofillDriver::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_FORWARD(AutofillHostMsg_DidPreviewAutofillFormData, autofill_manager_.get(), AutofillManager::OnDidPreviewAutofillFormData) + IPC_MESSAGE_FORWARD(AutofillHostMsg_PingAck, + &autofill_external_delegate_, + AutofillExternalDelegate::OnPingAck) IPC_MESSAGE_FORWARD(AutofillHostMsg_DidFillAutofillFormData, autofill_manager_.get(), AutofillManager::OnDidFillAutofillFormData) diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h index ea21879..5fde045 100644 --- a/components/autofill/content/browser/content_autofill_driver.h +++ b/components/autofill/content/browser/content_autofill_driver.h @@ -50,6 +50,7 @@ class ContentAutofillDriver : public AutofillDriver, virtual void SendFormDataToRenderer(int query_id, RendererFormDataAction action, const FormData& data) OVERRIDE; + virtual void PingRenderer() OVERRIDE; virtual void SendAutofillTypePredictionsToRenderer( const std::vector<FormStructure*>& forms) OVERRIDE; virtual void RendererShouldAcceptDataListSuggestion( diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h index cb9fc6a..f9a99fe 100644 --- a/components/autofill/content/common/autofill_messages.h +++ b/components/autofill/content/common/autofill_messages.h @@ -94,6 +94,11 @@ IPC_ENUM_TRAITS_MAX_VALUE( // Autofill messages sent from the browser to the renderer. +// Instructs the renderer to immediately return an IPC acknowledging the ping. +// This is used to correctly sequence events, since IPCs are guaranteed to be +// processed in order. +IPC_MESSAGE_ROUTED0(AutofillMsg_Ping) + // Instructs the renderer to fill the active form with the given form data. IPC_MESSAGE_ROUTED2(AutofillMsg_FillForm, int /* query_id */, @@ -227,6 +232,9 @@ IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill, // Sent when a form is previewed with Autofill suggestions. IPC_MESSAGE_ROUTED0(AutofillHostMsg_DidPreviewAutofillFormData) +// Sent immediately after the renderer receives a ping IPC. +IPC_MESSAGE_ROUTED0(AutofillHostMsg_PingAck) + // Sent when a form is filled with Autofill suggestions. IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidFillAutofillFormData, base::TimeTicks /* timestamp */) diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index bcc9a4a..bfd5731 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc @@ -150,6 +150,7 @@ AutofillAgent::~AutofillAgent() {} bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message) + IPC_MESSAGE_HANDLER(AutofillMsg_Ping, OnPing) IPC_MESSAGE_HANDLER(AutofillMsg_FillForm, OnFillForm) IPC_MESSAGE_HANDLER(AutofillMsg_PreviewForm, OnPreviewForm) IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable, @@ -454,6 +455,10 @@ void AutofillAgent::OnFillForm(int query_id, const FormData& form) { base::TimeTicks::Now())); } +void AutofillAgent::OnPing() { + Send(new AutofillHostMsg_PingAck(routing_id())); +} + void AutofillAgent::OnPreviewForm(int query_id, const FormData& form) { if (!render_view()->GetWebView() || query_id != autofill_query_id_) return; diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h index 54a7c46..dafcd70 100644 --- a/components/autofill/content/renderer/autofill_agent.h +++ b/components/autofill/content/renderer/autofill_agent.h @@ -97,6 +97,7 @@ class AutofillAgent : public content::RenderViewObserver, void OnFieldTypePredictionsAvailable( const std::vector<FormDataPredictions>& forms); void OnFillForm(int query_id, const FormData& form); + void OnPing(); void OnPreviewForm(int query_id, const FormData& form); // For external Autofill selection. |