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

Unified Diff: chrome/browser/autofill/password_autofill_manager.h

Issue 9600038: Add Password Autofill Manager to New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months 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: chrome/browser/autofill/password_autofill_manager.h
diff --git a/chrome/browser/autofill/password_autofill_manager.h b/chrome/browser/autofill/password_autofill_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..25bda26d39ea81be487dfda2084d0b7f974ace27
--- /dev/null
+++ b/chrome/browser/autofill/password_autofill_manager.h
@@ -0,0 +1,79 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_
+#define CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_
+#pragma once
+
+// This file was contains some repeated code from
+// chrome/renderer/autofill/password_autofill_manager because as we move to the
+// new Autofill UI we needs these functions in both the browser and renderer.
+// Once the move is completed the repeated code in the renderer half should be
+// removed.
+// http://crbug.com/51644
+
+#include <map>
+
+#include "webkit/forms/password_form_dom_manager.h"
+
+namespace content {
+class RenderViewHost;
+} // namespace content
+
+// This class is responsible for filling password forms.
+class PasswordAutofillManager {
+ public:
+ explicit PasswordAutofillManager(content::RenderViewHost* render_view_host);
+ virtual ~PasswordAutofillManager();
+
+ // If this return true, it indicates the event would be consumed by the
+ // password manager in the renderer, so we shouldn't attempt to handle the
+ // key down, but instead pass it to the renderer.
+ bool WouldHandleKeyDown(const webkit::forms::FormField& field);
Ilya Sherman 2012/03/15 18:27:41 I still don't understand why this method will be n
csharp 2012/03/16 20:21:12 I wanted to keep this method to make sure that the
+
+ // Fills the password associated with user name |value|. Returns true if the
+ // username and password fields were filled, false otherwise.
+ bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field,
+ const string16& value);
+
+ // A no-op. No filling happens for selection. But this method returns
+ // true when |node| is fillable by password Autofill.
+ bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field);
+
+ // A no-op. Password forms are not previewed, so they do not need to be
+ // cleared when the selection changes. However, this method returns
+ // true when |node| is fillable by password Autofill.
+ bool DidClearAutofillSelection(const webkit::forms::FormField& field);
+
+ // Invoked when a password form is filled.
Ilya Sherman 2012/03/15 18:27:41 nit: Please update this comment.
csharp 2012/03/16 20:21:12 Done.
+ void AddPasswordFormMapping(
+ const webkit::forms::FormField& username_element,
+ const webkit::forms::PasswordFormFillData& password);
+
+ // Invoked when to clear any page specific cached values.
Ilya Sherman 2012/03/15 18:27:41 nit: "when to clear" -> "to clear"?
csharp 2012/03/16 20:21:12 Done.
+ void Reset();
+
+ private:
+ typedef std::map<webkit::forms::FormField,
+ webkit::forms::PasswordFormFillData>
+ LoginToPasswordInfoMap;
Ilya Sherman 2012/03/15 18:27:41 If I'm understanding correctly, we could remove th
csharp 2012/03/16 20:21:12 I think you're right. I think there might be 1 tou
Ilya Sherman 2012/03/20 00:58:55 I'd recommend not having the mixed strategy of uni
Ilya Sherman 2012/03/22 01:20:06 Bump.
csharp 2012/03/29 16:28:17 Just using the map now. Had to add the field to on
+
+ bool WillFillUserNameAndPassword(
+ const webkit::forms::FormField& username_element,
+ const webkit::forms::PasswordFormFillData& password);
+
+ // Finds login information for a |node| that was previously filled.
+ bool FindLoginInfo(const webkit::forms::FormField& field,
+ webkit::forms::FormField* found_input,
+ webkit::forms::PasswordFormFillData* found_password);
+
+ // The logins we have filled so far with their associated info.
+ LoginToPasswordInfoMap login_to_password_info_;
+
+ content::RenderViewHost* render_view_host_; // Weak reference.
+
+ DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);
+};
+
+#endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698