Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: webkit/glue/password_autocomplete_listener.cc

Issue 11479: New take at implementing autofill using the editor client API (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/glue/password_autocomplete_listener.cc
===================================================================
--- webkit/glue/password_autocomplete_listener.cc (revision 5578)
+++ webkit/glue/password_autocomplete_listener.cc (working copy)
@@ -8,9 +8,39 @@
#include "webkit/glue/password_autocomplete_listener.h"
#undef LOG
#include "base/logging.h"
+#include "webkit/glue/glue_util.h"
namespace webkit_glue {
+HTMLInputDelegate::HTMLInputDelegate(WebCore::HTMLInputElement* element)
+ : element_(element) {
+ // Reference the element for the lifetime of this delegate.
+ // element is NULL when testing.
+ if (element_)
+ element_->ref();
+}
+
+HTMLInputDelegate::~HTMLInputDelegate() {
+ if (element_)
+ element_->deref();
+}
+
+void HTMLInputDelegate::SetValue(const std::wstring& value) {
+ element_->setValue(StdWStringToString(value));
+}
+
+void HTMLInputDelegate::SetSelectionRange(size_t start, size_t end) {
+ element_->setSelectionRange(start, end);
+}
+
+void HTMLInputDelegate::OnFinishedAutocompleting() {
+ // This sets the input element to an autofilled state which will result in it
+ // having a yellow background.
+ element_->setAutofilled(true);
+ // Notify any changeEvent listeners.
+ element_->onChange();
+}
+
PasswordAutocompleteListener::PasswordAutocompleteListener(
HTMLInputDelegate* username_delegate,
HTMLInputDelegate* password_delegate,
« no previous file with comments | « webkit/glue/password_autocomplete_listener.h ('k') | webkit/glue/password_autocomplete_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698