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 // 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. Password forms are not previewed, so they do not need to be |
| 36 // cleared when the selection changes. However, this method returns |
| 37 // true when |node| is fillable by password Autofill. |
| 38 bool DidClearAutofillSelection(const webkit::forms::FormField& field); |
| 39 |
| 40 // Invoked when a password mapping is added. |
| 41 void AddPasswordFormMapping( |
| 42 const webkit::forms::FormField& username_element, |
| 43 const webkit::forms::PasswordFormFillData& password); |
| 44 |
| 45 // Invoked to clear any page specific cached values. |
| 46 void Reset(); |
| 47 |
| 48 private: |
| 49 // TODO(csharp): Modify the AutofillExternalDeletegate code so that it can |
| 50 // figure out if a entry is a password one without using this mapping. |
| 51 // crbug.com/118601 |
| 52 typedef std::map<webkit::forms::FormField, |
| 53 webkit::forms::PasswordFormFillData> |
| 54 LoginToPasswordInfoMap; |
| 55 |
| 56 bool WillFillUserNameAndPassword( |
| 57 const string16& current_username, |
| 58 const webkit::forms::PasswordFormFillData& password); |
| 59 |
| 60 // Finds login information for a |node| that was previously filled. |
| 61 bool FindLoginInfo(const webkit::forms::FormField& field, |
| 62 webkit::forms::FormField* found_input, |
| 63 webkit::forms::PasswordFormFillData* found_password); |
| 64 |
| 65 // The logins we have filled so far with their associated info. |
| 66 LoginToPasswordInfoMap login_to_password_info_; |
| 67 |
| 68 content::RenderViewHost* render_view_host_; // Weak reference. |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); |
| 71 }; |
| 72 |
| 73 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ |
OLD | NEW |