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

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

Powered by Google App Engine
This is Rietveld 408576698