| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // Autofill is disabled for a website. | 569 // Autofill is disabled for a website. |
| 570 Suggestion warning_suggestion(l10n_util::GetStringUTF16( | 570 Suggestion warning_suggestion(l10n_util::GetStringUTF16( |
| 571 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); | 571 IDS_AUTOFILL_WARNING_INSECURE_CONNECTION)); |
| 572 warning_suggestion.frontend_id = | 572 warning_suggestion.frontend_id = |
| 573 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; | 573 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE; |
| 574 suggestions.assign(1, warning_suggestion); | 574 suggestions.assign(1, warning_suggestion); |
| 575 | 575 |
| 576 // On top of the explanation message, first show a "Payment not secure" | 576 // On top of the explanation message, first show a "Payment not secure" |
| 577 // message. | 577 // message. |
| 578 if (IsCreditCardAutofillHttpWarningEnabled()) { | 578 if (IsCreditCardAutofillHttpWarningEnabled()) { |
| 579 Suggestion cc_field_http_warning_suggestion(l10n_util::GetStringUTF16( | 579 Suggestion cc_field_http_warning_suggestion( |
| 580 IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE)); | 580 l10n_util::GetStringUTF8( |
| 581 cc_field_http_warning_suggestion.frontend_id = | 581 IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE), |
| 582 POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE; | 582 l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE), |
| 583 "", POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE); |
| 583 suggestions.insert(suggestions.begin(), | 584 suggestions.insert(suggestions.begin(), |
| 584 cc_field_http_warning_suggestion); | 585 cc_field_http_warning_suggestion); |
| 585 } | 586 } |
| 586 } else { | 587 } else { |
| 587 bool section_is_autofilled = | 588 bool section_is_autofilled = |
| 588 SectionIsAutofilled(*form_structure, form, | 589 SectionIsAutofilled(*form_structure, form, |
| 589 autofill_field->section()); | 590 autofill_field->section()); |
| 590 if (section_is_autofilled) { | 591 if (section_is_autofilled) { |
| 591 // If the relevant section is auto-filled and the renderer is querying | 592 // If the relevant section is auto-filled and the renderer is querying |
| 592 // for suggestions, then the user is editing the value of a field. | 593 // for suggestions, then the user is editing the value of a field. |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 | 1065 |
| 1065 bool AutofillManager::ShouldUploadForm(const FormStructure& form) { | 1066 bool AutofillManager::ShouldUploadForm(const FormStructure& form) { |
| 1066 return IsAutofillEnabled() && !driver_->IsOffTheRecord() && | 1067 return IsAutofillEnabled() && !driver_->IsOffTheRecord() && |
| 1067 form.ShouldBeParsed() && | 1068 form.ShouldBeParsed() && |
| 1068 (form.active_field_count() >= kRequiredFieldsForUpload || | 1069 (form.active_field_count() >= kRequiredFieldsForUpload || |
| 1069 (form.all_fields_are_passwords() && | 1070 (form.all_fields_are_passwords() && |
| 1070 form.active_field_count() >= | 1071 form.active_field_count() >= |
| 1071 kRequiredFieldsForFormsWithOnlyPasswordFields)); | 1072 kRequiredFieldsForFormsWithOnlyPasswordFields)); |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1075 void AutofillManager::OpenUrl(const GURL& url) { |
| 1076 client_->OpenUrl(url); |
| 1077 } |
| 1078 |
| 1074 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 1079 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
| 1075 std::unique_ptr<CreditCard> imported_credit_card; | 1080 std::unique_ptr<CreditCard> imported_credit_card; |
| 1076 if (!personal_data_->ImportFormData( | 1081 if (!personal_data_->ImportFormData( |
| 1077 submitted_form, IsCreditCardUploadEnabled(), &imported_credit_card)) { | 1082 submitted_form, IsCreditCardUploadEnabled(), &imported_credit_card)) { |
| 1078 return; | 1083 return; |
| 1079 } | 1084 } |
| 1080 | 1085 |
| 1081 #ifdef ENABLE_FORM_DEBUG_DUMP | 1086 #ifdef ENABLE_FORM_DEBUG_DUMP |
| 1082 // Debug code for research on what autofill Chrome extracts from the last few | 1087 // Debug code for research on what autofill Chrome extracts from the last few |
| 1083 // forms when submitting credit card data. See DumpAutofillData(). | 1088 // forms when submitting credit card data. See DumpAutofillData(). |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 if (i > 0) | 2109 if (i > 0) |
| 2105 fputs("Next oldest form:\n", file); | 2110 fputs("Next oldest form:\n", file); |
| 2106 } | 2111 } |
| 2107 fputs("\n", file); | 2112 fputs("\n", file); |
| 2108 | 2113 |
| 2109 fclose(file); | 2114 fclose(file); |
| 2110 } | 2115 } |
| 2111 #endif // ENABLE_FORM_DEBUG_DUMP | 2116 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2112 | 2117 |
| 2113 } // namespace autofill | 2118 } // namespace autofill |
| OLD | NEW |