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

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: Resolve with AutofillDialogController refactoring. 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
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_metrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
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/public/pref_service_base.h" 18 #include "base/prefs/public/pref_service_base.h"
19 #include "base/string16.h" 19 #include "base/string16.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/supports_user_data.h" 21 #include "base/supports_user_data.h"
22 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "chrome/browser/api/infobars/infobar_service.h" 24 #include "chrome/browser/api/infobars/infobar_service.h"
25 #include "chrome/browser/api/sync/profile_sync_service_base.h" 25 #include "chrome/browser/api/sync/profile_sync_service_base.h"
26 #include "chrome/browser/autofill/autocheckout_manager.h"
27 #include "chrome/browser/autofill/autocheckout_infobar_delegate.h"
26 #include "chrome/browser/autofill/autocomplete_history_manager.h" 28 #include "chrome/browser/autofill/autocomplete_history_manager.h"
27 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" 29 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
28 #include "chrome/browser/autofill/autofill_country.h" 30 #include "chrome/browser/autofill/autofill_country.h"
29 #include "chrome/browser/autofill/autofill_external_delegate.h" 31 #include "chrome/browser/autofill/autofill_external_delegate.h"
30 #include "chrome/browser/autofill/autofill_field.h" 32 #include "chrome/browser/autofill/autofill_field.h"
31 #include "chrome/browser/autofill/autofill_manager_delegate.h" 33 #include "chrome/browser/autofill/autofill_manager_delegate.h"
32 #include "chrome/browser/autofill/autofill_metrics.h" 34 #include "chrome/browser/autofill/autofill_metrics.h"
33 #include "chrome/browser/autofill/autofill_profile.h" 35 #include "chrome/browser/autofill/autofill_profile.h"
34 #include "chrome/browser/autofill/autofill_type.h" 36 #include "chrome/browser/autofill/autofill_type.h"
35 #include "chrome/browser/autofill/credit_card.h" 37 #include "chrome/browser/autofill/credit_card.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 195 }
194 196
195 AutofillManager::AutofillManager(content::WebContents* web_contents, 197 AutofillManager::AutofillManager(content::WebContents* web_contents,
196 autofill::AutofillManagerDelegate* delegate) 198 autofill::AutofillManagerDelegate* delegate)
197 : content::WebContentsObserver(web_contents), 199 : content::WebContentsObserver(web_contents),
198 manager_delegate_(delegate), 200 manager_delegate_(delegate),
199 personal_data_(NULL), 201 personal_data_(NULL),
200 download_manager_(delegate->GetBrowserContext(), this), 202 download_manager_(delegate->GetBrowserContext(), this),
201 disable_download_manager_requests_(false), 203 disable_download_manager_requests_(false),
202 autocomplete_history_manager_(web_contents), 204 autocomplete_history_manager_(web_contents),
205 autocheckout_manager_(this),
203 metric_logger_(new AutofillMetrics), 206 metric_logger_(new AutofillMetrics),
204 has_logged_autofill_enabled_(false), 207 has_logged_autofill_enabled_(false),
205 has_logged_address_suggestions_count_(false), 208 has_logged_address_suggestions_count_(false),
206 did_show_suggestions_(false), 209 did_show_suggestions_(false),
207 user_did_type_(false), 210 user_did_type_(false),
208 user_did_autofill_(false), 211 user_did_autofill_(false),
209 user_did_edit_autofilled_field_(false), 212 user_did_edit_autofilled_field_(false),
210 password_generation_enabled_(false), 213 password_generation_enabled_(false),
211 external_delegate_(NULL) { 214 external_delegate_(NULL) {
212 // |personal_data_| is NULL when using test-enabled WebContents. 215 // |personal_data_| is NULL when using test-enabled WebContents.
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids); 571 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids);
569 572
570 // The first time we show suggestions on this page, log the number of 573 // The first time we show suggestions on this page, log the number of
571 // suggestions shown. 574 // suggestions shown.
572 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 575 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
573 metric_logger_->LogAddressSuggestionsCount(values.size()); 576 metric_logger_->LogAddressSuggestionsCount(values.size());
574 has_logged_address_suggestions_count_ = true; 577 has_logged_address_suggestions_count_ = true;
575 } 578 }
576 } 579 }
577 } 580 }
581
582 // If form is known to be at the start of the autofillable flow (i.e, when
583 // Autofill server said so), then trigger payments UI while also returning
584 // standard autofill suggestions to renderer process.
585 if (form_structure->IsStartOfAutofillableFlow()) {
586 AutocheckoutInfoBarDelegate::Create(
587 *metric_logger_,
588 form.origin,
589 form.ssl_status,
590 &autocheckout_manager_,
591 manager_delegate_->GetInfoBarService());
592 }
578 } 593 }
579 594
580 // Add the results from AutoComplete. They come back asynchronously, so we 595 // 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 596 // hand off what we generated and they will send the results back to the
582 // renderer. 597 // renderer.
583 autocomplete_history_manager_.OnGetAutocompleteSuggestions( 598 autocomplete_history_manager_.OnGetAutocompleteSuggestions(
584 query_id, field.name, field.value, values, labels, icons, unique_ids); 599 query_id, field.name, field.value, values, labels, icons, unique_ids);
585 } 600 }
586 601
587 void AutofillManager::OnFillAutofillFormData(int query_id, 602 void AutofillManager::OnFillAutofillFormData(int query_id,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return; 757 return;
743 758
744 personal_data_->RemoveByGUID(form_group->GetGUID()); 759 personal_data_->RemoveByGUID(form_group->GetGUID());
745 } 760 }
746 761
747 void AutofillManager::RemoveAutocompleteEntry(const string16& name, 762 void AutofillManager::RemoveAutocompleteEntry(const string16& name,
748 const string16& value) { 763 const string16& value) {
749 autocomplete_history_manager_.OnRemoveAutocompleteEntry(name, value); 764 autocomplete_history_manager_.OnRemoveAutocompleteEntry(name, value);
750 } 765 }
751 766
767 content::WebContents* AutofillManager::GetWebContents() {
768 return web_contents();
769 }
770
752 void AutofillManager::OnAddPasswordFormMapping( 771 void AutofillManager::OnAddPasswordFormMapping(
753 const FormFieldData& form, 772 const FormFieldData& form,
754 const PasswordFormFillData& fill_data) { 773 const PasswordFormFillData& fill_data) {
755 if (external_delegate_) 774 if (external_delegate_)
756 external_delegate_->AddPasswordFormMapping(form, fill_data); 775 external_delegate_->AddPasswordFormMapping(form, fill_data);
757 } 776 }
758 777
759 void AutofillManager::OnShowPasswordSuggestions( 778 void AutofillManager::OnShowPasswordSuggestions(
760 const FormFieldData& field, 779 const FormFieldData& field,
761 const gfx::Rect& bounds, 780 const gfx::Rect& bounds,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 959
941 AutofillManager::AutofillManager(content::WebContents* web_contents, 960 AutofillManager::AutofillManager(content::WebContents* web_contents,
942 autofill::AutofillManagerDelegate* delegate, 961 autofill::AutofillManagerDelegate* delegate,
943 PersonalDataManager* personal_data) 962 PersonalDataManager* personal_data)
944 : content::WebContentsObserver(web_contents), 963 : content::WebContentsObserver(web_contents),
945 manager_delegate_(delegate), 964 manager_delegate_(delegate),
946 personal_data_(personal_data), 965 personal_data_(personal_data),
947 download_manager_(delegate->GetBrowserContext(), this), 966 download_manager_(delegate->GetBrowserContext(), this),
948 disable_download_manager_requests_(true), 967 disable_download_manager_requests_(true),
949 autocomplete_history_manager_(web_contents), 968 autocomplete_history_manager_(web_contents),
969 autocheckout_manager_(this),
950 metric_logger_(new AutofillMetrics), 970 metric_logger_(new AutofillMetrics),
951 has_logged_autofill_enabled_(false), 971 has_logged_autofill_enabled_(false),
952 has_logged_address_suggestions_count_(false), 972 has_logged_address_suggestions_count_(false),
953 did_show_suggestions_(false), 973 did_show_suggestions_(false),
954 user_did_type_(false), 974 user_did_type_(false),
955 user_did_autofill_(false), 975 user_did_autofill_(false),
956 user_did_edit_autofilled_field_(false), 976 user_did_edit_autofilled_field_(false),
957 password_generation_enabled_(false), 977 password_generation_enabled_(false),
958 external_delegate_(NULL) { 978 external_delegate_(NULL) {
959 DCHECK(web_contents); 979 DCHECK(web_contents);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 *profile_guid = IDToGUID(profile_id); 1283 *profile_guid = IDToGUID(profile_id);
1264 } 1284 }
1265 1285
1266 void AutofillManager::UpdateInitialInteractionTimestamp( 1286 void AutofillManager::UpdateInitialInteractionTimestamp(
1267 const TimeTicks& interaction_timestamp) { 1287 const TimeTicks& interaction_timestamp) {
1268 if (initial_interaction_timestamp_.is_null() || 1288 if (initial_interaction_timestamp_.is_null() ||
1269 interaction_timestamp < initial_interaction_timestamp_) { 1289 interaction_timestamp < initial_interaction_timestamp_) {
1270 initial_interaction_timestamp_ = interaction_timestamp; 1290 initial_interaction_timestamp_ = interaction_timestamp;
1271 } 1291 }
1272 } 1292 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698