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 28 matching lines...) Expand all Loading... |
230 | 228 |
231 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { | 229 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { |
232 // TODO(jrg): consider passing delegate into the ctor. That won't | 230 // TODO(jrg): consider passing delegate into the ctor. That won't |
233 // work if the delegate has a pointer to the AutofillManager, but | 231 // work if the delegate has a pointer to the AutofillManager, but |
234 // future directions may not need such a pointer. | 232 // future directions may not need such a pointer. |
235 external_delegate_ = delegate; | 233 external_delegate_ = delegate; |
236 autocomplete_history_manager_->SetExternalDelegate(delegate); | 234 autocomplete_history_manager_->SetExternalDelegate(delegate); |
237 } | 235 } |
238 | 236 |
239 void AutofillManager::ShowAutofillSettings() { | 237 void AutofillManager::ShowAutofillSettings() { |
240 manager_delegate_->ShowAutofillSettings(); | 238 client_->ShowAutofillSettings(); |
241 } | 239 } |
242 | 240 |
243 bool AutofillManager::OnFormSubmitted(const FormData& form, | 241 bool AutofillManager::OnFormSubmitted(const FormData& form, |
244 const TimeTicks& timestamp) { | 242 const TimeTicks& timestamp) { |
245 if (!IsValidFormData(form)) | 243 if (!IsValidFormData(form)) |
246 return false; | 244 return false; |
247 | 245 |
248 // Let Autocomplete know as well. | 246 // Let Autocomplete know as well. |
249 autocomplete_history_manager_->OnFormSubmitted(form); | 247 autocomplete_history_manager_->OnFormSubmitted(form); |
250 | 248 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 if ((*iter) == field) { | 498 if ((*iter) == field) { |
501 base::string16 value = data_model->GetInfoForVariant( | 499 base::string16 value = data_model->GetInfoForVariant( |
502 autofill_field->Type(), variant, app_locale_); | 500 autofill_field->Type(), variant, app_locale_); |
503 if (AutofillField::FillFormField( | 501 if (AutofillField::FillFormField( |
504 *autofill_field, value, app_locale_, &(*iter))) { | 502 *autofill_field, value, app_locale_, &(*iter))) { |
505 // Mark the cached field as autofilled, so that we can detect when a | 503 // Mark the cached field as autofilled, so that we can detect when a |
506 // user edits an autofilled field (for metrics). | 504 // user edits an autofilled field (for metrics). |
507 autofill_field->is_autofilled = true; | 505 autofill_field->is_autofilled = true; |
508 | 506 |
509 if (!is_credit_card && !value.empty()) | 507 if (!is_credit_card && !value.empty()) |
510 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 508 client_->DidFillOrPreviewField(value, profile_full_name); |
511 } | 509 } |
512 break; | 510 break; |
513 } | 511 } |
514 } | 512 } |
515 | 513 |
516 driver_->SendFormDataToRenderer(query_id, action, result); | 514 driver_->SendFormDataToRenderer(query_id, action, result); |
517 return; | 515 return; |
518 } | 516 } |
519 | 517 |
520 // Cache the field type for the field from which the user initiated autofill. | 518 // Cache the field type for the field from which the user initiated autofill. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 (result.fields[i] == field || | 550 (result.fields[i] == field || |
553 result.fields[i].form_control_type == "select-one" || | 551 result.fields[i].form_control_type == "select-one" || |
554 result.fields[i].value.empty()); | 552 result.fields[i].value.empty()); |
555 if (AutofillField::FillFormField( | 553 if (AutofillField::FillFormField( |
556 *cached_field, value, app_locale_, &result.fields[i])) { | 554 *cached_field, value, app_locale_, &result.fields[i])) { |
557 // Mark the cached field as autofilled, so that we can detect when a | 555 // Mark the cached field as autofilled, so that we can detect when a |
558 // user edits an autofilled field (for metrics). | 556 // user edits an autofilled field (for metrics). |
559 form_structure->field(i)->is_autofilled = true; | 557 form_structure->field(i)->is_autofilled = true; |
560 | 558 |
561 if (should_notify) | 559 if (should_notify) |
562 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 560 client_->DidFillOrPreviewField(value, profile_full_name); |
563 } | 561 } |
564 } | 562 } |
565 } | 563 } |
566 | 564 |
567 autofilled_form_signatures_.push_front(form_structure->FormSignature()); | 565 autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
568 // Only remember the last few forms that we've seen, both to avoid false | 566 // Only remember the last few forms that we've seen, both to avoid false |
569 // positives and to avoid wasting memory. | 567 // positives and to avoid wasting memory. |
570 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) | 568 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) |
571 autofilled_form_signatures_.pop_back(); | 569 autofilled_form_signatures_.pop_back(); |
572 | 570 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 metric_logger_->LogUserHappinessMetric( | 602 metric_logger_->LogUserHappinessMetric( |
605 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 603 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
606 } | 604 } |
607 } | 605 } |
608 } | 606 } |
609 | 607 |
610 void AutofillManager::OnHidePopup() { | 608 void AutofillManager::OnHidePopup() { |
611 if (!IsAutofillEnabled()) | 609 if (!IsAutofillEnabled()) |
612 return; | 610 return; |
613 | 611 |
614 manager_delegate_->HideAutofillPopup(); | 612 client_->HideAutofillPopup(); |
615 } | 613 } |
616 | 614 |
617 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | 615 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
618 const AutofillDataModel* data_model = NULL; | 616 const AutofillDataModel* data_model = NULL; |
619 size_t variant = 0; | 617 size_t variant = 0; |
620 bool unused_is_credit_card = false; | 618 bool unused_is_credit_card = false; |
621 if (!GetProfileOrCreditCard( | 619 if (!GetProfileOrCreditCard( |
622 unique_id, &data_model, &variant, &unused_is_credit_card)) { | 620 unique_id, &data_model, &variant, &unused_is_credit_card)) { |
623 NOTREACHED(); | 621 NOTREACHED(); |
624 return; | 622 return; |
(...skipping 10 matching lines...) Expand all Loading... |
635 | 633 |
636 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, | 634 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, |
637 const base::string16& value) { | 635 const base::string16& value) { |
638 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); | 636 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); |
639 } | 637 } |
640 | 638 |
641 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { | 639 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { |
642 return form_structures_.get(); | 640 return form_structures_.get(); |
643 } | 641 } |
644 | 642 |
645 void AutofillManager::SetTestDelegate( | 643 void AutofillManager::SetTestDelegate(AutofillManagerTestDelegate* delegate) { |
646 autofill::AutofillManagerTestDelegate* delegate) { | |
647 test_delegate_ = delegate; | 644 test_delegate_ = delegate; |
648 } | 645 } |
649 | 646 |
650 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, | 647 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, |
651 const std::vector<base::string16>& labels) { | 648 const std::vector<base::string16>& labels) { |
652 if (!IsValidString16Vector(values) || | 649 if (!IsValidString16Vector(values) || |
653 !IsValidString16Vector(labels) || | 650 !IsValidString16Vector(labels) || |
654 values.size() != labels.size()) | 651 values.size() != labels.size()) |
655 return; | 652 return; |
656 | 653 |
657 external_delegate_->SetCurrentDataListValues(values, labels); | 654 external_delegate_->SetCurrentDataListValues(values, labels); |
658 } | 655 } |
659 | 656 |
660 void AutofillManager::OnLoadedServerPredictions( | 657 void AutofillManager::OnLoadedServerPredictions( |
661 const std::string& response_xml) { | 658 const std::string& response_xml) { |
662 // Parse and store the server predictions. | 659 // Parse and store the server predictions. |
663 FormStructure::ParseQueryResponse(response_xml, | 660 FormStructure::ParseQueryResponse(response_xml, |
664 form_structures_.get(), | 661 form_structures_.get(), |
665 *metric_logger_); | 662 *metric_logger_); |
666 | 663 |
667 // Forward form structures to the password generation manager to detect | 664 // Forward form structures to the password generation manager to detect |
668 // account creation forms. | 665 // account creation forms. |
669 manager_delegate_->DetectAccountCreationForms(form_structures_.get()); | 666 client_->DetectAccountCreationForms(form_structures_.get()); |
670 | 667 |
671 // If the corresponding flag is set, annotate forms with the predicted types. | 668 // If the corresponding flag is set, annotate forms with the predicted types. |
672 driver_->SendAutofillTypePredictionsToRenderer(form_structures_.get()); | 669 driver_->SendAutofillTypePredictionsToRenderer(form_structures_.get()); |
673 } | 670 } |
674 | 671 |
675 void AutofillManager::OnDidEndTextFieldEditing() { | 672 void AutofillManager::OnDidEndTextFieldEditing() { |
676 external_delegate_->DidEndTextFieldEditing(); | 673 external_delegate_->DidEndTextFieldEditing(); |
677 } | 674 } |
678 | 675 |
679 bool AutofillManager::IsAutofillEnabled() const { | 676 bool AutofillManager::IsAutofillEnabled() const { |
680 return manager_delegate_->GetPrefs()->GetBoolean(prefs::kAutofillEnabled); | 677 return client_->GetPrefs()->GetBoolean(prefs::kAutofillEnabled); |
681 } | 678 } |
682 | 679 |
683 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 680 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
684 scoped_ptr<CreditCard> imported_credit_card; | 681 scoped_ptr<CreditCard> imported_credit_card; |
685 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) | 682 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) |
686 return; | 683 return; |
687 | 684 |
688 // If credit card information was submitted, we need to confirm whether to | 685 // If credit card information was submitted, we need to confirm whether to |
689 // save it. | 686 // save it. |
690 if (imported_credit_card) { | 687 if (imported_credit_card) { |
691 manager_delegate_->ConfirmSaveCreditCard( | 688 client_->ConfirmSaveCreditCard( |
692 *metric_logger_, | 689 *metric_logger_, |
693 base::Bind( | 690 base::Bind( |
694 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), | 691 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), |
695 base::Unretained(personal_data_), *imported_credit_card)); | 692 base::Unretained(personal_data_), |
| 693 *imported_credit_card)); |
696 } | 694 } |
697 } | 695 } |
698 | 696 |
699 // Note that |submitted_form| is passed as a pointer rather than as a reference | 697 // Note that |submitted_form| is passed as a pointer rather than as a reference |
700 // so that we can get memory management right across threads. Note also that we | 698 // so that we can get memory management right across threads. Note also that we |
701 // explicitly pass in all the time stamps of interest, as the cached ones might | 699 // explicitly pass in all the time stamps of interest, as the cached ones might |
702 // get reset before this method executes. | 700 // get reset before this method executes. |
703 void AutofillManager::UploadFormDataAsyncCallback( | 701 void AutofillManager::UploadFormDataAsyncCallback( |
704 const FormStructure* submitted_form, | 702 const FormStructure* submitted_form, |
705 const TimeTicks& load_time, | 703 const TimeTicks& load_time, |
(...skipping 22 matching lines...) Expand all Loading... |
728 if (*it == form_signature) | 726 if (*it == form_signature) |
729 was_autofilled = true; | 727 was_autofilled = true; |
730 } | 728 } |
731 | 729 |
732 ServerFieldTypeSet non_empty_types; | 730 ServerFieldTypeSet non_empty_types; |
733 personal_data_->GetNonEmptyTypes(&non_empty_types); | 731 personal_data_->GetNonEmptyTypes(&non_empty_types); |
734 // Always add PASSWORD to |non_empty_types| so that if |submitted_form| | 732 // Always add PASSWORD to |non_empty_types| so that if |submitted_form| |
735 // contains a password field it will be uploaded to the server. If | 733 // contains a password field it will be uploaded to the server. If |
736 // |submitted_form| doesn't contain a password field, there is no side | 734 // |submitted_form| doesn't contain a password field, there is no side |
737 // effect from adding PASSWORD to |non_empty_types|. | 735 // effect from adding PASSWORD to |non_empty_types|. |
738 non_empty_types.insert(autofill::PASSWORD); | 736 non_empty_types.insert(PASSWORD); |
739 | 737 |
740 download_manager_->StartUploadRequest(submitted_form, was_autofilled, | 738 download_manager_->StartUploadRequest(submitted_form, was_autofilled, |
741 non_empty_types); | 739 non_empty_types); |
742 } | 740 } |
743 | 741 |
744 bool AutofillManager::UploadPasswordGenerationForm(const FormData& form) { | 742 bool AutofillManager::UploadPasswordGenerationForm(const FormData& form) { |
745 FormStructure form_structure(form); | 743 FormStructure form_structure(form); |
746 | 744 |
747 if (!ShouldUploadForm(form_structure)) | 745 if (!ShouldUploadForm(form_structure)) |
748 return false; | 746 return false; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 did_show_suggestions_ = false; | 791 did_show_suggestions_ = false; |
794 user_did_type_ = false; | 792 user_did_type_ = false; |
795 user_did_autofill_ = false; | 793 user_did_autofill_ = false; |
796 user_did_edit_autofilled_field_ = false; | 794 user_did_edit_autofilled_field_ = false; |
797 forms_loaded_timestamps_.clear(); | 795 forms_loaded_timestamps_.clear(); |
798 initial_interaction_timestamp_ = TimeTicks(); | 796 initial_interaction_timestamp_ = TimeTicks(); |
799 external_delegate_->Reset(); | 797 external_delegate_->Reset(); |
800 } | 798 } |
801 | 799 |
802 AutofillManager::AutofillManager(AutofillDriver* driver, | 800 AutofillManager::AutofillManager(AutofillDriver* driver, |
803 autofill::AutofillManagerDelegate* delegate, | 801 AutofillClient* client, |
804 PersonalDataManager* personal_data) | 802 PersonalDataManager* personal_data) |
805 : driver_(driver), | 803 : driver_(driver), |
806 manager_delegate_(delegate), | 804 client_(client), |
807 app_locale_("en-US"), | 805 app_locale_("en-US"), |
808 personal_data_(personal_data), | 806 personal_data_(personal_data), |
809 autocomplete_history_manager_( | 807 autocomplete_history_manager_( |
810 new AutocompleteHistoryManager(driver, delegate)), | 808 new AutocompleteHistoryManager(driver, client)), |
811 metric_logger_(new AutofillMetrics), | 809 metric_logger_(new AutofillMetrics), |
812 has_logged_autofill_enabled_(false), | 810 has_logged_autofill_enabled_(false), |
813 has_logged_address_suggestions_count_(false), | 811 has_logged_address_suggestions_count_(false), |
814 did_show_suggestions_(false), | 812 did_show_suggestions_(false), |
815 user_did_type_(false), | 813 user_did_type_(false), |
816 user_did_autofill_(false), | 814 user_did_autofill_(false), |
817 user_did_edit_autofilled_field_(false), | 815 user_did_edit_autofilled_field_(false), |
818 external_delegate_(NULL), | 816 external_delegate_(NULL), |
819 test_delegate_(NULL), | 817 test_delegate_(NULL), |
820 weak_ptr_factory_(this) { | 818 weak_ptr_factory_(this) { |
821 DCHECK(driver_); | 819 DCHECK(driver_); |
822 DCHECK(manager_delegate_); | 820 DCHECK(client_); |
823 } | 821 } |
824 | 822 |
825 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { | 823 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { |
826 metric_logger_.reset(metric_logger); | 824 metric_logger_.reset(metric_logger); |
827 } | 825 } |
828 | 826 |
829 bool AutofillManager::RefreshDataModels() const { | 827 bool AutofillManager::RefreshDataModels() const { |
830 if (!IsAutofillEnabled()) | 828 if (!IsAutofillEnabled()) |
831 return false; | 829 return false; |
832 | 830 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return false; | 1136 return false; |
1139 | 1137 |
1140 // Disregard forms that we wouldn't ever autofill in the first place. | 1138 // Disregard forms that we wouldn't ever autofill in the first place. |
1141 if (!form.ShouldBeParsed(true)) | 1139 if (!form.ShouldBeParsed(true)) |
1142 return false; | 1140 return false; |
1143 | 1141 |
1144 return true; | 1142 return true; |
1145 } | 1143 } |
1146 | 1144 |
1147 } // namespace autofill | 1145 } // namespace autofill |
OLD | NEW |