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

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: Simplify test 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/api/sync/profile_sync_service_base.h" 23 #include "chrome/browser/api/sync/profile_sync_service_base.h"
25 #include "chrome/browser/autofill/autocheckout/whitelist_manager.h" 24 #include "chrome/browser/autofill/autocheckout/whitelist_manager.h"
26 #include "chrome/browser/autofill/autocheckout_manager.h" 25 #include "chrome/browser/autofill/autocheckout_manager.h"
27 #include "chrome/browser/autofill/autocomplete_history_manager.h" 26 #include "chrome/browser/autofill/autocomplete_history_manager.h"
28 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
29 #include "chrome/browser/autofill/autofill_country.h" 27 #include "chrome/browser/autofill/autofill_country.h"
30 #include "chrome/browser/autofill/autofill_external_delegate.h" 28 #include "chrome/browser/autofill/autofill_external_delegate.h"
31 #include "chrome/browser/autofill/autofill_field.h" 29 #include "chrome/browser/autofill/autofill_field.h"
32 #include "chrome/browser/autofill/autofill_manager_delegate.h" 30 #include "chrome/browser/autofill/autofill_manager_delegate.h"
33 #include "chrome/browser/autofill/autofill_metrics.h" 31 #include "chrome/browser/autofill/autofill_metrics.h"
34 #include "chrome/browser/autofill/autofill_profile.h" 32 #include "chrome/browser/autofill/autofill_profile.h"
35 #include "chrome/browser/autofill/autofill_type.h" 33 #include "chrome/browser/autofill/autofill_type.h"
36 #include "chrome/browser/autofill/credit_card.h" 34 #include "chrome/browser/autofill/credit_card.h"
37 #include "chrome/browser/autofill/form_structure.h" 35 #include "chrome/browser/autofill/form_structure.h"
38 #include "chrome/browser/autofill/password_generator.h" 36 #include "chrome/browser/autofill/password_generator.h"
(...skipping 19 matching lines...) Expand all
58 #include "content/public/browser/web_contents.h" 56 #include "content/public/browser/web_contents.h"
59 #include "content/public/browser/web_contents_view.h" 57 #include "content/public/browser/web_contents_view.h"
60 #include "googleurl/src/gurl.h" 58 #include "googleurl/src/gurl.h"
61 #include "grit/generated_resources.h" 59 #include "grit/generated_resources.h"
62 #include "ipc/ipc_message_macros.h" 60 #include "ipc/ipc_message_macros.h"
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
64 #include "ui/base/l10n/l10n_util.h" 62 #include "ui/base/l10n/l10n_util.h"
65 #include "ui/gfx/rect.h" 63 #include "ui/gfx/rect.h"
66 64
67 typedef PersonalDataManager::GUIDPair GUIDPair; 65 typedef PersonalDataManager::GUIDPair GUIDPair;
66
68 using base::TimeTicks; 67 using base::TimeTicks;
69 using content::BrowserThread; 68 using content::BrowserThread;
70 using content::RenderViewHost; 69 using content::RenderViewHost;
71 using WebKit::WebFormElement; 70 using WebKit::WebFormElement;
72 71
73 namespace { 72 namespace {
74 73
75 const char* kAutofillManagerWebContentsUserDataKey = "web_contents_autofill"; 74 const char* kAutofillManagerWebContentsUserDataKey = "web_contents_autofill";
76 75
77 // We only send a fraction of the forms to upload server. 76 // We only send a fraction of the forms to upload server.
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 host->Send( 917 host->Send(
919 new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(), 918 new AutofillMsg_FieldTypePredictionsAvailable(host->GetRoutingID(),
920 type_predictions)); 919 type_predictions));
921 } 920 }
922 921
923 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { 922 void AutofillManager::ImportFormData(const FormStructure& submitted_form) {
924 const CreditCard* imported_credit_card; 923 const CreditCard* imported_credit_card;
925 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) 924 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card))
926 return; 925 return;
927 926
928 // If credit card information was submitted, show an infobar to offer to save 927 // If credit card information was submitted, we need to confirm whether to
929 // it. 928 // save it.
930 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card); 929 if (imported_credit_card) {
931 if (imported_credit_card && web_contents()) { 930 manager_delegate_->ConfirmImportCC(
932 AutofillCCInfoBarDelegate::Create(manager_delegate_->GetInfoBarService(), 931 *metric_logger_,
933 scoped_credit_card.release(), personal_data_, metric_logger_.get()); 932 *imported_credit_card,
933 base::Bind(&PersonalDataManager::SaveImportedCreditCard,
934 base::Unretained(personal_data_), *imported_credit_card));
934 } 935 }
935 } 936 }
936 937
937 // Note that |submitted_form| is passed as a pointer rather than as a reference 938 // Note that |submitted_form| is passed as a pointer rather than as a reference
938 // so that we can get memory management right across threads. Note also that we 939 // so that we can get memory management right across threads. Note also that we
939 // explicitly pass in all the time stamps of interest, as the cached ones might 940 // explicitly pass in all the time stamps of interest, as the cached ones might
940 // get reset before this method executes. 941 // get reset before this method executes.
941 void AutofillManager::UploadFormDataAsyncCallback( 942 void AutofillManager::UploadFormDataAsyncCallback(
942 const FormStructure* submitted_form, 943 const FormStructure* submitted_form,
943 const TimeTicks& load_time, 944 const TimeTicks& load_time,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 *profile_guid = IDToGUID(profile_id); 1320 *profile_guid = IDToGUID(profile_id);
1320 } 1321 }
1321 1322
1322 void AutofillManager::UpdateInitialInteractionTimestamp( 1323 void AutofillManager::UpdateInitialInteractionTimestamp(
1323 const TimeTicks& interaction_timestamp) { 1324 const TimeTicks& interaction_timestamp) {
1324 if (initial_interaction_timestamp_.is_null() || 1325 if (initial_interaction_timestamp_.is_null() ||
1325 interaction_timestamp < initial_interaction_timestamp_) { 1326 interaction_timestamp < initial_interaction_timestamp_) {
1326 initial_interaction_timestamp_ = interaction_timestamp; 1327 initial_interaction_timestamp_ = interaction_timestamp;
1327 } 1328 }
1328 } 1329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698