summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-01-21 06:12:06 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-21 14:14:29 +0000
commitd0a0c992fc0eb9c81d514a256a5c0eb7928efea6 (patch)
treec3f2161963f79d5801ec361231e059dc4f430863 /components
parentb43e6cc69ecb0049bbcd84b41cd13847cd01bc4b (diff)
downloadchromium_src-d0a0c992fc0eb9c81d514a256a5c0eb7928efea6.zip
chromium_src-d0a0c992fc0eb9c81d514a256a5c0eb7928efea6.tar.gz
chromium_src-d0a0c992fc0eb9c81d514a256a5c0eb7928efea6.tar.bz2
Remove RenderViewObserver::Resized (try 2)
The only client was AutofillAgent; reimplement the functionality in a slightly different way. While we're at it, fix a bug where the browser-owned popup is hidden without the renderer's knowledge. BUG=433486,449325 Review URL: https://codereview.chromium.org/854943002 Cr-Commit-Position: refs/heads/master@{#312346}
Diffstat (limited to 'components')
-rw-r--r--components/autofill/content/browser/content_autofill_driver.cc7
-rw-r--r--components/autofill/content/browser/content_autofill_driver.h1
-rw-r--r--components/autofill/content/common/autofill_messages.h3
-rw-r--r--components/autofill/content/renderer/autofill_agent.cc18
-rw-r--r--components/autofill/content/renderer/autofill_agent.h7
-rw-r--r--components/autofill/core/browser/autofill_driver.h3
-rw-r--r--components/autofill/core/browser/autofill_external_delegate.cc1
-rw-r--r--components/autofill/core/browser/test_autofill_driver.cc3
-rw-r--r--components/autofill/core/browser/test_autofill_driver.h1
9 files changed, 28 insertions, 16 deletions
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc
index bae84ee..d21db43 100644
--- a/components/autofill/content/browser/content_autofill_driver.cc
+++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -145,6 +145,13 @@ void ContentAutofillDriver::RendererShouldPreviewFieldWithValue(
render_frame_host_->GetRoutingID(), value));
}
+void ContentAutofillDriver::PopupHidden() {
+ if (!RendererIsAvailable())
+ return;
+ render_frame_host_->Send(
+ new AutofillMsg_PopupHidden(render_frame_host_->GetRoutingID()));
+}
+
bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message)
diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h
index cb35d81..98bac40 100644
--- a/components/autofill/content/browser/content_autofill_driver.h
+++ b/components/autofill/content/browser/content_autofill_driver.h
@@ -61,6 +61,7 @@ class ContentAutofillDriver : public AutofillDriver {
void RendererShouldFillFieldWithValue(const base::string16& value) override;
void RendererShouldPreviewFieldWithValue(
const base::string16& value) override;
+ void PopupHidden() override;
// Handles a message that came from the associated render frame.
bool HandleMessage(const IPC::Message& message);
diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h
index bc2e5af..94a2748 100644
--- a/components/autofill/content/common/autofill_messages.h
+++ b/components/autofill/content/common/autofill_messages.h
@@ -155,6 +155,9 @@ IPC_MESSAGE_ROUTED1(AutofillMsg_FillFieldWithValue,
IPC_MESSAGE_ROUTED1(AutofillMsg_PreviewFieldWithValue,
base::string16 /* value */)
+// The popup has been hidden.
+IPC_MESSAGE_ROUTED0(AutofillMsg_PopupHidden);
+
// Sets the currently selected node's value to be the given data list value.
IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptDataListSuggestion,
base::string16 /* accepted data list value */)
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index 6afbd4c..2c48d11 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -172,6 +172,7 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
OnFillPasswordSuggestion)
IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPasswordSuggestion,
OnPreviewPasswordSuggestion)
+ IPC_MESSAGE_HANDLER(AutofillMsg_PopupHidden, OnPopupHidden)
IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteResult,
OnRequestAutocompleteResult)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -234,10 +235,6 @@ void AutofillAgent::FocusedNodeChanged(const WebNode& node) {
element_ = *element;
}
-void AutofillAgent::Resized() {
- HidePopup();
-}
-
void AutofillAgent::didRequestAutocomplete(
const WebFormElement& form) {
DCHECK_EQ(form.document().frame(), render_frame()->GetWebFrame());
@@ -550,6 +547,11 @@ void AutofillAgent::OnPreviewPasswordSuggestion(
DCHECK(handled);
}
+void AutofillAgent::OnPopupHidden() {
+ if (!element_.isNull())
+ OnClearPreviewedForm();
+}
+
void AutofillAgent::OnRequestAutocompleteResult(
WebFormElement::AutocompleteResult result,
const base::string16& message,
@@ -740,10 +742,6 @@ void AutofillAgent::ProcessForms() {
void AutofillAgent::HidePopup() {
if (!is_popup_possibly_visible_)
return;
-
- if (!element_.isNull())
- OnClearPreviewedForm();
-
is_popup_possibly_visible_ = false;
Send(new AutofillHostMsg_HidePopup(routing_id()));
}
@@ -785,8 +783,4 @@ void AutofillAgent::LegacyAutofillAgent::FocusedNodeChanged(
agent_->FocusedNodeChanged(node);
}
-void AutofillAgent::LegacyAutofillAgent::Resized() {
- agent_->Resized();
-}
-
} // namespace autofill
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h
index ea90fd9..13c35ad 100644
--- a/components/autofill/content/renderer/autofill_agent.h
+++ b/components/autofill/content/renderer/autofill_agent.h
@@ -67,7 +67,6 @@ class AutofillAgent : public content::RenderFrameObserver,
// content::RenderViewObserver:
void OnDestruct() override;
void FocusedNodeChanged(const blink::WebNode& node) override;
- void Resized() override;
AutofillAgent* agent_;
@@ -115,10 +114,9 @@ class AutofillAgent : public content::RenderFrameObserver,
void WillSubmitForm(const blink::WebFormElement& form) override;
void DidChangeScrollOffset() override;
- // Pass-throughs from LegacyAutofillAgent. These correlate with
- // RenderViewObserver methods.
+ // Pass-through from LegacyAutofillAgent. This correlates with the
+ // RenderViewObserver method.
void FocusedNodeChanged(const blink::WebNode& node);
- void Resized();
// PageClickListener:
void FormControlElementClicked(const blink::WebFormControlElement& element,
@@ -158,6 +156,7 @@ class AutofillAgent : public content::RenderFrameObserver,
const base::string16& password);
void OnPreviewPasswordSuggestion(const base::string16& username,
const base::string16& password);
+ void OnPopupHidden();
// Called when interactive autocomplete finishes. |message| is printed to
// the console if non-empty.
diff --git a/components/autofill/core/browser/autofill_driver.h b/components/autofill/core/browser/autofill_driver.h
index b690191..368f1f4 100644
--- a/components/autofill/core/browser/autofill_driver.h
+++ b/components/autofill/core/browser/autofill_driver.h
@@ -89,6 +89,9 @@ class AutofillDriver {
// Tells the renderer to preview the node with suggested text.
virtual void RendererShouldPreviewFieldWithValue(
const base::string16& value) = 0;
+
+ // Informs the renderer that the popup has been hidden.
+ virtual void PopupHidden() = 0;
};
} // namespace autofill
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc
index 8eac4f0..85e6cdf 100644
--- a/components/autofill/core/browser/autofill_external_delegate.cc
+++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -190,6 +190,7 @@ void AutofillExternalDelegate::OnPopupShown() {
}
void AutofillExternalDelegate::OnPopupHidden() {
+ driver_->PopupHidden();
}
void AutofillExternalDelegate::DidSelectSuggestion(
diff --git a/components/autofill/core/browser/test_autofill_driver.cc b/components/autofill/core/browser/test_autofill_driver.cc
index 76bb9d5..6c978a5 100644
--- a/components/autofill/core/browser/test_autofill_driver.cc
+++ b/components/autofill/core/browser/test_autofill_driver.cc
@@ -73,4 +73,7 @@ void TestAutofillDriver::RendererShouldPreviewFieldWithValue(
const base::string16& value) {
}
+void TestAutofillDriver::PopupHidden() {
+}
+
} // namespace autofill
diff --git a/components/autofill/core/browser/test_autofill_driver.h b/components/autofill/core/browser/test_autofill_driver.h
index 11f06ff..35fb8ec 100644
--- a/components/autofill/core/browser/test_autofill_driver.h
+++ b/components/autofill/core/browser/test_autofill_driver.h
@@ -44,6 +44,7 @@ class TestAutofillDriver : public AutofillDriver {
void RendererShouldFillFieldWithValue(const base::string16& value) override;
void RendererShouldPreviewFieldWithValue(
const base::string16& value) override;
+ void PopupHidden() override;
// Methods that tests can use to specialize functionality.