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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 FillCreditCardFormField(*credit_card, field_type, &(*iter)); 578 FillCreditCardFormField(*credit_card, field_type, &(*iter));
579 } 579 }
580 580
581 // Mark the cached field as autofilled, so that we can detect when a 581 // Mark the cached field as autofilled, so that we can detect when a
582 // user edits an autofilled field (for metrics). 582 // user edits an autofilled field (for metrics).
583 autofill_field->is_autofilled = true; 583 autofill_field->is_autofilled = true;
584 break; 584 break;
585 } 585 }
586 } 586 }
587 587
588 host->Send(new AutofillMsg_FormDataFilled(host->routing_id(), query_id, 588 host->Send(new AutofillMsg_FormDataFilled(host->GetRoutingID(), query_id,
589 result)); 589 result));
590 return; 590 return;
591 } 591 }
592 592
593 // Cache the field type for the field from which the user initiated autofill. 593 // Cache the field type for the field from which the user initiated autofill.
594 FieldTypeGroup initiating_group_type = 594 FieldTypeGroup initiating_group_type =
595 AutofillType(autofill_field->type()).group(); 595 AutofillType(autofill_field->type()).group();
596 DCHECK_EQ(form_structure->field_count(), form.fields.size()); 596 DCHECK_EQ(form_structure->field_count(), form.fields.size());
597 for (size_t i = 0; i < form_structure->field_count(); ++i) { 597 for (size_t i = 0; i < form_structure->field_count(); ++i) {
598 if (form_structure->field(i)->section() != autofill_field->section()) 598 if (form_structure->field(i)->section() != autofill_field->section())
(...skipping 29 matching lines...) Expand all
628 } 628 }
629 } 629 }
630 630
631 autofilled_form_signatures_.push_front(form_structure->FormSignature()); 631 autofilled_form_signatures_.push_front(form_structure->FormSignature());
632 // Only remember the last few forms that we've seen, both to avoid false 632 // Only remember the last few forms that we've seen, both to avoid false
633 // positives and to avoid wasting memory. 633 // positives and to avoid wasting memory.
634 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) 634 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember)
635 autofilled_form_signatures_.pop_back(); 635 autofilled_form_signatures_.pop_back();
636 636
637 host->Send(new AutofillMsg_FormDataFilled( 637 host->Send(new AutofillMsg_FormDataFilled(
638 host->routing_id(), query_id, result)); 638 host->GetRoutingID(), query_id, result));
639 } 639 }
640 640
641 void AutofillManager::OnShowAutofillDialog() { 641 void AutofillManager::OnShowAutofillDialog() {
642 Browser* browser = BrowserList::GetLastActiveWithProfile( 642 Browser* browser = BrowserList::GetLastActiveWithProfile(
643 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); 643 Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
644 if (browser) 644 if (browser)
645 browser->ShowOptionsTab(chrome::kAutofillSubPage); 645 browser->ShowOptionsTab(chrome::kAutofillSubPage);
646 } 646 }
647 647
648 void AutofillManager::OnDidPreviewAutofillFormData() { 648 void AutofillManager::OnDidPreviewAutofillFormData() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 if (!CommandLine::ForCurrentProcess()->HasSwitch( 717 if (!CommandLine::ForCurrentProcess()->HasSwitch(
718 switches::kShowAutofillTypePredictions)) 718 switches::kShowAutofillTypePredictions))
719 return; 719 return;
720 720
721 RenderViewHost* host = web_contents()->GetRenderViewHost(); 721 RenderViewHost* host = web_contents()->GetRenderViewHost();
722 if (!host) 722 if (!host)
723 return; 723 return;
724 724
725 std::vector<FormDataPredictions> type_predictions; 725 std::vector<FormDataPredictions> type_predictions;
726 FormStructure::GetFieldTypePredictions(forms, &type_predictions); 726 FormStructure::GetFieldTypePredictions(forms, &type_predictions);
727 host->Send(new AutofillMsg_FieldTypePredictionsAvailable(host->routing_id(), 727 host->Send(
728 type_predictions)); 728 new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(),
729 type_predictions));
729 } 730 }
730 731
731 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { 732 void AutofillManager::ImportFormData(const FormStructure& submitted_form) {
732 const CreditCard* imported_credit_card; 733 const CreditCard* imported_credit_card;
733 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) 734 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card))
734 return; 735 return;
735 736
736 // If credit card information was submitted, show an infobar to offer to save 737 // If credit card information was submitted, show an infobar to offer to save
737 // it. 738 // it.
738 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card); 739 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 *profile_guid = IDToGUID(profile_id); 1300 *profile_guid = IDToGUID(profile_id);
1300 } 1301 }
1301 1302
1302 void AutofillManager::UpdateInitialInteractionTimestamp( 1303 void AutofillManager::UpdateInitialInteractionTimestamp(
1303 const TimeTicks& interaction_timestamp) { 1304 const TimeTicks& interaction_timestamp) {
1304 if (initial_interaction_timestamp_.is_null() || 1305 if (initial_interaction_timestamp_.is_null() ||
1305 interaction_timestamp < initial_interaction_timestamp_) { 1306 interaction_timestamp < initial_interaction_timestamp_) {
1306 initial_interaction_timestamp_ = interaction_timestamp; 1307 initial_interaction_timestamp_ = interaction_timestamp;
1307 } 1308 }
1308 } 1309 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_external_delegate.cc ('k') | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698