Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: components/autofill/core/browser/password_autofill_manager.cc

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deletion is working Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/autofill/core/common/autofill_messages.h"
8 #include "ui/events/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
9 10
10 namespace autofill { 11 namespace autofill {
11 12
12 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
13 // PasswordAutofillManager, public: 14 // PasswordAutofillManager, public:
14 15
15 PasswordAutofillManager::PasswordAutofillManager( 16 PasswordAutofillManager::PasswordAutofillManager(
16 AutofillDriver* autofill_driver) : autofill_driver_(autofill_driver) { 17 AutofillDriver* autofill_driver) : autofill_driver_(autofill_driver) {
17 DCHECK(autofill_driver); 18 DCHECK(autofill_driver);
(...skipping 16 matching lines...) Expand all
34 35
35 return false; 36 return false;
36 } 37 }
37 38
38 void PasswordAutofillManager::AddPasswordFormMapping( 39 void PasswordAutofillManager::AddPasswordFormMapping(
39 const FormFieldData& username_element, 40 const FormFieldData& username_element,
40 const PasswordFormFillData& password) { 41 const PasswordFormFillData& password) {
41 login_to_password_info_[username_element] = password; 42 login_to_password_info_[username_element] = password;
42 } 43 }
43 44
45 bool PasswordAutofillManager::RemovePasswordSuggestion(
46 const FormFieldData& field,
47 const PasswordForm& password_form) {
48 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
49 if (iter == login_to_password_info_.end())
50 return false;
51 login_to_password_info_.erase(iter);
52
53 autofill_driver_->RemovePasswordAutofillSuggestion(password_form);
54
55 return true;
56 }
57
44 void PasswordAutofillManager::Reset() { 58 void PasswordAutofillManager::Reset() {
45 login_to_password_info_.clear(); 59 login_to_password_info_.clear();
46 } 60 }
47 61
48 //////////////////////////////////////////////////////////////////////////////// 62 ////////////////////////////////////////////////////////////////////////////////
49 // PasswordAutofillManager, private: 63 // PasswordAutofillManager, private:
50 64
51 bool PasswordAutofillManager::WillFillUserNameAndPassword( 65 bool PasswordAutofillManager::WillFillUserNameAndPassword(
52 const base::string16& current_username, 66 const base::string16& current_username,
53 const PasswordFormFillData& fill_data) { 67 const PasswordFormFillData& fill_data) {
(...skipping 27 matching lines...) Expand all
81 PasswordFormFillData* found_password) { 95 PasswordFormFillData* found_password) {
82 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); 96 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
83 if (iter == login_to_password_info_.end()) 97 if (iter == login_to_password_info_.end())
84 return false; 98 return false;
85 99
86 *found_password = iter->second; 100 *found_password = iter->second;
87 return true; 101 return true;
88 } 102 }
89 103
90 } // namespace autofill 104 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698