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

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

Issue 2124343002: [Autofill] Implement Credit Card Signin Promo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 months 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 and whether it's
279 // appropriate to show the promo (e.g. the platform is supported).
280 AutofillField* autofill_field = GetAutofillField(form, field);
281 return autofill_field && autofill_field->Type().group() == CREDIT_CARD &&
282 client_->ShouldShowSigninPromo();
283 }
284
275 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, 285 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
276 const TimeTicks& timestamp) { 286 const TimeTicks& timestamp) {
277 if (!IsValidFormDataVector(forms)) 287 if (!IsValidFormDataVector(forms))
278 return; 288 return;
279 289
280 if (!driver_->RendererIsAvailable()) 290 if (!driver_->RendererIsAvailable())
281 return; 291 return;
282 292
283 bool enabled = IsAutofillEnabled(); 293 bool enabled = IsAutofillEnabled();
284 if (!has_logged_autofill_enabled_) { 294 if (!has_logged_autofill_enabled_) {
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 if (i > 0) 2026 if (i > 0)
2017 fputs("Next oldest form:\n", file); 2027 fputs("Next oldest form:\n", file);
2018 } 2028 }
2019 fputs("\n", file); 2029 fputs("\n", file);
2020 2030
2021 fclose(file); 2031 fclose(file);
2022 } 2032 }
2023 #endif // ENABLE_FORM_DEBUG_DUMP 2033 #endif // ENABLE_FORM_DEBUG_DUMP
2024 2034
2025 } // namespace autofill 2035 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698