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

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

Issue 11539003: Pop up requestAutocomplete UI when autofill server hints chrome client that it is in a multipage au… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed Albert's comments Created 7 years, 11 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
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 21 matching lines...) Expand all
32 #include "chrome/browser/autofill/autofill_metrics.h" 32 #include "chrome/browser/autofill/autofill_metrics.h"
33 #include "chrome/browser/autofill/autofill_profile.h" 33 #include "chrome/browser/autofill/autofill_profile.h"
34 #include "chrome/browser/autofill/autofill_type.h" 34 #include "chrome/browser/autofill/autofill_type.h"
35 #include "chrome/browser/autofill/credit_card.h" 35 #include "chrome/browser/autofill/credit_card.h"
36 #include "chrome/browser/autofill/form_structure.h" 36 #include "chrome/browser/autofill/form_structure.h"
37 #include "chrome/browser/autofill/password_generator.h" 37 #include "chrome/browser/autofill/password_generator.h"
38 #include "chrome/browser/autofill/personal_data_manager.h" 38 #include "chrome/browser/autofill/personal_data_manager.h"
39 #include "chrome/browser/autofill/personal_data_manager_factory.h" 39 #include "chrome/browser/autofill/personal_data_manager_factory.h"
40 #include "chrome/browser/autofill/phone_number.h" 40 #include "chrome/browser/autofill/phone_number.h"
41 #include "chrome/browser/autofill/phone_number_i18n.h" 41 #include "chrome/browser/autofill/phone_number_i18n.h"
42 #include "chrome/browser/autofill/autofill_flow_infobar_delegate.h"
42 #include "chrome/browser/prefs/pref_service.h" 43 #include "chrome/browser/prefs/pref_service.h"
43 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 44 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
44 #include "chrome/common/autofill_messages.h" 45 #include "chrome/common/autofill_messages.h"
45 #include "chrome/common/chrome_notification_types.h" 46 #include "chrome/common/chrome_notification_types.h"
46 #include "chrome/common/chrome_switches.h" 47 #include "chrome/common/chrome_switches.h"
47 #include "chrome/common/form_data.h" 48 #include "chrome/common/form_data.h"
48 #include "chrome/common/form_data_predictions.h" 49 #include "chrome/common/form_data_predictions.h"
49 #include "chrome/common/form_field_data.h" 50 #include "chrome/common/form_field_data.h"
50 #include "chrome/common/password_form_fill_data.h" 51 #include "chrome/common/password_form_fill_data.h"
51 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids); 569 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids);
569 570
570 // The first time we show suggestions on this page, log the number of 571 // The first time we show suggestions on this page, log the number of
571 // suggestions shown. 572 // suggestions shown.
572 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 573 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
573 metric_logger_->LogAddressSuggestionsCount(values.size()); 574 metric_logger_->LogAddressSuggestionsCount(values.size());
574 has_logged_address_suggestions_count_ = true; 575 has_logged_address_suggestions_count_ = true;
575 } 576 }
576 } 577 }
577 } 578 }
579
580 // If form is known to be at the start of the autofillable flow (i.e, when
581 // Autofill server said so), then trigger payments UI while also returning
582 // standard autofill suggestions to renderer process.
583 if (form_structure->IsStartOfAutofillableFlow()) {
584 AutofillFlowInfoBarDelegate::Create(
585 manager_delegate_->GetInfoBarService(),
586 this, metric_logger_.get(),
587 form.origin,
588 form.ssl_status);
589 }
578 } 590 }
579 591
580 // Add the results from AutoComplete. They come back asynchronously, so we 592 // Add the results from AutoComplete. They come back asynchronously, so we
581 // hand off what we generated and they will send the results back to the 593 // hand off what we generated and they will send the results back to the
582 // renderer. 594 // renderer.
583 autocomplete_history_manager_.OnGetAutocompleteSuggestions( 595 autocomplete_history_manager_.OnGetAutocompleteSuggestions(
584 query_id, field.name, field.value, values, labels, icons, unique_ids); 596 query_id, field.name, field.value, values, labels, icons, unique_ids);
585 } 597 }
586 598
587 void AutofillManager::OnFillAutofillFormData(int query_id, 599 void AutofillManager::OnFillAutofillFormData(int query_id,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return; 754 return;
743 755
744 personal_data_->RemoveByGUID(form_group->GetGUID()); 756 personal_data_->RemoveByGUID(form_group->GetGUID());
745 } 757 }
746 758
747 void AutofillManager::RemoveAutocompleteEntry(const string16& name, 759 void AutofillManager::RemoveAutocompleteEntry(const string16& name,
748 const string16& value) { 760 const string16& value) {
749 autocomplete_history_manager_.OnRemoveAutocompleteEntry(name, value); 761 autocomplete_history_manager_.OnRemoveAutocompleteEntry(name, value);
750 } 762 }
751 763
764 void AutofillManager::ShowAutofillFlowDialog(
765 const FormData& form, const GURL& frame_url,
766 const content::SSLStatus& ssl_status) {
767 base::Callback<void(const FormStructure*)> callback =
768 base::Bind(&AutofillManager::ReturnAutofillFlowData, this);
769 autofill::AutofillDialogController* controller =
770 new autofill::AutofillDialogController(web_contents(),
771 form,
772 frame_url,
773 ssl_status,
774 callback);
775 controller->Show();
776 }
777
752 void AutofillManager::OnAddPasswordFormMapping( 778 void AutofillManager::OnAddPasswordFormMapping(
753 const FormFieldData& form, 779 const FormFieldData& form,
754 const PasswordFormFillData& fill_data) { 780 const PasswordFormFillData& fill_data) {
755 if (external_delegate_) 781 if (external_delegate_)
756 external_delegate_->AddPasswordFormMapping(form, fill_data); 782 external_delegate_->AddPasswordFormMapping(form, fill_data);
757 } 783 }
758 784
759 void AutofillManager::OnShowPasswordSuggestions( 785 void AutofillManager::OnShowPasswordSuggestions(
760 const FormFieldData& field, 786 const FormFieldData& field,
761 const gfx::Rect& bounds, 787 const gfx::Rect& bounds,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 } 823 }
798 824
799 void AutofillManager::ReturnAutocompleteError() { 825 void AutofillManager::ReturnAutocompleteError() {
800 RenderViewHost* host = web_contents()->GetRenderViewHost(); 826 RenderViewHost* host = web_contents()->GetRenderViewHost();
801 if (!host) 827 if (!host)
802 return; 828 return;
803 829
804 host->Send(new AutofillMsg_RequestAutocompleteError(host->GetRoutingID())); 830 host->Send(new AutofillMsg_RequestAutocompleteError(host->GetRoutingID()));
805 } 831 }
806 832
833 void AutofillManager::ReturnAutofillFlowData(const FormStructure* result) {
834 // TODO(ramankk): Parse the response FormStructure.
835 }
836
807 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { 837 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) {
808 // web_contents() will be NULL when the interactive autocomplete is closed due 838 // web_contents() will be NULL when the interactive autocomplete is closed due
809 // to a tab or browser window closing. 839 // to a tab or browser window closing.
810 if (!web_contents()) 840 if (!web_contents())
811 return; 841 return;
812 842
813 RenderViewHost* host = web_contents()->GetRenderViewHost(); 843 RenderViewHost* host = web_contents()->GetRenderViewHost();
814 if (!host) 844 if (!host)
815 return; 845 return;
816 846
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 *profile_guid = IDToGUID(profile_id); 1307 *profile_guid = IDToGUID(profile_id);
1278 } 1308 }
1279 1309
1280 void AutofillManager::UpdateInitialInteractionTimestamp( 1310 void AutofillManager::UpdateInitialInteractionTimestamp(
1281 const TimeTicks& interaction_timestamp) { 1311 const TimeTicks& interaction_timestamp) {
1282 if (initial_interaction_timestamp_.is_null() || 1312 if (initial_interaction_timestamp_.is_null() ||
1283 interaction_timestamp < initial_interaction_timestamp_) { 1313 interaction_timestamp < initial_interaction_timestamp_) {
1284 initial_interaction_timestamp_ = interaction_timestamp; 1314 initial_interaction_timestamp_ = interaction_timestamp;
1285 } 1315 }
1286 } 1316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698