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

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: Comments addressed 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/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
44 void PasswordAutofillManager::Reset() { 45 bool PasswordAutofillManager::RemovePasswordSuggestion(
45 login_to_password_info_.clear(); 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 Send(new AutofillHostMsg_RemovePasswordSuggestion(routing_id(),
54 *password_form));
55 return true;
46 } 56 }
47 57
58 void PasswordAutofillManager::Reset() { login_to_password_info_.clear(); }
vabr (Chromium) 2014/01/14 15:01:21 nit: This might be because of the automatic format
riadh.chtara 2014/01/17 08:25:08 Yes you're right, it's git cl format who have done
59
48 //////////////////////////////////////////////////////////////////////////////// 60 ////////////////////////////////////////////////////////////////////////////////
49 // PasswordAutofillManager, private: 61 // PasswordAutofillManager, private:
50 62
51 bool PasswordAutofillManager::WillFillUserNameAndPassword( 63 bool PasswordAutofillManager::WillFillUserNameAndPassword(
52 const base::string16& current_username, 64 const base::string16& current_username,
53 const PasswordFormFillData& fill_data) { 65 const PasswordFormFillData& fill_data) {
54 // Look for any suitable matches to current field text. 66 // Look for any suitable matches to current field text.
55 if (fill_data.basic_data.fields[0].value == current_username) 67 if (fill_data.basic_data.fields[0].value == current_username)
56 return true; 68 return true;
57 69
(...skipping 23 matching lines...) Expand all
81 PasswordFormFillData* found_password) { 93 PasswordFormFillData* found_password) {
82 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); 94 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
83 if (iter == login_to_password_info_.end()) 95 if (iter == login_to_password_info_.end())
84 return false; 96 return false;
85 97
86 *found_password = iter->second; 98 *found_password = iter->second;
87 return true; 99 return true;
88 } 100 }
89 101
90 } // namespace autofill 102 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698