Chromium Code Reviews| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) { | 265 autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) { |
| 266 return false; | 266 return false; |
| 267 } | 267 } |
| 268 | 268 |
| 269 static const int kShowScanCreditCardMaxValueLength = 6; | 269 static const int kShowScanCreditCardMaxValueLength = 6; |
| 270 return field.value.size() <= kShowScanCreditCardMaxValueLength && | 270 return field.value.size() <= kShowScanCreditCardMaxValueLength && |
| 271 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value), | 271 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value), |
| 272 base::ASCIIToUTF16("0123456789")); | 272 base::ASCIIToUTF16("0123456789")); |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool AutofillManager::ShouldShowCreditCardSigninPromo( | |
| 276 const FormData& form, | |
| 277 const FormFieldData& field) { | |
| 278 // Check whether we are dealing with a credit card field. | |
| 279 AutofillField* autofill_field = GetAutofillField(form, field); | |
| 280 if (!autofill_field || autofill_field->Type().group() != CREDIT_CARD) { | |
|
Evan Stade
2016/07/08 17:34:58
nit: return autofill_field && autofill_field->Type
Mathieu
2016/07/08 18:10:02
Neater thanks
| |
| 281 return false; | |
| 282 } | |
| 283 | |
| 284 // Will check if the user is signed in and if it's appropriate to show the | |
| 285 // promo (e.g. the platform is supported). | |
| 286 return client_->ShouldShowSigninPromo(); | |
| 287 } | |
| 288 | |
| 275 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, | 289 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, |
| 276 const TimeTicks& timestamp) { | 290 const TimeTicks& timestamp) { |
| 277 if (!IsValidFormDataVector(forms)) | 291 if (!IsValidFormDataVector(forms)) |
| 278 return; | 292 return; |
| 279 | 293 |
| 280 if (!driver_->RendererIsAvailable()) | 294 if (!driver_->RendererIsAvailable()) |
| 281 return; | 295 return; |
| 282 | 296 |
| 283 bool enabled = IsAutofillEnabled(); | 297 bool enabled = IsAutofillEnabled(); |
| 284 if (!has_logged_autofill_enabled_) { | 298 if (!has_logged_autofill_enabled_) { |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2016 if (i > 0) | 2030 if (i > 0) |
| 2017 fputs("Next oldest form:\n", file); | 2031 fputs("Next oldest form:\n", file); |
| 2018 } | 2032 } |
| 2019 fputs("\n", file); | 2033 fputs("\n", file); |
| 2020 | 2034 |
| 2021 fclose(file); | 2035 fclose(file); |
| 2022 } | 2036 } |
| 2023 #endif // ENABLE_FORM_DEBUG_DUMP | 2037 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2024 | 2038 |
| 2025 } // namespace autofill | 2039 } // namespace autofill |
| OLD | NEW |