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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.h

Issue 83023017: Basic autofill into password value on user gesture only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits from gcasto Created 7 years 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: components/autofill/content/renderer/password_autofill_agent.h
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h
index 503621bfda784a66f10f0c755a7f1af015e40b47..72ad5b02f1c932188afa3b97b51ecbbbac607f3b 100644
--- a/components/autofill/content/renderer/password_autofill_agent.h
+++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -9,10 +9,12 @@
#include <vector>
#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/autofill/core/common/password_form_fill_data.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
+#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
namespace blink {
class WebInputElement;
@@ -79,6 +81,26 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
typedef std::map<blink::WebFrame*,
linked_ptr<PasswordForm> > FrameToPasswordFormMap;
+ class AutofillWebUserGestureHandler : public blink::WebUserGestureHandler {
+ public:
+ AutofillWebUserGestureHandler(PasswordAutofillAgent* agent);
+ virtual ~AutofillWebUserGestureHandler();
+
+ void addElement(const blink::WebInputElement& element) {
+ elements_.push_back(element);
+ }
+
+ void clearElements() {
+ elements_.clear();
+ }
+
+ virtual void onGesture();
+
+ private:
+ PasswordAutofillAgent* agent_;
+ std::vector<blink::WebInputElement> elements_;
+ };
+
// RenderViewObserver:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE;
@@ -144,6 +166,10 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
blink::WebFrame* CurrentOrChildFrameWithSavedForms(
const blink::WebFrame* current_frame);
+ void set_user_gesture_occurred(bool occurred) {
+ user_gesture_occurred_ = occurred;
+ }
+
// The logins we have filled so far with their associated info.
LoginToPasswordInfoMap login_to_password_info_;
@@ -157,6 +183,10 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
// but the submit may still fail (i.e. doesn't pass JavaScript validation).
FrameToPasswordFormMap provisionally_saved_forms_;
+ scoped_ptr<AutofillWebUserGestureHandler> gesture_handler_;
+
+ bool user_gesture_occurred_;
+
base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);

Powered by Google App Engine
This is Rietveld 408576698