| 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_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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 client_->IsContextSecure(form_structure->source_url()) && | 576 client_->IsContextSecure(form_structure->source_url()) && |
| 577 (!form_structure->target_url().is_valid() || | 577 (!form_structure->target_url().is_valid() || |
| 578 !form_structure->target_url().SchemeIs("http")); | 578 !form_structure->target_url().SchemeIs("http")); |
| 579 if (is_filling_credit_card) | 579 if (is_filling_credit_card) |
| 580 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure); | 580 AutofillMetrics::LogIsQueriedCreditCardFormSecure(is_context_secure); |
| 581 | 581 |
| 582 // Don't provide credit card suggestions for non-secure pages, but do | 582 // Don't provide credit card suggestions for non-secure pages, but do |
| 583 // provide them for secure pages with passive mixed content (see impl. of | 583 // provide them for secure pages with passive mixed content (see impl. of |
| 584 // IsContextSecure). | 584 // IsContextSecure). |
| 585 if (is_filling_credit_card && !is_context_secure) { | 585 if (is_filling_credit_card && !is_context_secure) { |
| 586 bool is_http_warning_enabled = IsCreditCardAutofillHttpWarningEnabled(); |
| 586 // Replace the suggestion content with a warning message explaining why | 587 // Replace the suggestion content with a warning message explaining why |
| 587 // Autofill is disabled for a website. | 588 // Autofill is disabled for a website. The string is different if the |
| 589 // credit card autofill HTTP warning experiment is enabled. |
| 588 Suggestion warning_suggestion(l10n_util::GetStringUTF16( | 590 Suggestion warning_suggestion(l10n_util::GetStringUTF16( |
| 589 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); | 591 is_http_warning_enabled |
| 592 ? IDS_AUTOFILL_WARNING_PAYMENT_DISABLED |
| 593 : IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); |
| 590 warning_suggestion.frontend_id = | 594 warning_suggestion.frontend_id = |
| 591 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; | 595 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; |
| 592 suggestions.assign(1, warning_suggestion); | 596 suggestions.assign(1, warning_suggestion); |
| 593 | 597 |
| 594 // On top of the explanation message, first show a "Payment not secure" | 598 // On top of the explanation message, first show a "Payment not secure" |
| 595 // message. | 599 // message. |
| 596 if (IsCreditCardAutofillHttpWarningEnabled()) { | 600 if (is_http_warning_enabled) { |
| 597 #if !defined(OS_ANDROID) | 601 #if !defined(OS_ANDROID) |
| 598 suggestions.insert(suggestions.begin(), Suggestion()); | 602 suggestions.insert(suggestions.begin(), Suggestion()); |
| 599 suggestions.front().frontend_id = POPUP_ITEM_ID_SEPARATOR; | 603 suggestions.front().frontend_id = POPUP_ITEM_ID_SEPARATOR; |
| 600 #endif | 604 #endif |
| 601 suggestions.insert(suggestions.begin(), | 605 suggestions.insert(suggestions.begin(), |
| 602 CreateHttpWarningMessageSuggestionItem( | 606 CreateHttpWarningMessageSuggestionItem( |
| 603 form_structure->source_url())); | 607 form_structure->source_url())); |
| 604 } | 608 } |
| 605 } else { | 609 } else { |
| 606 bool section_is_autofilled = | 610 bool section_is_autofilled = |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 if (i > 0) | 2128 if (i > 0) |
| 2125 fputs("Next oldest form:\n", file); | 2129 fputs("Next oldest form:\n", file); |
| 2126 } | 2130 } |
| 2127 fputs("\n", file); | 2131 fputs("\n", file); |
| 2128 | 2132 |
| 2129 fclose(file); | 2133 fclose(file); |
| 2130 } | 2134 } |
| 2131 #endif // ENABLE_FORM_DEBUG_DUMP | 2135 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2132 | 2136 |
| 2133 } // namespace autofill | 2137 } // namespace autofill |
| OLD | NEW |