| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 for (size_t i = 0; i < suggestions.size(); ++i) { | 101 for (size_t i = 0; i < suggestions.size(); ++i) { |
| 102 if (suggestions[i].frontend_id > 0) { | 102 if (suggestions[i].frontend_id > 0) { |
| 103 has_autofill_suggestions_ = true; | 103 has_autofill_suggestions_ = true; |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 if (has_autofill_suggestions_) | 108 if (has_autofill_suggestions_) |
| 109 ApplyAutofillOptions(&suggestions); | 109 ApplyAutofillOptions(&suggestions); |
| 110 | 110 |
| 111 // Append the credit card signin promo, if appropriate. | 111 // Append the credit card signin promo, if appropriate (there are no other |
| 112 if (should_show_cc_signin_promo_) { | 112 // suggestions). |
| 113 if (suggestions.empty() && should_show_cc_signin_promo_) { |
| 113 // No separator on Android. | 114 // No separator on Android. |
| 114 #if !defined(OS_ANDROID) | 115 #if !defined(OS_ANDROID) |
| 115 // If there are autofill suggestions, the "Autofill options" row was added | 116 // If there are autofill suggestions, the "Autofill options" row was added |
| 116 // above. Add a separator between it and the signin promo. | 117 // above. Add a separator between it and the signin promo. |
| 117 if (has_autofill_suggestions_) { | 118 if (has_autofill_suggestions_) { |
| 118 suggestions.push_back(Suggestion()); | 119 suggestions.push_back(Suggestion()); |
| 119 suggestions.back().frontend_id = POPUP_ITEM_ID_SEPARATOR; | 120 suggestions.back().frontend_id = POPUP_ITEM_ID_SEPARATOR; |
| 120 } | 121 } |
| 121 #endif | 122 #endif |
| 122 | 123 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 suggestions->insert(suggestions->begin(), data_list_values_.size(), | 367 suggestions->insert(suggestions->begin(), data_list_values_.size(), |
| 367 Suggestion()); | 368 Suggestion()); |
| 368 for (size_t i = 0; i < data_list_values_.size(); i++) { | 369 for (size_t i = 0; i < data_list_values_.size(); i++) { |
| 369 (*suggestions)[i].value = data_list_values_[i]; | 370 (*suggestions)[i].value = data_list_values_[i]; |
| 370 (*suggestions)[i].label = data_list_labels_[i]; | 371 (*suggestions)[i].label = data_list_labels_[i]; |
| 371 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; | 372 (*suggestions)[i].frontend_id = POPUP_ITEM_ID_DATALIST_ENTRY; |
| 372 } | 373 } |
| 373 } | 374 } |
| 374 | 375 |
| 375 } // namespace autofill | 376 } // namespace autofill |
| OLD | NEW |