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

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: Created 6 years, 11 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/content/renderer/password_form_conversion_utils.h"
7 #include "components/autofill/core/common/autofill_messages.h"
6 #include "components/autofill/core/browser/autofill_driver.h" 8 #include "components/autofill/core/browser/autofill_driver.h"
7 #include "components/autofill/core/browser/password_autofill_manager.h" 9 #include "components/autofill/core/browser/password_autofill_manager.h"
10 #include "third_party/WebKit/public/web/WebFormElement.h"
8 #include "ui/events/keycodes/keyboard_codes.h" 11 #include "ui/events/keycodes/keyboard_codes.h"
9 12
10 namespace autofill { 13 namespace autofill {
11 14
12 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
13 // PasswordAutofillManager, public: 16 // PasswordAutofillManager, public:
14 17
15 PasswordAutofillManager::PasswordAutofillManager( 18 PasswordAutofillManager::PasswordAutofillManager(
16 AutofillDriver* autofill_driver) : autofill_driver_(autofill_driver) { 19 AutofillDriver* autofill_driver) : autofill_driver_(autofill_driver) {
17 DCHECK(autofill_driver); 20 DCHECK(autofill_driver);
(...skipping 16 matching lines...) Expand all
34 37
35 return false; 38 return false;
36 } 39 }
37 40
38 void PasswordAutofillManager::AddPasswordFormMapping( 41 void PasswordAutofillManager::AddPasswordFormMapping(
39 const FormFieldData& username_element, 42 const FormFieldData& username_element,
40 const PasswordFormFillData& password) { 43 const PasswordFormFillData& password) {
41 login_to_password_info_[username_element] = password; 44 login_to_password_info_[username_element] = password;
42 } 45 }
43 46
47 bool PasswordAutofillManager::RemovePasswordSuggestion(
48 const FormFieldData& field,
49 const blink::WebFormElement& form) {
50 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
51 if (iter == login_to_password_info_.end())
52 return false;
53 login_to_password_info_.erase(iter);
54
55 scoped_ptr<PasswordForm> password_form = CreatePasswordForm(form);
56 Send(new AutofillHostMsg_RemovePasswordSuggestion(
57 routing_id(),
58 form));
59 return true;
60 }
61
44 void PasswordAutofillManager::Reset() { 62 void PasswordAutofillManager::Reset() {
45 login_to_password_info_.clear(); 63 login_to_password_info_.clear();
46 } 64 }
47 65
48 //////////////////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////////////////
49 // PasswordAutofillManager, private: 67 // PasswordAutofillManager, private:
50 68
51 bool PasswordAutofillManager::WillFillUserNameAndPassword( 69 bool PasswordAutofillManager::WillFillUserNameAndPassword(
52 const base::string16& current_username, 70 const base::string16& current_username,
53 const PasswordFormFillData& fill_data) { 71 const PasswordFormFillData& fill_data) {
(...skipping 27 matching lines...) Expand all
81 PasswordFormFillData* found_password) { 99 PasswordFormFillData* found_password) {
82 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); 100 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
83 if (iter == login_to_password_info_.end()) 101 if (iter == login_to_password_info_.end())
84 return false; 102 return false;
85 103
86 *found_password = iter->second; 104 *found_password = iter->second;
87 return true; 105 return true;
88 } 106 }
89 107
90 } // namespace autofill 108 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698