summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/password_autocomplete_manager.cc
diff options
context:
space:
mode:
authorjcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 00:50:30 +0000
committerjcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 00:50:30 +0000
commite47aec55e850707ca01222868e9a19221e3f6a05 (patch)
tree4825b777cbf3c477946be4ee26b4a37477879993 /chrome/renderer/password_autocomplete_manager.cc
parent4fe6eb51d56596233faf35a4d395673311d48809 (diff)
downloadchromium_src-e47aec55e850707ca01222868e9a19221e3f6a05.zip
chromium_src-e47aec55e850707ca01222868e9a19221e3f6a05.tar.gz
chromium_src-e47aec55e850707ca01222868e9a19221e3f6a05.tar.bz2
Moving the autofill code from WebKit EditorClientImpl to Chromium.
This is still behind an #ifdef at this point. BUG=None TEST=None Review URL: http://codereview.chromium.org/3060010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/password_autocomplete_manager.cc')
-rw-r--r--chrome/renderer/password_autocomplete_manager.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/chrome/renderer/password_autocomplete_manager.cc b/chrome/renderer/password_autocomplete_manager.cc
index 4f83cd7..b74d357 100644
--- a/chrome/renderer/password_autocomplete_manager.cc
+++ b/chrome/renderer/password_autocomplete_manager.cc
@@ -221,38 +221,35 @@ void PasswordAutocompleteManager::FrameClosing(const WebKit::WebFrame* frame) {
}
}
-void PasswordAutocompleteManager::TextFieldDidBeginEditing(
- const WebKit::WebInputElement& element) {
-}
-
-void PasswordAutocompleteManager::TextFieldDidEndEditing(
+bool PasswordAutocompleteManager::TextFieldDidEndEditing(
const WebKit::WebInputElement& element) {
LoginToPasswordInfoMap::const_iterator iter =
login_to_password_info_.find(element);
if (iter == login_to_password_info_.end())
- return;
+ return false;
const webkit_glue::PasswordFormFillData& fill_data =
iter->second.fill_data;
// If wait_for_username is false, we should have filled when the text changed.
if (!fill_data.wait_for_username)
- return;
+ return false;
WebKit::WebInputElement password = iter->second.password_field;
if (!IsElementEditable(password))
- return;
+ return false;
WebKit::WebInputElement username = element; // We need a non-const.
FillUserNameAndPassword(&username, &password, fill_data, true);
+ return true;
}
-void PasswordAutocompleteManager::TextDidChangeInTextField(
+bool PasswordAutocompleteManager::TextDidChangeInTextField(
const WebKit::WebInputElement& element) {
LoginToPasswordInfoMap::const_iterator iter =
login_to_password_info_.find(element);
if (iter == login_to_password_info_.end())
- return;
+ return false;
// The input text is being changed, so any autocompleted password is now
// outdated.
@@ -266,25 +263,25 @@ void PasswordAutocompleteManager::TextDidChangeInTextField(
// If wait_for_username is true we will fill when the username loses focus.
if (iter->second.fill_data.wait_for_username)
- return;
+ return false;
if (!element.isEnabledFormControl() ||
element.inputType() != WebKit::WebInputElement::Text ||
!element.autoComplete() || element.isReadOnly()) {
- return;
+ return false;
}
// Don't inline autocomplete if the user is deleting, that would be confusing.
if (iter->second.backspace_pressed_last)
- return;
+ return false;
WebKit::WebString name = element.nameForAutofill();
if (name.isEmpty())
- return; // If the field has no name, then we won't have values.
+ return false; // If the field has no name, then we won't have values.
// Don't attempt to autocomplete with values that are too large.
if (element.value().length() > kMaximumTextSizeForAutocomplete)
- return;
+ return false;
// We post a task for doing the autocomplete as the caret position is not set
// properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and
@@ -292,6 +289,7 @@ void PasswordAutocompleteManager::TextDidChangeInTextField(
MessageLoop::current()->PostTask(FROM_HERE, method_factory_.NewRunnableMethod(
&PasswordAutocompleteManager::PerformInlineAutocomplete,
element, password, iter->second.fill_data));
+ return true;
}
void PasswordAutocompleteManager::TextFieldHandlingKeyDown(
@@ -307,6 +305,11 @@ void PasswordAutocompleteManager::TextFieldHandlingKeyDown(
(win_key_code == base::VKEY_BACK || win_key_code == base::VKEY_DELETE);
}
+bool PasswordAutocompleteManager::InputElementClicked(
+ const WebKit::WebInputElement& element, bool already_focused) {
+ return false;
+}
+
bool PasswordAutocompleteManager::FillPassword(
const WebKit::WebInputElement& user_input) {
LoginToPasswordInfoMap::iterator iter =