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

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

Powered by Google App Engine
This is Rietveld 408576698