Chromium Code Reviews| Index: components/autofill/core/browser/autofill_manager.cc |
| diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc |
| index d7e7cfcf3e2bb6bb3f98cf20f8441a302e74f6fc..5fb716eceef5ff7dc06a8a7e5c6b0055de1b4e38 100644 |
| --- a/components/autofill/core/browser/autofill_manager.cc |
| +++ b/components/autofill/core/browser/autofill_manager.cc |
| @@ -183,6 +183,28 @@ bool IsCreditCardExpirationType(ServerFieldType type) { |
| type == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; |
| } |
| +// Create http bad warning message at the top of autofill popup list showing |
| +// "Payment not secure" when users are on http sites or broken https sites. |
| +Suggestion CreateHttpWarningMessageSuggestionItem(const GURL& source_url) { |
| + std::string icon_str; |
| + |
| + // Show http warning icon for http sites. |
| + if (source_url.is_valid() && source_url.SchemeIs("http")) { |
| + icon_str = "httpWarning"; |
| + } else { |
| + // Show https_invalid icon for broken https sites. |
| + icon_str = "httpsInvalid"; |
| + } |
| + |
| + Suggestion cc_field_http_warning_suggestion( |
| + l10n_util::GetStringUTF16(IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE)); |
| + cc_field_http_warning_suggestion.frontend_id = |
| + POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; |
| + cc_field_http_warning_suggestion.icon = base::UTF8ToUTF16(icon_str); |
|
Evan Stade
2016/11/29 15:23:32
nit: I would rearrange this so that you don't need
lshang
2016/11/29 23:48:30
Done.
|
| + |
| + return cc_field_http_warning_suggestion; |
| +} |
| + |
| } // namespace |
| AutofillManager::AutofillManager( |
| @@ -576,12 +598,9 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, |
| // On top of the explanation message, first show a "Payment not secure" |
| // message. |
| if (IsCreditCardAutofillHttpWarningEnabled()) { |
| - Suggestion cc_field_http_warning_suggestion(l10n_util::GetStringUTF16( |
| - IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE)); |
| - cc_field_http_warning_suggestion.frontend_id = |
| - POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; |
| suggestions.insert(suggestions.begin(), |
| - cc_field_http_warning_suggestion); |
| + CreateHttpWarningMessageSuggestionItem( |
| + form_structure->source_url())); |
| } |
| } else { |
| bool section_is_autofilled = |