Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2478043002: HTTP Bad: Add warning message to autofill dropdown for http sites (Closed)
Patch Set: nit change Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 client_->IsContextSecure(form_structure->source_url()) && 558 client_->IsContextSecure(form_structure->source_url()) &&
559 (!form_structure->target_url().is_valid() || 559 (!form_structure->target_url().is_valid() ||
560 !form_structure->target_url().SchemeIs("http")); 560 !form_structure->target_url().SchemeIs("http"));
561 if (is_filling_credit_card) 561 if (is_filling_credit_card)
562 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure); 562 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure);
563 563
564 // Don't provide credit card suggestions for non-secure pages, but do 564 // Don't provide credit card suggestions for non-secure pages, but do
565 // provide them for secure pages with passive mixed content (see impl. of 565 // provide them for secure pages with passive mixed content (see impl. of
566 // IsContextSecure). 566 // IsContextSecure).
567 if (is_filling_credit_card && !is_context_secure) { 567 if (is_filling_credit_card && !is_context_secure) {
568 // Replace the suggestion content with a warning message explaining why
569 // Autofill is disabled for a website.
568 Suggestion warning_suggestion(l10n_util::GetStringUTF16( 570 Suggestion warning_suggestion(l10n_util::GetStringUTF16(
569 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); 571 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION));
570 warning_suggestion.frontend_id = POPUP_ITEM_ID_WARNING_MESSAGE; 572 warning_suggestion.frontend_id = POPUP_ITEM_ID_WARNING_MESSAGE;
571 suggestions.assign(1, warning_suggestion); 573 suggestions.assign(1, warning_suggestion);
574
575 // On top of the explanation message, first show a "Payment not secure"
576 // message.
577 if (IsCreditCardAutofillHttpWarningEnabled()) {
578 Suggestion cc_field_http_warning_suggestion(l10n_util::GetStringUTF16(
579 IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE));
580 cc_field_http_warning_suggestion.frontend_id =
581 POPUP_ITEM_ID_WARNING_MESSAGE;
582 suggestions.insert(suggestions.begin(),
583 cc_field_http_warning_suggestion);
584 }
572 } else { 585 } else {
573 bool section_is_autofilled = 586 bool section_is_autofilled =
574 SectionIsAutofilled(*form_structure, form, 587 SectionIsAutofilled(*form_structure, form,
575 autofill_field->section()); 588 autofill_field->section());
576 if (section_is_autofilled) { 589 if (section_is_autofilled) {
577 // If the relevant section is auto-filled and the renderer is querying 590 // If the relevant section is auto-filled and the renderer is querying
578 // for suggestions, then the user is editing the value of a field. 591 // for suggestions, then the user is editing the value of a field.
579 // In this case, mimic autocomplete: don't display labels or icons, 592 // In this case, mimic autocomplete: don't display labels or icons,
580 // as that information is redundant. Moreover, filter out duplicate 593 // as that information is redundant. Moreover, filter out duplicate
581 // suggestions. 594 // suggestions.
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 if (i > 0) 2103 if (i > 0)
2091 fputs("Next oldest form:\n", file); 2104 fputs("Next oldest form:\n", file);
2092 } 2105 }
2093 fputs("\n", file); 2106 fputs("\n", file);
2094 2107
2095 fclose(file); 2108 fclose(file);
2096 } 2109 }
2097 #endif // ENABLE_FORM_DEBUG_DUMP 2110 #endif // ENABLE_FORM_DEBUG_DUMP
2098 2111
2099 } // namespace autofill 2112 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698