| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |