| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/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> |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } // namespace | 220 } // namespace |
| 221 | 221 |
| 222 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) | 222 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) |
| 223 : TabContentsObserver(tab_contents->tab_contents()), | 223 : TabContentsObserver(tab_contents->tab_contents()), |
| 224 tab_contents_wrapper_(tab_contents), | 224 tab_contents_wrapper_(tab_contents), |
| 225 personal_data_(NULL), | 225 personal_data_(NULL), |
| 226 download_manager_(tab_contents->profile()), | 226 download_manager_(tab_contents->profile()), |
| 227 disable_download_manager_requests_(false), | 227 disable_download_manager_requests_(false), |
| 228 metric_logger_(new AutofillMetrics), | 228 metric_logger_(new AutofillMetrics), |
| 229 has_logged_autofill_enabled_(false), | 229 has_logged_autofill_enabled_(false), |
| 230 has_logged_address_suggestions_count_(false) { | 230 has_logged_address_suggestions_count_(false), |
| 231 did_show_suggestions_(false), |
| 232 user_did_type_(false), |
| 233 user_did_autofill_(false), |
| 234 user_did_edit_autofilled_field_(false) { |
| 231 DCHECK(tab_contents); | 235 DCHECK(tab_contents); |
| 232 | 236 |
| 233 // |personal_data_| is NULL when using TestTabContents. | 237 // |personal_data_| is NULL when using TestTabContents. |
| 234 personal_data_ = | 238 personal_data_ = |
| 235 tab_contents->profile()->GetOriginalProfile()->GetPersonalDataManager(); | 239 tab_contents->profile()->GetOriginalProfile()->GetPersonalDataManager(); |
| 236 download_manager_.SetObserver(this); | 240 download_manager_.SetObserver(this); |
| 237 } | 241 } |
| 238 | 242 |
| 239 AutofillManager::~AutofillManager() { | 243 AutofillManager::~AutofillManager() { |
| 240 download_manager_.SetObserver(NULL); | 244 download_manager_.SetObserver(NULL); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 271 const content::LoadCommittedDetails& details, | 275 const content::LoadCommittedDetails& details, |
| 272 const ViewHostMsg_FrameNavigate_Params& params) { | 276 const ViewHostMsg_FrameNavigate_Params& params) { |
| 273 Reset(); | 277 Reset(); |
| 274 } | 278 } |
| 275 | 279 |
| 276 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { | 280 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { |
| 277 bool handled = true; | 281 bool handled = true; |
| 278 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) | 282 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) |
| 279 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) | 283 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) |
| 280 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) | 284 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) |
| 285 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange, |
| 286 OnTextFieldDidChange) |
| 281 IPC_MESSAGE_HANDLER(AutofillHostMsg_QueryFormFieldAutofill, | 287 IPC_MESSAGE_HANDLER(AutofillHostMsg_QueryFormFieldAutofill, |
| 282 OnQueryFormFieldAutofill) | 288 OnQueryFormFieldAutofill) |
| 283 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, | 289 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, |
| 284 OnShowAutofillDialog) | 290 OnShowAutofillDialog) |
| 285 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, | 291 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, |
| 286 OnFillAutofillFormData) | 292 OnFillAutofillFormData) |
| 293 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, |
| 294 OnDidPreviewAutofillFormData) |
| 287 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, | 295 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, |
| 288 OnDidFillAutofillFormData) | 296 OnDidFillAutofillFormData) |
| 289 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, | 297 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, |
| 290 OnDidShowAutofillSuggestions) | 298 OnDidShowAutofillSuggestions) |
| 291 IPC_MESSAGE_UNHANDLED(handled = false) | 299 IPC_MESSAGE_UNHANDLED(handled = false) |
| 292 IPC_END_MESSAGE_MAP() | 300 IPC_END_MESSAGE_MAP() |
| 293 | 301 |
| 294 return handled; | 302 return handled; |
| 295 } | 303 } |
| 296 | 304 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); | 353 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); |
| 346 has_logged_autofill_enabled_ = true; | 354 has_logged_autofill_enabled_ = true; |
| 347 } | 355 } |
| 348 | 356 |
| 349 if (!enabled) | 357 if (!enabled) |
| 350 return; | 358 return; |
| 351 | 359 |
| 352 ParseForms(forms); | 360 ParseForms(forms); |
| 353 } | 361 } |
| 354 | 362 |
| 363 void AutofillManager::OnTextFieldDidChange(const FormData& form, |
| 364 const FormField& field) { |
| 365 FormStructure* form_structure = NULL; |
| 366 AutofillField* autofill_field = NULL; |
| 367 if (!FindCachedFormAndField(form, field, &form_structure, &autofill_field)) |
| 368 return; |
| 369 |
| 370 if (!user_did_type_) { |
| 371 user_did_type_ = true; |
| 372 metric_logger_->LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE); |
| 373 } |
| 374 |
| 375 if (autofill_field->is_autofilled) { |
| 376 autofill_field->is_autofilled = false; |
| 377 metric_logger_->LogUserHappinessMetric( |
| 378 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD); |
| 379 |
| 380 if (!user_did_edit_autofilled_field_) { |
| 381 user_did_edit_autofilled_field_ = true; |
| 382 metric_logger_->LogUserHappinessMetric( |
| 383 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); |
| 384 } |
| 385 } |
| 386 } |
| 387 |
| 355 void AutofillManager::OnQueryFormFieldAutofill( | 388 void AutofillManager::OnQueryFormFieldAutofill( |
| 356 int query_id, | 389 int query_id, |
| 357 const webkit_glue::FormData& form, | 390 const webkit_glue::FormData& form, |
| 358 const webkit_glue::FormField& field) { | 391 const webkit_glue::FormField& field) { |
| 359 std::vector<string16> values; | 392 std::vector<string16> values; |
| 360 std::vector<string16> labels; | 393 std::vector<string16> labels; |
| 361 std::vector<string16> icons; | 394 std::vector<string16> icons; |
| 362 std::vector<int> unique_ids; | 395 std::vector<int> unique_ids; |
| 363 | 396 |
| 364 RenderViewHost* host = NULL; | 397 RenderViewHost* host = NULL; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 if (profile) { | 534 if (profile) { |
| 502 DCHECK_NE(AutofillType::CREDIT_CARD, | 535 DCHECK_NE(AutofillType::CREDIT_CARD, |
| 503 AutofillType(field_type).group()); | 536 AutofillType(field_type).group()); |
| 504 FillFormField(*profile, *autofill_field, profile_guid.second, | 537 FillFormField(*profile, *autofill_field, profile_guid.second, |
| 505 &(*iter)); | 538 &(*iter)); |
| 506 } else { | 539 } else { |
| 507 DCHECK_EQ(AutofillType::CREDIT_CARD, | 540 DCHECK_EQ(AutofillType::CREDIT_CARD, |
| 508 AutofillType(field_type).group()); | 541 AutofillType(field_type).group()); |
| 509 FillCreditCardFormField(*credit_card, field_type, &(*iter)); | 542 FillCreditCardFormField(*credit_card, field_type, &(*iter)); |
| 510 } | 543 } |
| 544 |
| 545 // Mark the cached field as autofilled, so that we can detect when a |
| 546 // user edits an autofilled field (for metrics). |
| 547 autofill_field->is_autofilled = true; |
| 511 break; | 548 break; |
| 512 } | 549 } |
| 513 } | 550 } |
| 514 | 551 |
| 515 host->Send(new AutofillMsg_FormDataFilled(host->routing_id(), query_id, | 552 host->Send(new AutofillMsg_FormDataFilled(host->routing_id(), query_id, |
| 516 result)); | 553 result)); |
| 517 return; | 554 return; |
| 518 } | 555 } |
| 519 | 556 |
| 520 // The list of fields in |form_structure| and |result.fields| often match | 557 // The list of fields in |form_structure| and |result.fields| often match |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (result.fields[j] == field) { | 589 if (result.fields[j] == field) { |
| 553 FillFormField(*profile, *cached_field, profile_guid.second, | 590 FillFormField(*profile, *cached_field, profile_guid.second, |
| 554 &result.fields[j]); | 591 &result.fields[j]); |
| 555 } else { | 592 } else { |
| 556 FillFormField(*profile, *cached_field, 0, &result.fields[j]); | 593 FillFormField(*profile, *cached_field, 0, &result.fields[j]); |
| 557 } | 594 } |
| 558 } else { | 595 } else { |
| 559 DCHECK_EQ(AutofillType::CREDIT_CARD, field_group_type); | 596 DCHECK_EQ(AutofillType::CREDIT_CARD, field_group_type); |
| 560 FillCreditCardFormField(*credit_card, field_type, &result.fields[j]); | 597 FillCreditCardFormField(*credit_card, field_type, &result.fields[j]); |
| 561 } | 598 } |
| 599 |
| 600 // Mark the cached field as autofilled, so that we can detect when a user |
| 601 // edits an autofilled field (for metrics). |
| 602 form_structure->field(k)->is_autofilled = true; |
| 562 } | 603 } |
| 563 | 604 |
| 564 // We found a matching field in the |form_structure|, so on the next | 605 // We found a matching field in the |form_structure|, so on the next |
| 565 // iteration we should proceed to the next |form_structure| field. | 606 // iteration we should proceed to the next |form_structure| field. |
| 566 ++i; | 607 ++i; |
| 567 } | 608 } |
| 568 | 609 |
| 569 autofilled_form_signatures_.push_front(form_structure->FormSignature()); | 610 autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
| 570 // Only remember the last few forms that we've seen, both to avoid false | 611 // Only remember the last few forms that we've seen, both to avoid false |
| 571 // positives and to avoid wasting memory. | 612 // positives and to avoid wasting memory. |
| 572 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) | 613 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) |
| 573 autofilled_form_signatures_.pop_back(); | 614 autofilled_form_signatures_.pop_back(); |
| 574 | 615 |
| 575 host->Send(new AutofillMsg_FormDataFilled( | 616 host->Send(new AutofillMsg_FormDataFilled( |
| 576 host->routing_id(), query_id, result)); | 617 host->routing_id(), query_id, result)); |
| 577 } | 618 } |
| 578 | 619 |
| 579 void AutofillManager::OnShowAutofillDialog() { | 620 void AutofillManager::OnShowAutofillDialog() { |
| 580 Browser* browser = BrowserList::GetLastActiveWithProfile( | 621 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 581 Profile::FromBrowserContext(tab_contents()->browser_context())); | 622 Profile::FromBrowserContext(tab_contents()->browser_context())); |
| 582 if (browser) | 623 if (browser) |
| 583 browser->ShowOptionsTab(chrome::kAutofillSubPage); | 624 browser->ShowOptionsTab(chrome::kAutofillSubPage); |
| 584 } | 625 } |
| 585 | 626 |
| 627 void AutofillManager::OnDidPreviewAutofillFormData() { |
| 628 NotificationService::current()->Notify( |
| 629 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| 630 Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 631 NotificationService::NoDetails()); |
| 632 } |
| 633 |
| 634 |
| 586 void AutofillManager::OnDidFillAutofillFormData() { | 635 void AutofillManager::OnDidFillAutofillFormData() { |
| 587 NotificationService::current()->Notify( | 636 NotificationService::current()->Notify( |
| 588 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, | 637 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| 589 Source<RenderViewHost>(tab_contents()->render_view_host()), | 638 Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 590 NotificationService::NoDetails()); | 639 NotificationService::NoDetails()); |
| 640 |
| 641 metric_logger_->LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL); |
| 642 if (!user_did_autofill_) { |
| 643 user_did_autofill_ = true; |
| 644 metric_logger_->LogUserHappinessMetric( |
| 645 AutofillMetrics::USER_DID_AUTOFILL_ONCE); |
| 646 } |
| 591 } | 647 } |
| 592 | 648 |
| 593 void AutofillManager::OnDidShowAutofillSuggestions() { | 649 void AutofillManager::OnDidShowAutofillSuggestions(bool is_new_popup) { |
| 594 NotificationService::current()->Notify( | 650 NotificationService::current()->Notify( |
| 595 chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, | 651 chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, |
| 596 Source<RenderViewHost>(tab_contents()->render_view_host()), | 652 Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 597 NotificationService::NoDetails()); | 653 NotificationService::NoDetails()); |
| 654 |
| 655 if (is_new_popup) { |
| 656 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); |
| 657 |
| 658 if (!did_show_suggestions_) { |
| 659 did_show_suggestions_ = true; |
| 660 metric_logger_->LogUserHappinessMetric( |
| 661 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
| 662 } |
| 663 } |
| 598 } | 664 } |
| 599 | 665 |
| 600 void AutofillManager::OnLoadedServerPredictions( | 666 void AutofillManager::OnLoadedServerPredictions( |
| 601 const std::string& response_xml) { | 667 const std::string& response_xml) { |
| 602 // Parse and store the server predictions. | 668 // Parse and store the server predictions. |
| 603 FormStructure::ParseQueryResponse(response_xml, | 669 FormStructure::ParseQueryResponse(response_xml, |
| 604 form_structures_.get(), | 670 form_structures_.get(), |
| 605 *metric_logger_); | 671 *metric_logger_); |
| 606 | 672 |
| 607 // If the corresponding flag is set, annotate forms with the predicted types. | 673 // If the corresponding flag is set, annotate forms with the predicted types. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); | 705 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); |
| 640 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 706 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); |
| 641 std::vector<FormGroup*> stored_data; | 707 std::vector<FormGroup*> stored_data; |
| 642 stored_data.insert(stored_data.end(), profiles.begin(), profiles.end()); | 708 stored_data.insert(stored_data.end(), profiles.begin(), profiles.end()); |
| 643 stored_data.insert(stored_data.end(), credit_cards.begin(), | 709 stored_data.insert(stored_data.end(), credit_cards.begin(), |
| 644 credit_cards.end()); | 710 credit_cards.end()); |
| 645 | 711 |
| 646 // For each field in the |submitted_form|, extract the value. Then for each | 712 // For each field in the |submitted_form|, extract the value. Then for each |
| 647 // profile or credit card, identify any stored types that match the value. | 713 // profile or credit card, identify any stored types that match the value. |
| 648 for (size_t i = 0; i < submitted_form->field_count(); i++) { | 714 for (size_t i = 0; i < submitted_form->field_count(); i++) { |
| 649 const AutofillField* field = submitted_form->field(i); | 715 AutofillField* field = submitted_form->field(i); |
| 650 string16 value = CollapseWhitespace(field->value, false); | 716 string16 value = CollapseWhitespace(field->value, false); |
| 651 FieldTypeSet matching_types; | 717 FieldTypeSet matching_types; |
| 652 for (std::vector<FormGroup*>::const_iterator it = stored_data.begin(); | 718 for (std::vector<FormGroup*>::const_iterator it = stored_data.begin(); |
| 653 it != stored_data.end(); ++it) { | 719 it != stored_data.end(); ++it) { |
| 654 (*it)->GetMatchingTypes(value, &matching_types); | 720 (*it)->GetMatchingTypes(value, &matching_types); |
| 655 } | 721 } |
| 656 | 722 |
| 657 if (matching_types.empty()) | 723 if (matching_types.empty()) |
| 658 matching_types.insert(UNKNOWN_TYPE); | 724 matching_types.insert(UNKNOWN_TYPE); |
| 659 | 725 |
| 660 submitted_form->set_possible_types(i, matching_types); | 726 field->set_possible_types(matching_types); |
| 661 } | 727 } |
| 662 } | 728 } |
| 663 | 729 |
| 664 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 730 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
| 665 const CreditCard* imported_credit_card; | 731 const CreditCard* imported_credit_card; |
| 666 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) | 732 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) |
| 667 return; | 733 return; |
| 668 | 734 |
| 669 // If credit card information was submitted, show an infobar to offer to save | 735 // If credit card information was submitted, show an infobar to offer to save |
| 670 // it. | 736 // it. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 697 personal_data_->GetNonEmptyTypes(&non_empty_types); | 763 personal_data_->GetNonEmptyTypes(&non_empty_types); |
| 698 | 764 |
| 699 download_manager_.StartUploadRequest(submitted_form, was_autofilled, | 765 download_manager_.StartUploadRequest(submitted_form, was_autofilled, |
| 700 non_empty_types); | 766 non_empty_types); |
| 701 } | 767 } |
| 702 | 768 |
| 703 void AutofillManager::Reset() { | 769 void AutofillManager::Reset() { |
| 704 form_structures_.reset(); | 770 form_structures_.reset(); |
| 705 has_logged_autofill_enabled_ = false; | 771 has_logged_autofill_enabled_ = false; |
| 706 has_logged_address_suggestions_count_ = false; | 772 has_logged_address_suggestions_count_ = false; |
| 773 did_show_suggestions_ = false; |
| 774 user_did_type_ = false; |
| 775 user_did_autofill_ = false; |
| 776 user_did_edit_autofilled_field_ = false; |
| 707 } | 777 } |
| 708 | 778 |
| 709 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents, | 779 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents, |
| 710 PersonalDataManager* personal_data) | 780 PersonalDataManager* personal_data) |
| 711 : TabContentsObserver(tab_contents->tab_contents()), | 781 : TabContentsObserver(tab_contents->tab_contents()), |
| 712 tab_contents_wrapper_(tab_contents), | 782 tab_contents_wrapper_(tab_contents), |
| 713 personal_data_(personal_data), | 783 personal_data_(personal_data), |
| 714 download_manager_(NULL), | 784 download_manager_(NULL), |
| 715 disable_download_manager_requests_(true), | 785 disable_download_manager_requests_(true), |
| 716 metric_logger_(new AutofillMetrics), | 786 metric_logger_(new AutofillMetrics), |
| 717 has_logged_autofill_enabled_(false), | 787 has_logged_autofill_enabled_(false), |
| 718 has_logged_address_suggestions_count_(false) { | 788 has_logged_address_suggestions_count_(false), |
| 789 did_show_suggestions_(false), |
| 790 user_did_type_(false), |
| 791 user_did_autofill_(false), |
| 792 user_did_edit_autofilled_field_(false) { |
| 719 DCHECK(tab_contents); | 793 DCHECK(tab_contents); |
| 720 } | 794 } |
| 721 | 795 |
| 722 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { | 796 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { |
| 723 metric_logger_.reset(metric_logger); | 797 metric_logger_.reset(metric_logger); |
| 724 } | 798 } |
| 725 | 799 |
| 726 bool AutofillManager::GetHost(const std::vector<AutofillProfile*>& profiles, | 800 bool AutofillManager::GetHost(const std::vector<AutofillProfile*>& profiles, |
| 727 const std::vector<CreditCard*>& credit_cards, | 801 const std::vector<CreditCard*>& credit_cards, |
| 728 RenderViewHost** host) const { | 802 RenderViewHost** host) const { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 // If none of the forms were parsed, no use querying the server. | 1080 // If none of the forms were parsed, no use querying the server. |
| 1007 if (!form_structures_.empty() && !disable_download_manager_requests_) | 1081 if (!form_structures_.empty() && !disable_download_manager_requests_) |
| 1008 download_manager_.StartQueryRequest(form_structures_, *metric_logger_); | 1082 download_manager_.StartQueryRequest(form_structures_, *metric_logger_); |
| 1009 | 1083 |
| 1010 for (std::vector<FormStructure*>::const_iterator iter = | 1084 for (std::vector<FormStructure*>::const_iterator iter = |
| 1011 non_queryable_forms.begin(); | 1085 non_queryable_forms.begin(); |
| 1012 iter != non_queryable_forms.end(); ++iter) { | 1086 iter != non_queryable_forms.end(); ++iter) { |
| 1013 form_structures_.push_back(*iter); | 1087 form_structures_.push_back(*iter); |
| 1014 } | 1088 } |
| 1015 | 1089 |
| 1090 if (!form_structures_.empty()) |
| 1091 metric_logger_->LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED); |
| 1092 |
| 1016 CheckForPopularForms(form_structures_.get(), tab_contents_wrapper_, | 1093 CheckForPopularForms(form_structures_.get(), tab_contents_wrapper_, |
| 1017 tab_contents()); | 1094 tab_contents()); |
| 1018 } | 1095 } |
| 1019 | 1096 |
| 1020 int AutofillManager::GUIDToID(const GUIDPair& guid) { | 1097 int AutofillManager::GUIDToID(const GUIDPair& guid) { |
| 1021 static int last_id = 1; | 1098 static int last_id = 1; |
| 1022 | 1099 |
| 1023 if (!guid::IsValidGUID(guid.first)) | 1100 if (!guid::IsValidGUID(guid.first)) |
| 1024 return 0; | 1101 return 0; |
| 1025 | 1102 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 void AutofillManager::UnpackGUIDs(int id, | 1143 void AutofillManager::UnpackGUIDs(int id, |
| 1067 GUIDPair* cc_guid, | 1144 GUIDPair* cc_guid, |
| 1068 GUIDPair* profile_guid) { | 1145 GUIDPair* profile_guid) { |
| 1069 int cc_id = id >> std::numeric_limits<unsigned short>::digits & | 1146 int cc_id = id >> std::numeric_limits<unsigned short>::digits & |
| 1070 std::numeric_limits<unsigned short>::max(); | 1147 std::numeric_limits<unsigned short>::max(); |
| 1071 int profile_id = id & std::numeric_limits<unsigned short>::max(); | 1148 int profile_id = id & std::numeric_limits<unsigned short>::max(); |
| 1072 | 1149 |
| 1073 *cc_guid = IDToGUID(cc_id); | 1150 *cc_guid = IDToGUID(cc_id); |
| 1074 *profile_guid = IDToGUID(profile_id); | 1151 *profile_guid = IDToGUID(profile_id); |
| 1075 } | 1152 } |
| OLD | NEW |