| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "components/autofill/core/browser/autofill_driver.h" | 6 #include "components/autofill/core/browser/autofill_driver.h" |
| 7 #include "components/autofill/core/browser/password_autofill_manager.h" | 7 #include "components/autofill/core/browser/password_autofill_manager.h" |
| 8 #include "ui/events/keycodes/keyboard_codes.h" | 8 #include "ui/events/keycodes/keyboard_codes.h" |
| 9 | 9 |
| 10 namespace autofill { | 10 namespace autofill { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void PasswordAutofillManager::AddPasswordFormMapping( | 38 void PasswordAutofillManager::AddPasswordFormMapping( |
| 39 const FormFieldData& username_element, | 39 const FormFieldData& username_element, |
| 40 const PasswordFormFillData& password) { | 40 const PasswordFormFillData& password) { |
| 41 login_to_password_info_[username_element] = password; | 41 login_to_password_info_[username_element] = password; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool PasswordAutofillManager::RemovePasswordSuggestion( |
| 45 const FormFieldData& field, |
| 46 const base::string16& username_to_remove) { |
| 47 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); |
| 48 if (iter == login_to_password_info_.end()) |
| 49 return false; |
| 50 login_to_password_info_.erase(iter); |
| 51 |
| 52 autofill_driver_->RemovePasswordAutofillSuggestion(username_to_remove); |
| 53 |
| 54 return true; |
| 55 } |
| 56 |
| 44 void PasswordAutofillManager::Reset() { | 57 void PasswordAutofillManager::Reset() { |
| 45 login_to_password_info_.clear(); | 58 login_to_password_info_.clear(); |
| 46 } | 59 } |
| 47 | 60 |
| 48 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
| 49 // PasswordAutofillManager, private: | 62 // PasswordAutofillManager, private: |
| 50 | 63 |
| 51 bool PasswordAutofillManager::WillFillUserNameAndPassword( | 64 bool PasswordAutofillManager::WillFillUserNameAndPassword( |
| 52 const base::string16& current_username, | 65 const base::string16& current_username, |
| 53 const PasswordFormFillData& fill_data) { | 66 const PasswordFormFillData& fill_data) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 81 PasswordFormFillData* found_password) { | 94 PasswordFormFillData* found_password) { |
| 82 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); | 95 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); |
| 83 if (iter == login_to_password_info_.end()) | 96 if (iter == login_to_password_info_.end()) |
| 84 return false; | 97 return false; |
| 85 | 98 |
| 86 *found_password = iter->second; | 99 *found_password = iter->second; |
| 87 return true; | 100 return true; |
| 88 } | 101 } |
| 89 | 102 |
| 90 } // namespace autofill | 103 } // namespace autofill |
| OLD | NEW |