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

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

Issue 12378055: Make autofill stop depending on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 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>
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/string16.h" 19 #include "base/string16.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
22 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
23 #include "chrome/browser/api/infobars/infobar_service.h"
24 #include "chrome/browser/autofill/autocheckout/whitelist_manager.h" 23 #include "chrome/browser/autofill/autocheckout/whitelist_manager.h"
25 #include "chrome/browser/autofill/autocheckout_manager.h" 24 #include "chrome/browser/autofill/autocheckout_manager.h"
26 #include "chrome/browser/autofill/autocomplete_history_manager.h" 25 #include "chrome/browser/autofill/autocomplete_history_manager.h"
27 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
28 #include "chrome/browser/autofill/autofill_country.h" 26 #include "chrome/browser/autofill/autofill_country.h"
29 #include "chrome/browser/autofill/autofill_external_delegate.h" 27 #include "chrome/browser/autofill/autofill_external_delegate.h"
30 #include "chrome/browser/autofill/autofill_field.h" 28 #include "chrome/browser/autofill/autofill_field.h"
31 #include "chrome/browser/autofill/autofill_manager_delegate.h" 29 #include "chrome/browser/autofill/autofill_manager_delegate.h"
32 #include "chrome/browser/autofill/autofill_metrics.h" 30 #include "chrome/browser/autofill/autofill_metrics.h"
33 #include "chrome/browser/autofill/autofill_profile.h" 31 #include "chrome/browser/autofill/autofill_profile.h"
34 #include "chrome/browser/autofill/autofill_type.h" 32 #include "chrome/browser/autofill/autofill_type.h"
35 #include "chrome/browser/autofill/credit_card.h" 33 #include "chrome/browser/autofill/credit_card.h"
36 #include "chrome/browser/autofill/form_structure.h" 34 #include "chrome/browser/autofill/form_structure.h"
37 #include "chrome/browser/autofill/password_generator.h" 35 #include "chrome/browser/autofill/password_generator.h"
(...skipping 19 matching lines...) Expand all
57 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
58 #include "content/public/browser/web_contents_view.h" 56 #include "content/public/browser/web_contents_view.h"
59 #include "googleurl/src/gurl.h" 57 #include "googleurl/src/gurl.h"
60 #include "grit/generated_resources.h" 58 #include "grit/generated_resources.h"
61 #include "ipc/ipc_message_macros.h" 59 #include "ipc/ipc_message_macros.h"
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
63 #include "ui/base/l10n/l10n_util.h" 61 #include "ui/base/l10n/l10n_util.h"
64 #include "ui/gfx/rect.h" 62 #include "ui/gfx/rect.h"
65 63
66 typedef PersonalDataManager::GUIDPair GUIDPair; 64 typedef PersonalDataManager::GUIDPair GUIDPair;
65
67 using base::TimeTicks; 66 using base::TimeTicks;
68 using content::BrowserThread; 67 using content::BrowserThread;
69 using content::RenderViewHost; 68 using content::RenderViewHost;
70 using WebKit::WebFormElement; 69 using WebKit::WebFormElement;
71 70
72 namespace { 71 namespace {
73 72
74 const char* kAutofillManagerWebContentsUserDataKey = "web_contents_autofill"; 73 const char* kAutofillManagerWebContentsUserDataKey = "web_contents_autofill";
75 74
76 // We only send a fraction of the forms to upload server. 75 // We only send a fraction of the forms to upload server.
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 host->Send( 910 host->Send(
912 new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(), 911 new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(),
913 type_predictions)); 912 type_predictions));
914 } 913 }
915 914
916 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { 915 void AutofillManager::ImportFormData(const FormStructure& submitted_form) {
917 const CreditCard* imported_credit_card; 916 const CreditCard* imported_credit_card;
918 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) 917 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card))
919 return; 918 return;
920 919
921 // If credit card information was submitted, show an infobar to offer to save 920 // If credit card information was submitted, we need to confirm whether to
922 // it. 921 // save it.
923 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card); 922 if (imported_credit_card) {
924 if (imported_credit_card && web_contents()) { 923 manager_delegate_->ConfirmSaveCreditCard(
925 AutofillCCInfoBarDelegate::Create(manager_delegate_->GetInfoBarService(), 924 *metric_logger_,
926 scoped_credit_card.release(), personal_data_, metric_logger_.get()); 925 *imported_credit_card,
926 base::Bind(&PersonalDataManager::SaveImportedCreditCard,
927 base::Unretained(personal_data_), *imported_credit_card));
927 } 928 }
928 } 929 }
929 930
930 // Note that |submitted_form| is passed as a pointer rather than as a reference 931 // Note that |submitted_form| is passed as a pointer rather than as a reference
931 // so that we can get memory management right across threads. Note also that we 932 // so that we can get memory management right across threads. Note also that we
932 // explicitly pass in all the time stamps of interest, as the cached ones might 933 // explicitly pass in all the time stamps of interest, as the cached ones might
933 // get reset before this method executes. 934 // get reset before this method executes.
934 void AutofillManager::UploadFormDataAsyncCallback( 935 void AutofillManager::UploadFormDataAsyncCallback(
935 const FormStructure* submitted_form, 936 const FormStructure* submitted_form,
936 const TimeTicks& load_time, 937 const TimeTicks& load_time,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 *profile_guid = IDToGUID(profile_id); 1313 *profile_guid = IDToGUID(profile_id);
1313 } 1314 }
1314 1315
1315 void AutofillManager::UpdateInitialInteractionTimestamp( 1316 void AutofillManager::UpdateInitialInteractionTimestamp(
1316 const TimeTicks& interaction_timestamp) { 1317 const TimeTicks& interaction_timestamp) {
1317 if (initial_interaction_timestamp_.is_null() || 1318 if (initial_interaction_timestamp_.is_null() ||
1318 interaction_timestamp < initial_interaction_timestamp_) { 1319 interaction_timestamp < initial_interaction_timestamp_) {
1319 initial_interaction_timestamp_ = interaction_timestamp; 1320 initial_interaction_timestamp_ = interaction_timestamp;
1320 } 1321 }
1321 } 1322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698