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

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

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow Password autofill suggestions deletion 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 "components/autofill/core/browser/autofill_external_delegate.h" 5 #include "components/autofill/core/browser/autofill_external_delegate.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/autocomplete_history_manager.h" 8 #include "components/autofill/core/browser/autocomplete_history_manager.h"
9 #include "components/autofill/core/browser/autofill_driver.h" 9 #include "components/autofill/core/browser/autofill_driver.h"
10 #include "components/autofill/core/browser/autofill_manager.h" 10 #include "components/autofill/core/browser/autofill_manager.h"
(...skipping 17 matching lines...) Expand all
28 has_shown_autofill_popup_for_current_edit_(false), 28 has_shown_autofill_popup_for_current_edit_(false),
29 weak_ptr_factory_(this) { 29 weak_ptr_factory_(this) {
30 DCHECK(autofill_manager); 30 DCHECK(autofill_manager);
31 } 31 }
32 32
33 AutofillExternalDelegate::~AutofillExternalDelegate() {} 33 AutofillExternalDelegate::~AutofillExternalDelegate() {}
34 34
35 void AutofillExternalDelegate::OnQuery(int query_id, 35 void AutofillExternalDelegate::OnQuery(int query_id,
36 const FormData& form, 36 const FormData& form,
37 const FormFieldData& field, 37 const FormFieldData& field,
38 const PasswordForm& password_form,
38 const gfx::RectF& element_bounds, 39 const gfx::RectF& element_bounds,
39 bool display_warning_if_disabled) { 40 bool display_warning_if_disabled) {
40 autofill_query_form_ = form; 41 autofill_query_form_ = form;
41 autofill_query_field_ = field; 42 autofill_query_field_ = field;
43 //autofill_query_password_form_ = password_form;
vabr (Chromium) 2014/01/29 16:09:36 If you don't need this line, then please remove it
riadh.chtara 2014/02/04 16:22:03 Done.
42 display_warning_if_disabled_ = display_warning_if_disabled; 44 display_warning_if_disabled_ = display_warning_if_disabled;
43 autofill_query_id_ = query_id; 45 autofill_query_id_ = query_id;
44 element_bounds_ = element_bounds; 46 element_bounds_ = element_bounds;
45 } 47 }
46 48
47 void AutofillExternalDelegate::OnSuggestionsReturned( 49 void AutofillExternalDelegate::OnSuggestionsReturned(
48 int query_id, 50 int query_id,
49 const std::vector<base::string16>& autofill_values, 51 const std::vector<base::string16>& autofill_values,
50 const std::vector<base::string16>& autofill_labels, 52 const std::vector<base::string16>& autofill_labels,
51 const std::vector<base::string16>& autofill_icons, 53 const std::vector<base::string16>& autofill_icons,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 icons, 112 icons,
111 ids, 113 ids,
112 GetWeakPtr()); 114 GetWeakPtr());
113 } 115 }
114 } 116 }
115 117
116 void AutofillExternalDelegate::OnShowPasswordSuggestions( 118 void AutofillExternalDelegate::OnShowPasswordSuggestions(
117 const std::vector<base::string16>& suggestions, 119 const std::vector<base::string16>& suggestions,
118 const std::vector<base::string16>& realms, 120 const std::vector<base::string16>& realms,
119 const FormFieldData& field, 121 const FormFieldData& field,
122 const PasswordForm& password_form,
120 const gfx::RectF& element_bounds) { 123 const gfx::RectF& element_bounds) {
121 autofill_query_field_ = field; 124 autofill_query_field_ = field;
125 autofill_query_password_form_ = password_form;
122 element_bounds_ = element_bounds; 126 element_bounds_ = element_bounds;
123 127
124 if (suggestions.empty()) { 128 if (suggestions.empty()) {
125 autofill_manager_->delegate()->HideAutofillPopup(); 129 autofill_manager_->delegate()->HideAutofillPopup();
126 return; 130 return;
127 } 131 }
128 132
129 std::vector<base::string16> empty(suggestions.size()); 133 std::vector<base::string16> empty(suggestions.size());
130 std::vector<int> password_ids(suggestions.size(), 134 std::vector<int> password_ids(suggestions.size(),
131 WebAutofillClient::MenuItemIDPasswordEntry); 135 WebAutofillClient::MenuItemIDPasswordEntry);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 FillAutofillFormData(identifier, false); 197 FillAutofillFormData(identifier, false);
194 } 198 }
195 199
196 autofill_manager_->delegate()->HideAutofillPopup(); 200 autofill_manager_->delegate()->HideAutofillPopup();
197 } 201 }
198 202
199 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, 203 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value,
200 int identifier) { 204 int identifier) {
201 if (identifier > 0) { 205 if (identifier > 0) {
202 autofill_manager_->RemoveAutofillProfileOrCreditCard(identifier); 206 autofill_manager_->RemoveAutofillProfileOrCreditCard(identifier);
207 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) {
208 autofill_query_password_form_.username_value = value;
vabr (Chromium) 2014/01/29 16:09:36 It looks like you mix the |value| with the rest of
riadh.chtara 2014/02/04 16:22:03 This is the line that solved the issue which was:
vabr (Chromium) 2014/02/05 20:34:20 Thanks for explaining the problem (with Jo insetad
209 bool success = password_autofill_manager_.RemovePasswordSuggestion(
210 autofill_query_field_, autofill_query_password_form_);
211 DCHECK(success);
203 } else { 212 } else {
204 autofill_manager_->RemoveAutocompleteEntry(autofill_query_field_.name, 213 autofill_manager_->RemoveAutocompleteEntry(autofill_query_field_.name,
205 value); 214 value);
206 } 215 }
207 } 216 }
208 217
209 void AutofillExternalDelegate::DidEndTextFieldEditing() { 218 void AutofillExternalDelegate::DidEndTextFieldEditing() {
210 autofill_manager_->delegate()->HideAutofillPopup(); 219 autofill_manager_->delegate()->HideAutofillPopup();
211 220
212 has_shown_autofill_popup_for_current_edit_ = false; 221 has_shown_autofill_popup_for_current_edit_ = false;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Set the values that all datalist elements share. 358 // Set the values that all datalist elements share.
350 autofill_icons->insert(autofill_icons->begin(), 359 autofill_icons->insert(autofill_icons->begin(),
351 data_list_values_.size(), 360 data_list_values_.size(),
352 base::string16()); 361 base::string16());
353 autofill_unique_ids->insert(autofill_unique_ids->begin(), 362 autofill_unique_ids->insert(autofill_unique_ids->begin(),
354 data_list_values_.size(), 363 data_list_values_.size(),
355 WebAutofillClient::MenuItemIDDataListEntry); 364 WebAutofillClient::MenuItemIDDataListEntry);
356 } 365 }
357 366
358 } // namespace autofill 367 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698