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

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: 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 "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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 icons, 110 icons,
111 ids, 111 ids,
112 GetWeakPtr()); 112 GetWeakPtr());
113 } 113 }
114 } 114 }
115 115
116 void AutofillExternalDelegate::OnShowPasswordSuggestions( 116 void AutofillExternalDelegate::OnShowPasswordSuggestions(
117 const std::vector<base::string16>& suggestions, 117 const std::vector<base::string16>& suggestions,
118 const std::vector<base::string16>& realms, 118 const std::vector<base::string16>& realms,
119 const FormFieldData& field, 119 const FormFieldData& field,
120 const PasswordForm& password_form,
120 const gfx::RectF& element_bounds) { 121 const gfx::RectF& element_bounds) {
121 autofill_query_field_ = field; 122 autofill_query_field_ = field;
123 autofill_query_password_form_ = password_form;
122 element_bounds_ = element_bounds; 124 element_bounds_ = element_bounds;
123 125
124 if (suggestions.empty()) { 126 if (suggestions.empty()) {
125 autofill_manager_->delegate()->HideAutofillPopup(); 127 autofill_manager_->delegate()->HideAutofillPopup();
126 return; 128 return;
127 } 129 }
128 130
129 std::vector<base::string16> empty(suggestions.size()); 131 std::vector<base::string16> empty(suggestions.size());
130 std::vector<int> password_ids(suggestions.size(), 132 std::vector<int> password_ids(suggestions.size(),
131 WebAutofillClient::MenuItemIDPasswordEntry); 133 WebAutofillClient::MenuItemIDPasswordEntry);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 FillAutofillFormData(identifier, false); 195 FillAutofillFormData(identifier, false);
194 } 196 }
195 197
196 autofill_manager_->delegate()->HideAutofillPopup(); 198 autofill_manager_->delegate()->HideAutofillPopup();
197 } 199 }
198 200
199 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, 201 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value,
200 int identifier) { 202 int identifier) {
201 if (identifier > 0) { 203 if (identifier > 0) {
202 autofill_manager_->RemoveAutofillProfileOrCreditCard(identifier); 204 autofill_manager_->RemoveAutofillProfileOrCreditCard(identifier);
205 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) {
206 autofill_query_password_form_.username_value = value;
207 bool success = password_autofill_manager_.RemovePasswordSuggestion(
208 autofill_query_field_, autofill_query_password_form_);
209 DCHECK(success);
203 } else { 210 } else {
204 autofill_manager_->RemoveAutocompleteEntry(autofill_query_field_.name, 211 autofill_manager_->RemoveAutocompleteEntry(autofill_query_field_.name,
205 value); 212 value);
206 } 213 }
207 } 214 }
208 215
209 void AutofillExternalDelegate::DidEndTextFieldEditing() { 216 void AutofillExternalDelegate::DidEndTextFieldEditing() {
210 autofill_manager_->delegate()->HideAutofillPopup(); 217 autofill_manager_->delegate()->HideAutofillPopup();
211 218
212 has_shown_autofill_popup_for_current_edit_ = false; 219 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. 356 // Set the values that all datalist elements share.
350 autofill_icons->insert(autofill_icons->begin(), 357 autofill_icons->insert(autofill_icons->begin(),
351 data_list_values_.size(), 358 data_list_values_.size(),
352 base::string16()); 359 base::string16());
353 autofill_unique_ids->insert(autofill_unique_ids->begin(), 360 autofill_unique_ids->insert(autofill_unique_ids->begin(),
354 data_list_values_.size(), 361 data_list_values_.size(),
355 WebAutofillClient::MenuItemIDDataListEntry); 362 WebAutofillClient::MenuItemIDDataListEntry);
356 } 363 }
357 364
358 } // namespace autofill 365 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698