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 WebContents; | |
| 22 } // namespace content | |
| 23 | |
| 24 // This class is responsible for filling password forms. | |
| 25 class PasswordAutofillManager { | |
| 26 public: | |
| 27 explicit PasswordAutofillManager(content::WebContents* web_contents); | |
| 28 virtual ~PasswordAutofillManager(); | |
| 29 | |
| 30 // Fills the password associated with user name |value|. Returns true if the | |
| 31 // username and password fields were filled, false otherwise. | |
| 32 bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field, | |
| 33 const string16& value); | |
| 34 | |
| 35 // A no-op. No filling happens for selection. But this method returns | |
| 36 // true when |node| is fillable by password Autofill. | |
| 37 bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field); | |
| 38 | |
| 39 // A no-op. Password forms are not previewed, so they do not need to be | |
| 40 // cleared when the selection changes. However, this method returns | |
| 41 // true when |node| is fillable by password Autofill. | |
| 42 bool DidClearAutofillSelection(const webkit::forms::FormField& field); | |
| 43 | |
| 44 // Invoked when a password mapping is added. | |
| 45 void AddPasswordFormMapping( | |
| 46 const webkit::forms::FormField& username_element, | |
| 47 const webkit::forms::PasswordFormFillData& password); | |
| 48 | |
| 49 // Invoked to clear any page specific cached values. | |
| 50 void Reset(); | |
| 51 | |
| 52 private: | |
| 53 // TODO(csharp): Modify the AutofillExternalDeletegate code so that it can | |
| 54 // figure out if a entry is a password one without using this mapping. | |
| 55 // crbug.com/118601 | |
| 56 typedef std::map<webkit::forms::FormField, | |
| 57 webkit::forms::PasswordFormFillData> | |
| 58 LoginToPasswordInfoMap; | |
| 59 | |
| 60 bool WillFillUserNameAndPassword( | |
|
Ilya Sherman
2012/04/02 22:07:29
nit: Please add a brief comment describing this me
csharp
2012/04/03 12:25:55
Done.
| |
| 61 const string16& current_username, | |
| 62 const webkit::forms::PasswordFormFillData& password); | |
| 63 | |
| 64 // Finds login information for a |node| that was previously filled. | |
| 65 bool FindLoginInfo(const webkit::forms::FormField& field, | |
| 66 webkit::forms::FormField* found_input, | |
| 67 webkit::forms::PasswordFormFillData* found_password); | |
| 68 | |
| 69 // The logins we have filled so far with their associated info. | |
| 70 LoginToPasswordInfoMap login_to_password_info_; | |
| 71 | |
| 72 content::WebContents* web_contents_; // Weak reference. | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | |
| 75 }; | |
| 76 | |
| 77 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
| OLD | NEW |