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

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

Issue 991983003: Credit card scanning field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/guid.h" 16 #include "base/guid.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/metrics/field_trial.h"
19 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
20 #include "base/strings/string16.h" 21 #include "base/strings/string16.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "base/threading/sequenced_worker_pool.h" 24 #include "base/threading/sequenced_worker_pool.h"
24 #include "components/autofill/core/browser/autocomplete_history_manager.h" 25 #include "components/autofill/core/browser/autocomplete_history_manager.h"
25 #include "components/autofill/core/browser/autofill_client.h" 26 #include "components/autofill/core/browser/autofill_client.h"
26 #include "components/autofill/core/browser/autofill_data_model.h" 27 #include "components/autofill/core/browser/autofill_data_model.h"
27 #include "components/autofill/core/browser/autofill_external_delegate.h" 28 #include "components/autofill/core/browser/autofill_external_delegate.h"
28 #include "components/autofill/core/browser/autofill_field.h" 29 #include "components/autofill/core/browser/autofill_field.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 int AutofillManager::AccessAddressBookPromptCount() { 290 int AutofillManager::AccessAddressBookPromptCount() {
290 if (!personal_data_) 291 if (!personal_data_)
291 return 0; 292 return 0;
292 return personal_data_->AccessAddressBookPromptCount(); 293 return personal_data_->AccessAddressBookPromptCount();
293 } 294 }
294 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 295 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
295 296
296 bool AutofillManager::ShouldShowScanCreditCard(const FormData& form, 297 bool AutofillManager::ShouldShowScanCreditCard(const FormData& form,
297 const FormFieldData& field) { 298 const FormFieldData& field) {
298 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 299 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
299 autofill::switches::kEnableCreditCardScan)) { 300 autofill::switches::kEnableCreditCardScan) &&
301 (base::FieldTrialList::FindFullName("CreditCardScan") != "Enabled" ||
302 base::CommandLine::ForCurrentProcess()->HasSwitch(
303 autofill::switches::kDisableCreditCardScan))) {
300 return false; 304 return false;
301 } 305 }
302 306
303 if (!client_->HasCreditCardScanFeature()) 307 if (!client_->HasCreditCardScanFeature())
304 return false; 308 return false;
305 309
306 AutofillField* autofill_field = GetAutofillField(form, field); 310 AutofillField* autofill_field = GetAutofillField(form, field);
307 if (!autofill_field || 311 if (!autofill_field ||
308 autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) { 312 autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) {
309 return false; 313 return false;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 return false; 1461 return false;
1458 1462
1459 // Disregard forms that we wouldn't ever autofill in the first place. 1463 // Disregard forms that we wouldn't ever autofill in the first place.
1460 if (!form.ShouldBeParsed()) 1464 if (!form.ShouldBeParsed())
1461 return false; 1465 return false;
1462 1466
1463 return true; 1467 return true;
1464 } 1468 }
1465 1469
1466 } // namespace autofill 1470 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698