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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 | 292 |
| 293 DCHECK(driver_->RendererIsAvailable()); | 293 DCHECK(driver_->RendererIsAvailable()); |
| 294 // Fill the values for the whole form. | 294 // Fill the values for the whole form. |
| 295 manager_->FillOrPreviewForm(renderer_action, | 295 manager_->FillOrPreviewForm(renderer_action, |
| 296 query_id_, | 296 query_id_, |
| 297 query_form_, | 297 query_form_, |
| 298 query_field_, | 298 query_field_, |
| 299 unique_id); | 299 unique_id); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void AutofillExternalDelegate::ApplyAutofillWarnings( | 302 void AutofillExternalDelegate::ApplyAutofillWarnings( |
|
Mathieu
2016/11/07 14:32:27
Let's change the name and documentation of this fu
lshang
2016/11/08 06:00:57
Done.
| |
| 303 std::vector<Suggestion>* suggestions) { | 303 std::vector<Suggestion>* suggestions) { |
| 304 if (suggestions->size() > 1 && | 304 while (suggestions->size() > 1 && |
|
Mathieu
2016/11/07 14:32:27
This works as long as POPUP_ITEM_ID_WARNING_MESSAG
lshang
2016/11/08 06:00:57
Done.
| |
| 305 (*suggestions)[0].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE) { | 305 suggestions->front().frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE && |
| 306 // If we received a warning instead of suggestions from Autofill but regular | 306 suggestions->back().frontend_id != POPUP_ITEM_ID_WARNING_MESSAGE) { |
| 307 // suggestions from autocomplete, don't show the Autofill warning. | 307 // If we received warnings instead of suggestions from Autofill but regular |
| 308 // suggestions from autocomplete, don't show the Autofill warnings. | |
| 308 suggestions->erase(suggestions->begin()); | 309 suggestions->erase(suggestions->begin()); |
| 309 } | 310 } |
| 310 } | 311 } |
| 311 | 312 |
| 312 void AutofillExternalDelegate::ApplyAutofillOptions( | 313 void AutofillExternalDelegate::ApplyAutofillOptions( |
| 313 std::vector<Suggestion>* suggestions) { | 314 std::vector<Suggestion>* suggestions) { |
| 314 // The form has been auto-filled, so give the user the chance to clear the | 315 // The form has been auto-filled, so give the user the chance to clear the |
| 315 // form. Append the 'Clear form' menu item. | 316 // form. Append the 'Clear form' menu item. |
| 316 if (query_field_.is_autofilled) { | 317 if (query_field_.is_autofilled) { |
| 317 base::string16 value = | 318 base::string16 value = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 suggestions->insert(suggestions->begin(), data_list_values_.size(), | 368 suggestions->insert(suggestions->begin(), data_list_values_.size(), |
| 368 Suggestion()); | 369 Suggestion()); |
| 369 for (size_t i = 0; i < data_list_values_.size(); i++) { | 370 for (size_t i = 0; i < data_list_values_.size(); i++) { |
| 370 (*suggestions)[i].value = data_list_values_[i]; | 371 (*suggestions)[i].value = data_list_values_[i]; |
| 371 (*suggestions)[i].label = data_list_labels_[i]; | 372 (*suggestions)[i].label = data_list_labels_[i]; |
| 372 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; | 373 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; |
| 373 } | 374 } |
| 374 } | 375 } |
| 375 | 376 |
| 376 } // namespace autofill | 377 } // namespace autofill |
| OLD | NEW |