summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-20 01:04:26 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-20 01:04:26 +0000
commit7aab84ba9061a72fa5b82ecb738c3263e66ff079 (patch)
treede942533e3e31f9df88c3222c4d6cfe65c5cdc5f /chrome
parent14eb15af3c97923a782f7f90ec3f4bdf0e142f93 (diff)
downloadchromium_src-7aab84ba9061a72fa5b82ecb738c3263e66ff079.zip
chromium_src-7aab84ba9061a72fa5b82ecb738c3263e66ff079.tar.gz
chromium_src-7aab84ba9061a72fa5b82ecb738c3263e66ff079.tar.bz2
Up/Down arrow keys no longer bring up autofill menu
Adds key down event handling to AutoFillHelper to replace deprecated queryAutofillSuggestions callback. BUG=62587 TEST=Manual, according to bug: Load fillable form, arrow up/down in input field, expect Autofill suggestions to show. Review URL: http://codereview.chromium.org/5206003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66858 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/autofill_helper.cc15
-rw-r--r--chrome/renderer/autofill_helper.h16
-rw-r--r--chrome/renderer/render_view.cc1
3 files changed, 22 insertions, 10 deletions
diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc
index 9c683ef..934d634 100644
--- a/chrome/renderer/autofill_helper.cc
+++ b/chrome/renderer/autofill_helper.cc
@@ -4,6 +4,7 @@
#include "chrome/renderer/autofill_helper.h"
+#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
@@ -23,6 +24,7 @@ using WebKit::WebFormControlElement;
using WebKit::WebFormElement;
using WebKit::WebFrame;
using WebKit::WebInputElement;
+using WebKit::WebKeyboardEvent;
using WebKit::WebNode;
using WebKit::WebString;
@@ -191,7 +193,7 @@ void AutoFillHelper::FormDataFilled(int query_id,
void AutoFillHelper::DidSelectAutoFillSuggestion(const WebNode& node,
int unique_id) {
DidClearAutoFillSelection(node);
- QueryAutoFillFormData(node, unique_id, AUTOFILL_PREVIEW);
+ FillAutoFillFormData(node, unique_id, AUTOFILL_PREVIEW);
}
void AutoFillHelper::DidAcceptAutoFillSuggestion(const WebNode& node,
@@ -220,7 +222,7 @@ void AutoFillHelper::DidAcceptAutoFillSuggestion(const WebNode& node,
webframe->notifiyPasswordListenerOfAutocomplete(element);
} else {
// Fill the values for the whole form.
- QueryAutoFillFormData(node, unique_id, AUTOFILL_FILL);
+ FillAutoFillFormData(node, unique_id, AUTOFILL_FILL);
}
suggestions_clear_index_ = -1;
@@ -248,6 +250,13 @@ void AutoFillHelper::TextDidChangeInTextField(const WebInputElement& element) {
ShowSuggestions(element, false, true, false);
}
+void AutoFillHelper::KeyDownInTextField(const WebInputElement& element,
+ const WebKeyboardEvent& event) {
+ if (event.windowsKeyCode == app::VKEY_DOWN ||
+ event.windowsKeyCode == app::VKEY_UP)
+ ShowSuggestions(element, true, true, true);
+}
+
bool AutoFillHelper::InputElementClicked(const WebInputElement& element,
bool was_focused,
bool is_focused) {
@@ -286,7 +295,7 @@ void AutoFillHelper::ShowSuggestions(const WebInputElement& element,
QueryAutoFillSuggestions(element, autofill_disabled);
}
-void AutoFillHelper::QueryAutoFillFormData(const WebNode& node,
+void AutoFillHelper::FillAutoFillFormData(const WebNode& node,
int unique_id,
AutoFillAction action) {
static int query_counter = 0;
diff --git a/chrome/renderer/autofill_helper.h b/chrome/renderer/autofill_helper.h
index 13e7ab7..eaf4e0e 100644
--- a/chrome/renderer/autofill_helper.h
+++ b/chrome/renderer/autofill_helper.h
@@ -17,6 +17,7 @@ class RenderView;
namespace WebKit {
class WebInputElement;
+class WebKeyboardEvent;
class WebString;
}
@@ -85,10 +86,11 @@ class AutoFillHelper : public PageClickListener {
// WebViewClient editor call forwarded by the RenderView.
void TextDidChangeInTextField(const WebKit::WebInputElement& element);
- // Called when an input element in the page has been clicked.
- // |already_focused| is true if |element| was focused before it was clicked.
- void InputElementClicked(const WebKit::WebInputElement& element,
- bool already_focused);
+ // WebViewClient editor call forwarded by the RenderView. For lower level
+ // event translation. Specifically, for down/up key presses in an input
+ // element.
+ void KeyDownInTextField(const WebKit::WebInputElement& element,
+ const WebKit::WebKeyboardEvent& event);
private:
enum AutoFillAction {
@@ -122,9 +124,9 @@ class AutoFillHelper : public PageClickListener {
// |value| is the current text in the field, and |unique_id| is the selected
// profile's unique ID. |action| specifies whether to Fill or Preview the
// values returned from the AutoFillManager.
- void QueryAutoFillFormData(const WebKit::WebNode& node,
- int unique_id,
- AutoFillAction action);
+ void FillAutoFillFormData(const WebKit::WebNode& node,
+ int unique_id,
+ AutoFillAction action);
// Scans the given frame for forms and sends them up to the browser.
void SendForms(WebKit::WebFrame* frame);
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 14e74ef..55274b4 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2121,6 +2121,7 @@ void RenderView::textFieldDidReceiveKeyDown(
const WebKit::WebInputElement& element,
const WebKit::WebKeyboardEvent& event) {
password_autocomplete_manager_->TextFieldHandlingKeyDown(element, event);
+ autofill_helper_->KeyDownInTextField(element, event);
}
bool RenderView::handleCurrentKeyboardEvent() {