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_client.h" |
24 #include "components/autofill/core/browser/autofill_data_model.h" | 25 #include "components/autofill/core/browser/autofill_data_model.h" |
25 #include "components/autofill/core/browser/autofill_external_delegate.h" | 26 #include "components/autofill/core/browser/autofill_external_delegate.h" |
26 #include "components/autofill/core/browser/autofill_field.h" | 27 #include "components/autofill/core/browser/autofill_field.h" |
27 #include "components/autofill/core/browser/autofill_manager_delegate.h" | |
28 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 28 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
29 #include "components/autofill/core/browser/autofill_metrics.h" | 29 #include "components/autofill/core/browser/autofill_metrics.h" |
30 #include "components/autofill/core/browser/autofill_profile.h" | 30 #include "components/autofill/core/browser/autofill_profile.h" |
31 #include "components/autofill/core/browser/autofill_type.h" | 31 #include "components/autofill/core/browser/autofill_type.h" |
32 #include "components/autofill/core/browser/credit_card.h" | 32 #include "components/autofill/core/browser/credit_card.h" |
33 #include "components/autofill/core/browser/form_structure.h" | 33 #include "components/autofill/core/browser/form_structure.h" |
34 #include "components/autofill/core/browser/personal_data_manager.h" | 34 #include "components/autofill/core/browser/personal_data_manager.h" |
35 #include "components/autofill/core/browser/phone_number.h" | 35 #include "components/autofill/core/browser/phone_number.h" |
36 #include "components/autofill/core/browser/phone_number_i18n.h" | 36 #include "components/autofill/core/browser/phone_number_i18n.h" |
37 #include "components/autofill/core/browser/popup_item_ids.h" | 37 #include "components/autofill/core/browser/popup_item_ids.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const std::string& app_locale, | 133 const std::string& app_locale, |
134 FormStructure* submitted_form) { | 134 FormStructure* submitted_form) { |
135 // For each field in the |submitted_form|, extract the value. Then for each | 135 // For each field in the |submitted_form|, extract the value. Then for each |
136 // profile or credit card, identify any stored types that match the value. | 136 // profile or credit card, identify any stored types that match the value. |
137 for (size_t i = 0; i < submitted_form->field_count(); ++i) { | 137 for (size_t i = 0; i < submitted_form->field_count(); ++i) { |
138 AutofillField* field = submitted_form->field(i); | 138 AutofillField* field = submitted_form->field(i); |
139 ServerFieldTypeSet matching_types; | 139 ServerFieldTypeSet matching_types; |
140 | 140 |
141 // If it's a password field, set the type directly. | 141 // If it's a password field, set the type directly. |
142 if (field->form_control_type == "password") { | 142 if (field->form_control_type == "password") { |
143 matching_types.insert(autofill::PASSWORD); | 143 matching_types.insert(PASSWORD); |
144 } else { | 144 } else { |
145 base::string16 value; | 145 base::string16 value; |
146 base::TrimWhitespace(field->value, base::TRIM_ALL, &value); | 146 base::TrimWhitespace(field->value, base::TRIM_ALL, &value); |
147 for (std::vector<AutofillProfile>::const_iterator it = profiles.begin(); | 147 for (std::vector<AutofillProfile>::const_iterator it = profiles.begin(); |
148 it != profiles.end(); ++it) { | 148 it != profiles.end(); ++it) { |
149 it->GetMatchingTypes(value, app_locale, &matching_types); | 149 it->GetMatchingTypes(value, app_locale, &matching_types); |
150 } | 150 } |
151 for (std::vector<CreditCard>::const_iterator it = credit_cards.begin(); | 151 for (std::vector<CreditCard>::const_iterator it = credit_cards.begin(); |
152 it != credit_cards.end(); ++it) { | 152 it != credit_cards.end(); ++it) { |
153 it->GetMatchingTypes(value, app_locale, &matching_types); | 153 it->GetMatchingTypes(value, app_locale, &matching_types); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 if (matching_types.empty()) | 157 if (matching_types.empty()) |
158 matching_types.insert(UNKNOWN_TYPE); | 158 matching_types.insert(UNKNOWN_TYPE); |
159 | 159 |
160 field->set_possible_types(matching_types); | 160 field->set_possible_types(matching_types); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 } // namespace | 164 } // namespace |
165 | 165 |
166 AutofillManager::AutofillManager( | 166 AutofillManager::AutofillManager( |
167 AutofillDriver* driver, | 167 AutofillDriver* driver, |
168 autofill::AutofillManagerDelegate* delegate, | 168 AutofillClient* client, |
169 const std::string& app_locale, | 169 const std::string& app_locale, |
170 AutofillDownloadManagerState enable_download_manager) | 170 AutofillDownloadManagerState enable_download_manager) |
171 : driver_(driver), | 171 : driver_(driver), |
172 manager_delegate_(delegate), | 172 client_(client), |
173 app_locale_(app_locale), | 173 app_locale_(app_locale), |
174 personal_data_(delegate->GetPersonalDataManager()), | 174 personal_data_(client->GetPersonalDataManager()), |
175 autocomplete_history_manager_( | 175 autocomplete_history_manager_( |
176 new AutocompleteHistoryManager(driver, delegate)), | 176 new AutocompleteHistoryManager(driver, client)), |
177 metric_logger_(new AutofillMetrics), | 177 metric_logger_(new AutofillMetrics), |
178 has_logged_autofill_enabled_(false), | 178 has_logged_autofill_enabled_(false), |
179 has_logged_address_suggestions_count_(false), | 179 has_logged_address_suggestions_count_(false), |
180 did_show_suggestions_(false), | 180 did_show_suggestions_(false), |
181 user_did_type_(false), | 181 user_did_type_(false), |
182 user_did_autofill_(false), | 182 user_did_autofill_(false), |
183 user_did_edit_autofilled_field_(false), | 183 user_did_edit_autofilled_field_(false), |
184 external_delegate_(NULL), | 184 external_delegate_(NULL), |
185 test_delegate_(NULL), | 185 test_delegate_(NULL), |
186 weak_ptr_factory_(this) { | 186 weak_ptr_factory_(this) { |
187 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) { | 187 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) { |
188 download_manager_.reset( | 188 download_manager_.reset( |
189 new AutofillDownloadManager(driver, | 189 new AutofillDownloadManager(driver, client_->GetPrefs(), this)); |
190 manager_delegate_->GetPrefs(), | |
191 this)); | |
192 } | 190 } |
193 } | 191 } |
194 | 192 |
195 AutofillManager::~AutofillManager() {} | 193 AutofillManager::~AutofillManager() {} |
196 | 194 |
197 // static | 195 // static |
198 void AutofillManager::RegisterProfilePrefs( | 196 void AutofillManager::RegisterProfilePrefs( |
199 user_prefs::PrefRegistrySyncable* registry) { | 197 user_prefs::PrefRegistrySyncable* registry) { |
200 registry->RegisterBooleanPref( | 198 registry->RegisterBooleanPref( |
201 prefs::kAutofillEnabled, | 199 prefs::kAutofillEnabled, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 271 |
274 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { | 272 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { |
275 // TODO(jrg): consider passing delegate into the ctor. That won't | 273 // TODO(jrg): consider passing delegate into the ctor. That won't |
276 // work if the delegate has a pointer to the AutofillManager, but | 274 // work if the delegate has a pointer to the AutofillManager, but |
277 // future directions may not need such a pointer. | 275 // future directions may not need such a pointer. |
278 external_delegate_ = delegate; | 276 external_delegate_ = delegate; |
279 autocomplete_history_manager_->SetExternalDelegate(delegate); | 277 autocomplete_history_manager_->SetExternalDelegate(delegate); |
280 } | 278 } |
281 | 279 |
282 void AutofillManager::ShowAutofillSettings() { | 280 void AutofillManager::ShowAutofillSettings() { |
283 manager_delegate_->ShowAutofillSettings(); | 281 client_->ShowAutofillSettings(); |
284 } | 282 } |
285 | 283 |
286 #if defined(OS_MACOSX) && !defined(OS_IOS) | 284 #if defined(OS_MACOSX) && !defined(OS_IOS) |
287 bool AutofillManager::ShouldShowAccessAddressBookSuggestion( | 285 bool AutofillManager::ShouldShowAccessAddressBookSuggestion( |
288 const FormData& form, | 286 const FormData& form, |
289 const FormFieldData& field) { | 287 const FormFieldData& field) { |
290 if (!personal_data_) | 288 if (!personal_data_) |
291 return false; | 289 return false; |
292 FormStructure* form_structure = NULL; | 290 FormStructure* form_structure = NULL; |
293 AutofillField* autofill_field = NULL; | 291 AutofillField* autofill_field = NULL; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 if ((*iter) == field) { | 563 if ((*iter) == field) { |
566 base::string16 value = data_model->GetInfoForVariant( | 564 base::string16 value = data_model->GetInfoForVariant( |
567 autofill_field->Type(), variant, app_locale_); | 565 autofill_field->Type(), variant, app_locale_); |
568 if (AutofillField::FillFormField( | 566 if (AutofillField::FillFormField( |
569 *autofill_field, value, app_locale_, &(*iter))) { | 567 *autofill_field, value, app_locale_, &(*iter))) { |
570 // Mark the cached field as autofilled, so that we can detect when a | 568 // Mark the cached field as autofilled, so that we can detect when a |
571 // user edits an autofilled field (for metrics). | 569 // user edits an autofilled field (for metrics). |
572 autofill_field->is_autofilled = true; | 570 autofill_field->is_autofilled = true; |
573 | 571 |
574 if (!is_credit_card && !value.empty()) | 572 if (!is_credit_card && !value.empty()) |
575 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 573 client_->DidFillOrPreviewField(value, profile_full_name); |
576 } | 574 } |
577 break; | 575 break; |
578 } | 576 } |
579 } | 577 } |
580 | 578 |
581 driver_->SendFormDataToRenderer(query_id, action, result); | 579 driver_->SendFormDataToRenderer(query_id, action, result); |
582 return; | 580 return; |
583 } | 581 } |
584 | 582 |
585 // Cache the field type for the field from which the user initiated autofill. | 583 // Cache the field type for the field from which the user initiated autofill. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 // Mark the cached field as autofilled, so that we can detect when a | 620 // Mark the cached field as autofilled, so that we can detect when a |
623 // user edits an autofilled field (for metrics). | 621 // user edits an autofilled field (for metrics). |
624 form_structure->field(i)->is_autofilled = true; | 622 form_structure->field(i)->is_autofilled = true; |
625 | 623 |
626 // Mark the field as autofilled when a non-empty value is assigned to | 624 // Mark the field as autofilled when a non-empty value is assigned to |
627 // it. This allows the renderer to distinguish autofilled fields from | 625 // it. This allows the renderer to distinguish autofilled fields from |
628 // fields with non-empty values, such as select-one fields. | 626 // fields with non-empty values, such as select-one fields. |
629 result.fields[i].is_autofilled = true; | 627 result.fields[i].is_autofilled = true; |
630 | 628 |
631 if (should_notify) | 629 if (should_notify) |
632 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 630 client_->DidFillOrPreviewField(value, profile_full_name); |
633 } | 631 } |
634 } | 632 } |
635 } | 633 } |
636 | 634 |
637 autofilled_form_signatures_.push_front(form_structure->FormSignature()); | 635 autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
638 // Only remember the last few forms that we've seen, both to avoid false | 636 // Only remember the last few forms that we've seen, both to avoid false |
639 // positives and to avoid wasting memory. | 637 // positives and to avoid wasting memory. |
640 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) | 638 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) |
641 autofilled_form_signatures_.pop_back(); | 639 autofilled_form_signatures_.pop_back(); |
642 | 640 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 metric_logger_->LogUserHappinessMetric( | 672 metric_logger_->LogUserHappinessMetric( |
675 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 673 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
676 } | 674 } |
677 } | 675 } |
678 } | 676 } |
679 | 677 |
680 void AutofillManager::OnHidePopup() { | 678 void AutofillManager::OnHidePopup() { |
681 if (!IsAutofillEnabled()) | 679 if (!IsAutofillEnabled()) |
682 return; | 680 return; |
683 | 681 |
684 manager_delegate_->HideAutofillPopup(); | 682 client_->HideAutofillPopup(); |
685 } | 683 } |
686 | 684 |
687 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | 685 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
688 const AutofillDataModel* data_model = NULL; | 686 const AutofillDataModel* data_model = NULL; |
689 size_t variant = 0; | 687 size_t variant = 0; |
690 bool unused_is_credit_card = false; | 688 bool unused_is_credit_card = false; |
691 if (!GetProfileOrCreditCard( | 689 if (!GetProfileOrCreditCard( |
692 unique_id, &data_model, &variant, &unused_is_credit_card)) { | 690 unique_id, &data_model, &variant, &unused_is_credit_card)) { |
693 NOTREACHED(); | 691 NOTREACHED(); |
694 return; | 692 return; |
(...skipping 10 matching lines...) Expand all Loading... |
705 | 703 |
706 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, | 704 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, |
707 const base::string16& value) { | 705 const base::string16& value) { |
708 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); | 706 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); |
709 } | 707 } |
710 | 708 |
711 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { | 709 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { |
712 return form_structures_.get(); | 710 return form_structures_.get(); |
713 } | 711 } |
714 | 712 |
715 void AutofillManager::SetTestDelegate( | 713 void AutofillManager::SetTestDelegate(AutofillManagerTestDelegate* delegate) { |
716 autofill::AutofillManagerTestDelegate* delegate) { | |
717 test_delegate_ = delegate; | 714 test_delegate_ = delegate; |
718 } | 715 } |
719 | 716 |
720 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, | 717 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, |
721 const std::vector<base::string16>& labels) { | 718 const std::vector<base::string16>& labels) { |
722 if (!IsValidString16Vector(values) || | 719 if (!IsValidString16Vector(values) || |
723 !IsValidString16Vector(labels) || | 720 !IsValidString16Vector(labels) || |
724 values.size() != labels.size()) | 721 values.size() != labels.size()) |
725 return; | 722 return; |
726 | 723 |
727 external_delegate_->SetCurrentDataListValues(values, labels); | 724 external_delegate_->SetCurrentDataListValues(values, labels); |
728 } | 725 } |
729 | 726 |
730 void AutofillManager::OnLoadedServerPredictions( | 727 void AutofillManager::OnLoadedServerPredictions( |
731 const std::string& response_xml) { | 728 const std::string& response_xml) { |
732 // Parse and store the server predictions. | 729 // Parse and store the server predictions. |
733 FormStructure::ParseQueryResponse(response_xml, | 730 FormStructure::ParseQueryResponse(response_xml, |
734 form_structures_.get(), | 731 form_structures_.get(), |
735 *metric_logger_); | 732 *metric_logger_); |
736 | 733 |
737 // Forward form structures to the password generation manager to detect | 734 // Forward form structures to the password generation manager to detect |
738 // account creation forms. | 735 // account creation forms. |
739 manager_delegate_->DetectAccountCreationForms(form_structures_.get()); | 736 client_->DetectAccountCreationForms(form_structures_.get()); |
740 | 737 |
741 // If the corresponding flag is set, annotate forms with the predicted types. | 738 // If the corresponding flag is set, annotate forms with the predicted types. |
742 driver_->SendAutofillTypePredictionsToRenderer(form_structures_.get()); | 739 driver_->SendAutofillTypePredictionsToRenderer(form_structures_.get()); |
743 } | 740 } |
744 | 741 |
745 void AutofillManager::OnDidEndTextFieldEditing() { | 742 void AutofillManager::OnDidEndTextFieldEditing() { |
746 external_delegate_->DidEndTextFieldEditing(); | 743 external_delegate_->DidEndTextFieldEditing(); |
747 } | 744 } |
748 | 745 |
749 bool AutofillManager::IsAutofillEnabled() const { | 746 bool AutofillManager::IsAutofillEnabled() const { |
750 return manager_delegate_->GetPrefs()->GetBoolean(prefs::kAutofillEnabled); | 747 return client_->GetPrefs()->GetBoolean(prefs::kAutofillEnabled); |
751 } | 748 } |
752 | 749 |
753 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 750 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
754 scoped_ptr<CreditCard> imported_credit_card; | 751 scoped_ptr<CreditCard> imported_credit_card; |
755 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) | 752 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) |
756 return; | 753 return; |
757 | 754 |
758 // If credit card information was submitted, we need to confirm whether to | 755 // If credit card information was submitted, we need to confirm whether to |
759 // save it. | 756 // save it. |
760 if (imported_credit_card) { | 757 if (imported_credit_card) { |
761 manager_delegate_->ConfirmSaveCreditCard( | 758 client_->ConfirmSaveCreditCard( |
762 *metric_logger_, | 759 *metric_logger_, |
763 base::Bind( | 760 base::Bind( |
764 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), | 761 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), |
765 base::Unretained(personal_data_), *imported_credit_card)); | 762 base::Unretained(personal_data_), |
| 763 *imported_credit_card)); |
766 } | 764 } |
767 } | 765 } |
768 | 766 |
769 // Note that |submitted_form| is passed as a pointer rather than as a reference | 767 // Note that |submitted_form| is passed as a pointer rather than as a reference |
770 // so that we can get memory management right across threads. Note also that we | 768 // so that we can get memory management right across threads. Note also that we |
771 // explicitly pass in all the time stamps of interest, as the cached ones might | 769 // explicitly pass in all the time stamps of interest, as the cached ones might |
772 // get reset before this method executes. | 770 // get reset before this method executes. |
773 void AutofillManager::UploadFormDataAsyncCallback( | 771 void AutofillManager::UploadFormDataAsyncCallback( |
774 const FormStructure* submitted_form, | 772 const FormStructure* submitted_form, |
775 const TimeTicks& load_time, | 773 const TimeTicks& load_time, |
(...skipping 22 matching lines...) Expand all Loading... |
798 if (*it == form_signature) | 796 if (*it == form_signature) |
799 was_autofilled = true; | 797 was_autofilled = true; |
800 } | 798 } |
801 | 799 |
802 ServerFieldTypeSet non_empty_types; | 800 ServerFieldTypeSet non_empty_types; |
803 personal_data_->GetNonEmptyTypes(&non_empty_types); | 801 personal_data_->GetNonEmptyTypes(&non_empty_types); |
804 // Always add PASSWORD to |non_empty_types| so that if |submitted_form| | 802 // Always add PASSWORD to |non_empty_types| so that if |submitted_form| |
805 // contains a password field it will be uploaded to the server. If | 803 // contains a password field it will be uploaded to the server. If |
806 // |submitted_form| doesn't contain a password field, there is no side | 804 // |submitted_form| doesn't contain a password field, there is no side |
807 // effect from adding PASSWORD to |non_empty_types|. | 805 // effect from adding PASSWORD to |non_empty_types|. |
808 non_empty_types.insert(autofill::PASSWORD); | 806 non_empty_types.insert(PASSWORD); |
809 | 807 |
810 download_manager_->StartUploadRequest(submitted_form, was_autofilled, | 808 download_manager_->StartUploadRequest(submitted_form, was_autofilled, |
811 non_empty_types); | 809 non_empty_types); |
812 } | 810 } |
813 | 811 |
814 bool AutofillManager::UploadPasswordGenerationForm(const FormData& form) { | 812 bool AutofillManager::UploadPasswordGenerationForm(const FormData& form) { |
815 FormStructure form_structure(form); | 813 FormStructure form_structure(form); |
816 | 814 |
817 if (!ShouldUploadForm(form_structure)) | 815 if (!ShouldUploadForm(form_structure)) |
818 return false; | 816 return false; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 did_show_suggestions_ = false; | 861 did_show_suggestions_ = false; |
864 user_did_type_ = false; | 862 user_did_type_ = false; |
865 user_did_autofill_ = false; | 863 user_did_autofill_ = false; |
866 user_did_edit_autofilled_field_ = false; | 864 user_did_edit_autofilled_field_ = false; |
867 forms_loaded_timestamps_.clear(); | 865 forms_loaded_timestamps_.clear(); |
868 initial_interaction_timestamp_ = TimeTicks(); | 866 initial_interaction_timestamp_ = TimeTicks(); |
869 external_delegate_->Reset(); | 867 external_delegate_->Reset(); |
870 } | 868 } |
871 | 869 |
872 AutofillManager::AutofillManager(AutofillDriver* driver, | 870 AutofillManager::AutofillManager(AutofillDriver* driver, |
873 autofill::AutofillManagerDelegate* delegate, | 871 AutofillClient* client, |
874 PersonalDataManager* personal_data) | 872 PersonalDataManager* personal_data) |
875 : driver_(driver), | 873 : driver_(driver), |
876 manager_delegate_(delegate), | 874 client_(client), |
877 app_locale_("en-US"), | 875 app_locale_("en-US"), |
878 personal_data_(personal_data), | 876 personal_data_(personal_data), |
879 autocomplete_history_manager_( | 877 autocomplete_history_manager_( |
880 new AutocompleteHistoryManager(driver, delegate)), | 878 new AutocompleteHistoryManager(driver, client)), |
881 metric_logger_(new AutofillMetrics), | 879 metric_logger_(new AutofillMetrics), |
882 has_logged_autofill_enabled_(false), | 880 has_logged_autofill_enabled_(false), |
883 has_logged_address_suggestions_count_(false), | 881 has_logged_address_suggestions_count_(false), |
884 did_show_suggestions_(false), | 882 did_show_suggestions_(false), |
885 user_did_type_(false), | 883 user_did_type_(false), |
886 user_did_autofill_(false), | 884 user_did_autofill_(false), |
887 user_did_edit_autofilled_field_(false), | 885 user_did_edit_autofilled_field_(false), |
888 external_delegate_(NULL), | 886 external_delegate_(NULL), |
889 test_delegate_(NULL), | 887 test_delegate_(NULL), |
890 weak_ptr_factory_(this) { | 888 weak_ptr_factory_(this) { |
891 DCHECK(driver_); | 889 DCHECK(driver_); |
892 DCHECK(manager_delegate_); | 890 DCHECK(client_); |
893 } | 891 } |
894 | 892 |
895 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { | 893 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { |
896 metric_logger_.reset(metric_logger); | 894 metric_logger_.reset(metric_logger); |
897 } | 895 } |
898 | 896 |
899 bool AutofillManager::RefreshDataModels() const { | 897 bool AutofillManager::RefreshDataModels() const { |
900 if (!IsAutofillEnabled()) | 898 if (!IsAutofillEnabled()) |
901 return false; | 899 return false; |
902 | 900 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 return false; | 1206 return false; |
1209 | 1207 |
1210 // Disregard forms that we wouldn't ever autofill in the first place. | 1208 // Disregard forms that we wouldn't ever autofill in the first place. |
1211 if (!form.ShouldBeParsed(true)) | 1209 if (!form.ShouldBeParsed(true)) |
1212 return false; | 1210 return false; |
1213 | 1211 |
1214 return true; | 1212 return true; |
1215 } | 1213 } |
1216 | 1214 |
1217 } // namespace autofill | 1215 } // namespace autofill |
OLD | NEW |