| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/autofill/password_autofill_manager.h" | 5 #include "chrome/browser/autofill/password_autofill_manager.h" |
| 6 #include "chrome/common/autofill_messages.h" | 6 #include "chrome/common/autofill_messages.h" |
| 7 #include "content/public/browser/render_view_host.h" | 7 #include "content/public/browser/render_view_host.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 render_view_host->Send(new AutofillMsg_AcceptPasswordAutofillSuggestion( | 32 render_view_host->Send(new AutofillMsg_AcceptPasswordAutofillSuggestion( |
| 33 render_view_host->GetRoutingID(), | 33 render_view_host->GetRoutingID(), |
| 34 value)); | 34 value)); |
| 35 } | 35 } |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool PasswordAutofillManager::DidSelectAutofillSuggestion( | |
| 43 const webkit::forms::FormField& field) { | |
| 44 webkit::forms::FormField input; | |
| 45 webkit::forms::PasswordFormFillData password; | |
| 46 return FindLoginInfo(field, &password); | |
| 47 } | |
| 48 | |
| 49 bool PasswordAutofillManager::DidClearAutofillSelection( | |
| 50 const webkit::forms::FormField& field) { | |
| 51 webkit::forms::FormField input; | |
| 52 webkit::forms::PasswordFormFillData password; | |
| 53 return FindLoginInfo(field, &password); | |
| 54 } | |
| 55 | |
| 56 void PasswordAutofillManager::AddPasswordFormMapping( | 42 void PasswordAutofillManager::AddPasswordFormMapping( |
| 57 const webkit::forms::FormField& username_element, | 43 const webkit::forms::FormField& username_element, |
| 58 const webkit::forms::PasswordFormFillData& password) { | 44 const webkit::forms::PasswordFormFillData& password) { |
| 59 login_to_password_info_[username_element] = password; | 45 login_to_password_info_[username_element] = password; |
| 60 } | 46 } |
| 61 | 47 |
| 62 void PasswordAutofillManager::Reset() { | 48 void PasswordAutofillManager::Reset() { |
| 63 login_to_password_info_.clear(); | 49 login_to_password_info_.clear(); |
| 64 } | 50 } |
| 65 | 51 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 88 bool PasswordAutofillManager::FindLoginInfo( | 74 bool PasswordAutofillManager::FindLoginInfo( |
| 89 const webkit::forms::FormField& field, | 75 const webkit::forms::FormField& field, |
| 90 webkit::forms::PasswordFormFillData* found_password) { | 76 webkit::forms::PasswordFormFillData* found_password) { |
| 91 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); | 77 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); |
| 92 if (iter == login_to_password_info_.end()) | 78 if (iter == login_to_password_info_.end()) |
| 93 return false; | 79 return false; |
| 94 | 80 |
| 95 *found_password = iter->second; | 81 *found_password = iter->second; |
| 96 return true; | 82 return true; |
| 97 } | 83 } |
| OLD | NEW |