Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 // This file was contains some repeated code from | |
| 10 // chrome/renderer/autofill/password_autofill_manager because as we move to the | |
| 11 // new Autofill UI we needs these functions in both the browser and renderer. | |
| 12 // Once the move is completed the repeated code in the renderer half should be | |
| 13 // removed. | |
| 14 // http://crbug.com/51644 | |
| 15 | |
| 16 #include <map> | |
| 17 | |
| 18 #include "webkit/forms/password_form_dom_manager.h" | |
| 19 | |
| 20 namespace content { | |
| 21 class RenderViewHost; | |
| 22 } // namespace content | |
| 23 | |
| 24 // This class is responsible for filling password forms. | |
| 25 class PasswordAutofillManager { | |
| 26 public: | |
| 27 explicit PasswordAutofillManager(content::RenderViewHost* render_view_host); | |
| 28 virtual ~PasswordAutofillManager(); | |
| 29 | |
| 30 // If this return true, it indicates the event would be consumed by the | |
| 31 // password manager in the renderer, so we shouldn't attempt to handle the | |
| 32 // key down, but instead pass it to the renderer. | |
| 33 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
| |
| 34 | |
| 35 // Fills the password associated with user name |value|. Returns true if the | |
| 36 // username and password fields were filled, false otherwise. | |
| 37 bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field, | |
| 38 const string16& value); | |
| 39 | |
| 40 // A no-op. No filling happens for selection. But this method returns | |
| 41 // true when |node| is fillable by password Autofill. | |
| 42 bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field); | |
| 43 | |
| 44 // A no-op. Password forms are not previewed, so they do not need to be | |
| 45 // cleared when the selection changes. However, this method returns | |
| 46 // true when |node| is fillable by password Autofill. | |
| 47 bool DidClearAutofillSelection(const webkit::forms::FormField& field); | |
| 48 | |
| 49 // 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.
| |
| 50 void AddPasswordFormMapping( | |
| 51 const webkit::forms::FormField& username_element, | |
| 52 const webkit::forms::PasswordFormFillData& password); | |
| 53 | |
| 54 // 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.
| |
| 55 void Reset(); | |
| 56 | |
| 57 private: | |
| 58 typedef std::map<webkit::forms::FormField, | |
| 59 webkit::forms::PasswordFormFillData> | |
| 60 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
| |
| 61 | |
| 62 bool WillFillUserNameAndPassword( | |
| 63 const webkit::forms::FormField& username_element, | |
| 64 const webkit::forms::PasswordFormFillData& password); | |
| 65 | |
| 66 // Finds login information for a |node| that was previously filled. | |
| 67 bool FindLoginInfo(const webkit::forms::FormField& field, | |
| 68 webkit::forms::FormField* found_input, | |
| 69 webkit::forms::PasswordFormFillData* found_password); | |
| 70 | |
| 71 // The logins we have filled so far with their associated info. | |
| 72 LoginToPasswordInfoMap login_to_password_info_; | |
| 73 | |
| 74 content::RenderViewHost* render_view_host_; // Weak reference. | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
| OLD | NEW |