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 | 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/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/sequenced_worker_pool.h" | 22 #include "base/threading/sequenced_worker_pool.h" |
| 23 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 23 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 24 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" | |
| 24 #include "components/autofill/core/browser/autofill_client.h" | 25 #include "components/autofill/core/browser/autofill_client.h" |
| 25 #include "components/autofill/core/browser/autofill_data_model.h" | 26 #include "components/autofill/core/browser/autofill_data_model.h" |
| 26 #include "components/autofill/core/browser/autofill_external_delegate.h" | 27 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 27 #include "components/autofill/core/browser/autofill_field.h" | 28 #include "components/autofill/core/browser/autofill_field.h" |
| 28 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 29 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
| 29 #include "components/autofill/core/browser/autofill_metrics.h" | 30 #include "components/autofill/core/browser/autofill_metrics.h" |
| 30 #include "components/autofill/core/browser/autofill_profile.h" | 31 #include "components/autofill/core/browser/autofill_profile.h" |
| 31 #include "components/autofill/core/browser/autofill_type.h" | 32 #include "components/autofill/core/browser/autofill_type.h" |
| 32 #include "components/autofill/core/browser/credit_card.h" | 33 #include "components/autofill/core/browser/credit_card.h" |
| 33 #include "components/autofill/core/browser/field_types.h" | 34 #include "components/autofill/core/browser/field_types.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 } | 665 } |
| 665 | 666 |
| 666 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 667 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
| 667 scoped_ptr<CreditCard> imported_credit_card; | 668 scoped_ptr<CreditCard> imported_credit_card; |
| 668 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) | 669 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) |
| 669 return; | 670 return; |
| 670 | 671 |
| 671 // If credit card information was submitted, we need to confirm whether to | 672 // If credit card information was submitted, we need to confirm whether to |
| 672 // save it. | 673 // save it. |
| 673 if (imported_credit_card) { | 674 if (imported_credit_card) { |
| 674 client_->ConfirmSaveCreditCard( | 675 AutofillCCInfoBarDelegate::Create( |
|
Peter Kasting
2014/12/23 21:20:35
It seems like the way we abstracted this entire ca
Pritam Nikam
2014/12/24 11:16:57
Done.
Restored back ConfirmSaveCreditCard().
| |
| 676 client_->GetInfoBarManager(), driver_, | |
| 675 base::Bind( | 677 base::Bind( |
| 676 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), | 678 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), |
| 677 base::Unretained(personal_data_), | 679 base::Unretained(personal_data_), *imported_credit_card)); |
| 678 *imported_credit_card)); | |
| 679 } | 680 } |
| 680 } | 681 } |
| 681 | 682 |
| 682 // Note that |submitted_form| is passed as a pointer rather than as a reference | 683 // Note that |submitted_form| is passed as a pointer rather than as a reference |
| 683 // so that we can get memory management right across threads. Note also that we | 684 // so that we can get memory management right across threads. Note also that we |
| 684 // explicitly pass in all the time stamps of interest, as the cached ones might | 685 // explicitly pass in all the time stamps of interest, as the cached ones might |
| 685 // get reset before this method executes. | 686 // get reset before this method executes. |
| 686 void AutofillManager::UploadFormDataAsyncCallback( | 687 void AutofillManager::UploadFormDataAsyncCallback( |
| 687 const FormStructure* submitted_form, | 688 const FormStructure* submitted_form, |
| 688 const TimeTicks& load_time, | 689 const TimeTicks& load_time, |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 return false; | 1248 return false; |
| 1248 | 1249 |
| 1249 // Disregard forms that we wouldn't ever autofill in the first place. | 1250 // Disregard forms that we wouldn't ever autofill in the first place. |
| 1250 if (!form.ShouldBeParsed()) | 1251 if (!form.ShouldBeParsed()) |
| 1251 return false; | 1252 return false; |
| 1252 | 1253 |
| 1253 return true; | 1254 return true; |
| 1254 } | 1255 } |
| 1255 | 1256 |
| 1256 } // namespace autofill | 1257 } // namespace autofill |
| OLD | NEW |