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> |
11 #include <limits> | 11 #include <limits> |
12 #include <map> | 12 #include <map> |
13 #include <set> | 13 #include <set> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/containers/adapters.h" | 18 #include "base/containers/adapters.h" |
19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
20 #include "base/guid.h" | 20 #include "base/guid.h" |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
23 #include "base/metrics/field_trial.h" | 23 #include "base/metrics/field_trial.h" |
24 #include "base/metrics/histogram_macros.h" | 24 #include "base/metrics/histogram_macros.h" |
25 #include "base/path_service.h" | 25 #include "base/path_service.h" |
26 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
| 27 #include "base/strings/string_number_conversions.h" |
27 #include "base/strings/string_split.h" | 28 #include "base/strings/string_split.h" |
28 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
30 #include "base/threading/sequenced_worker_pool.h" | 31 #include "base/threading/sequenced_worker_pool.h" |
31 #include "base/threading/thread_restrictions.h" | 32 #include "base/threading/thread_restrictions.h" |
32 #include "build/build_config.h" | 33 #include "build/build_config.h" |
33 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 34 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
34 #include "components/autofill/core/browser/autofill_client.h" | 35 #include "components/autofill/core/browser/autofill_client.h" |
35 #include "components/autofill/core/browser/autofill_data_model.h" | 36 #include "components/autofill/core/browser/autofill_data_model.h" |
36 #include "components/autofill/core/browser/autofill_experiments.h" | 37 #include "components/autofill/core/browser/autofill_experiments.h" |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 // Whereas, because we pass IsCreditCardUploadEnabled() to ImportFormData, | 1068 // Whereas, because we pass IsCreditCardUploadEnabled() to ImportFormData, |
1068 // this block can be reached on observing either a new card or one already | 1069 // this block can be reached on observing either a new card or one already |
1069 // stored locally. We will offer to upload either kind. | 1070 // stored locally. We will offer to upload either kind. |
1070 upload_request_ = payments::PaymentsClient::UploadRequestDetails(); | 1071 upload_request_ = payments::PaymentsClient::UploadRequestDetails(); |
1071 upload_request_.card = *imported_credit_card; | 1072 upload_request_.card = *imported_credit_card; |
1072 | 1073 |
1073 // Check for a CVC to determine whether we can prompt the user to upload | 1074 // Check for a CVC to determine whether we can prompt the user to upload |
1074 // their card. If no CVC is present, do nothing. We could fall back to a | 1075 // their card. If no CVC is present, do nothing. We could fall back to a |
1075 // local save but we believe that sometimes offering upload and sometimes | 1076 // local save but we believe that sometimes offering upload and sometimes |
1076 // offering local save is a confusing user experience. | 1077 // offering local save is a confusing user experience. |
| 1078 int cvc; |
1077 for (const AutofillField* field : submitted_form) { | 1079 for (const AutofillField* field : submitted_form) { |
1078 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE) { | 1080 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && |
| 1081 base::StringToInt(field->value, &cvc)) { |
1079 upload_request_.cvc = field->value; | 1082 upload_request_.cvc = field->value; |
1080 break; | 1083 break; |
1081 } | 1084 } |
1082 } | 1085 } |
1083 if (upload_request_.cvc.empty()) { | 1086 if (upload_request_.cvc.empty()) { |
1084 AutofillMetrics::LogCardUploadDecisionMetric( | 1087 AutofillMetrics::LogCardUploadDecisionMetric( |
1085 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); | 1088 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); |
1086 return; | 1089 return; |
1087 } | 1090 } |
1088 | 1091 |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 if (i > 0) | 2020 if (i > 0) |
2018 fputs("Next oldest form:\n", file); | 2021 fputs("Next oldest form:\n", file); |
2019 } | 2022 } |
2020 fputs("\n", file); | 2023 fputs("\n", file); |
2021 | 2024 |
2022 fclose(file); | 2025 fclose(file); |
2023 } | 2026 } |
2024 #endif // ENABLE_FORM_DEBUG_DUMP | 2027 #endif // ENABLE_FORM_DEBUG_DUMP |
2025 | 2028 |
2026 } // namespace autofill | 2029 } // namespace autofill |
OLD | NEW |