Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 icons, | 108 icons, |
| 109 ids, | 109 ids, |
| 110 GetWeakPtr()); | 110 GetWeakPtr()); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void AutofillExternalDelegate::OnShowPasswordSuggestions( | 114 void AutofillExternalDelegate::OnShowPasswordSuggestions( |
| 115 const std::vector<base::string16>& suggestions, | 115 const std::vector<base::string16>& suggestions, |
| 116 const std::vector<base::string16>& realms, | 116 const std::vector<base::string16>& realms, |
| 117 const FormFieldData& field, | 117 const FormFieldData& field, |
| 118 const PasswordForm& password_form, | |
| 118 const gfx::RectF& element_bounds) { | 119 const gfx::RectF& element_bounds) { |
| 119 query_field_ = field; | 120 query_field_ = field; |
| 121 query_password_form_ = password_form; | |
| 120 element_bounds_ = element_bounds; | 122 element_bounds_ = element_bounds; |
| 121 | 123 |
| 122 if (suggestions.empty()) { | 124 if (suggestions.empty()) { |
| 123 manager_->delegate()->HideAutofillPopup(); | 125 manager_->delegate()->HideAutofillPopup(); |
| 124 return; | 126 return; |
| 125 } | 127 } |
| 126 | 128 |
| 127 std::vector<base::string16> empty(suggestions.size()); | 129 std::vector<base::string16> empty(suggestions.size()); |
| 128 std::vector<int> password_ids(suggestions.size(), | 130 std::vector<int> password_ids(suggestions.size(), |
| 129 POPUP_ITEM_ID_PASSWORD_ENTRY); | 131 POPUP_ITEM_ID_PASSWORD_ENTRY); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 driver_->RendererShouldSetNodeText(value); | 191 driver_->RendererShouldSetNodeText(value); |
| 190 } else { | 192 } else { |
| 191 FillAutofillFormData(identifier, false); | 193 FillAutofillFormData(identifier, false); |
| 192 } | 194 } |
| 193 | 195 |
| 194 manager_->delegate()->HideAutofillPopup(); | 196 manager_->delegate()->HideAutofillPopup(); |
| 195 } | 197 } |
| 196 | 198 |
| 197 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, | 199 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, |
| 198 int identifier) { | 200 int identifier) { |
| 199 if (identifier > 0) | 201 if (identifier > 0) { |
| 200 manager_->RemoveAutofillProfileOrCreditCard(identifier); | 202 manager_->RemoveAutofillProfileOrCreditCard(identifier); |
| 201 else | 203 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) { |
| 202 manager_->RemoveAutocompleteEntry(query_field_.name, value); | 204 query_password_form_.username_value = value; |
| 205 bool success = password_manager_.RemovePasswordSuggestion( | |
| 206 query_field_, query_password_form_); | |
| 207 DCHECK(success); | |
| 208 } else { | |
| 209 manager_->RemoveAutocompleteEntry(query_field_.name, | |
| 210 value); | |
|
vabr (Chromium)
2014/04/01 16:56:08
wrong indent
rchtara
2014/04/03 08:44:50
Done.
| |
| 211 } | |
| 203 } | 212 } |
| 204 | 213 |
| 205 void AutofillExternalDelegate::DidEndTextFieldEditing() { | 214 void AutofillExternalDelegate::DidEndTextFieldEditing() { |
| 206 manager_->delegate()->HideAutofillPopup(); | 215 manager_->delegate()->HideAutofillPopup(); |
| 207 | 216 |
| 208 has_shown_popup_for_current_edit_ = false; | 217 has_shown_popup_for_current_edit_ = false; |
| 209 } | 218 } |
| 210 | 219 |
| 211 void AutofillExternalDelegate::ClearPreviewedForm() { | 220 void AutofillExternalDelegate::ClearPreviewedForm() { |
| 212 driver_->RendererShouldClearPreviewedForm(); | 221 driver_->RendererShouldClearPreviewedForm(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 // Set the values that all datalist elements share. | 349 // Set the values that all datalist elements share. |
| 341 icons->insert(icons->begin(), | 350 icons->insert(icons->begin(), |
| 342 data_list_values_.size(), | 351 data_list_values_.size(), |
| 343 base::string16()); | 352 base::string16()); |
| 344 unique_ids->insert(unique_ids->begin(), | 353 unique_ids->insert(unique_ids->begin(), |
| 345 data_list_values_.size(), | 354 data_list_values_.size(), |
| 346 POPUP_ITEM_ID_DATALIST_ENTRY); | 355 POPUP_ITEM_ID_DATALIST_ENTRY); |
| 347 } | 356 } |
| 348 | 357 |
| 349 } // namespace autofill | 358 } // namespace autofill |
| OLD | NEW |