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..724651de3f8136dffd6367b6c05c59f8ecd3036d |
--- /dev/null |
+++ b/chrome/browser/autofill/password_autofill_manager.h |
@@ -0,0 +1,83 @@ |
+// 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 render half should be |
Ilya Sherman
2012/03/06 20:32:44
nit: "render" -> "renderer". Also, please annotat
csharp
2012/03/07 15:49:16
Done.
|
+// removed. |
+ |
+#include <map> |
+ |
+#include "webkit/forms/password_form_dom_manager.h" |
+ |
+class TabContentsWrapper; |
+ |
+// This class is responsible for filling password forms. |
+// There is one PasswordAutofillManager per RenderView. |
+class PasswordAutofillManager { |
+ public: |
+ explicit PasswordAutofillManager(TabContentsWrapper* tab_contents_wrapper); |
+ virtual ~PasswordAutofillManager(); |
+ |
+ // If they return true, it indicates the event was consumed and should not |
+ // be used for any other autofill activity. |
+ bool TextFieldHandlingKeyDown(const webkit::forms::FormField& field, |
+ int key_code); |
+ |
+ // 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. |
+ void FillPasswordForm(const webkit::forms::FormField& username_element, |
+ const webkit::forms::PasswordFormFillData& form_data, |
+ int frame_id); |
+ |
+ // Invoked when the passed frame is closing. Gives us a chance to clear any |
+ // reference we may have to elements in that frame. |
+ void FrameClosing(long long frame_id); |
Ilya Sherman
2012/03/06 20:32:44
Why "long long"?
csharp
2012/03/07 15:49:16
WebFrame's unique identifier is a long long.
Ilya Sherman
2012/03/07 22:33:18
In that case, why "int" above?
csharp
2012/03/08 16:48:37
Fixed.
|
+ |
+ private: |
+ struct PasswordInfo { |
+ long long frame_id; |
+ webkit::forms::PasswordFormFillData fill_data; |
+ bool backspace_pressed_last; |
+ PasswordInfo() : backspace_pressed_last(false) {} |
+ }; |
+ typedef std::map<webkit::forms::FormField, PasswordInfo> |
+ LoginToPasswordInfoMap; |
+ |
+ bool WillFillUserNameAndPassword( |
+ const webkit::forms::FormField& username_element, |
+ const webkit::forms::PasswordFormFillData& fill_data); |
+ |
+ // Finds login information for a |node| that was previously filled. |
+ bool FindLoginInfo(const webkit::forms::FormField& field, |
+ webkit::forms::FormField* found_input, |
+ PasswordInfo* found_password); |
+ |
+ // The logins we have filled so far with their associated info. |
+ LoginToPasswordInfoMap login_to_password_info_; |
+ |
+ TabContentsWrapper* tab_contents_wrapper_; // Weak reference. |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); |
+}; |
+ |
+#endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ |