| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/browser/autocomplete_history_manager.h" | 19 #include "chrome/browser/autocomplete_history_manager.h" |
| 20 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 20 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 21 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" | 21 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" |
| 22 #include "chrome/browser/autofill/autofill_field.h" | 22 #include "chrome/browser/autofill/autofill_field.h" |
| 23 #include "chrome/browser/autofill/autofill_metrics.h" | 23 #include "chrome/browser/autofill/autofill_metrics.h" |
| 24 #include "chrome/browser/autofill/autofill_profile.h" | 24 #include "chrome/browser/autofill/autofill_profile.h" |
| 25 #include "chrome/browser/autofill/autofill_type.h" | 25 #include "chrome/browser/autofill/autofill_type.h" |
| 26 #include "chrome/browser/autofill/credit_card.h" | 26 #include "chrome/browser/autofill/credit_card.h" |
| 27 #include "chrome/browser/autofill/form_structure.h" | 27 #include "chrome/browser/autofill/form_structure.h" |
| 28 #include "chrome/browser/autofill/personal_data_manager.h" | 28 #include "chrome/browser/autofill/personal_data_manager.h" |
| 29 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 29 #include "chrome/browser/autofill/phone_number.h" | 30 #include "chrome/browser/autofill/phone_number.h" |
| 30 #include "chrome/browser/autofill/phone_number_i18n.h" | 31 #include "chrome/browser/autofill/phone_number_i18n.h" |
| 31 #include "chrome/browser/autofill/select_control_handler.h" | 32 #include "chrome/browser/autofill/select_control_handler.h" |
| 32 #include "chrome/browser/infobars/infobar_tab_helper.h" | 33 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 33 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
| 36 #include "chrome/browser/ui/browser_list.h" | 37 #include "chrome/browser/ui/browser_list.h" |
| 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 38 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 38 #include "chrome/common/autofill_messages.h" | 39 #include "chrome/common/autofill_messages.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 metric_logger_(new AutofillMetrics), | 211 metric_logger_(new AutofillMetrics), |
| 211 has_logged_autofill_enabled_(false), | 212 has_logged_autofill_enabled_(false), |
| 212 has_logged_address_suggestions_count_(false), | 213 has_logged_address_suggestions_count_(false), |
| 213 did_show_suggestions_(false), | 214 did_show_suggestions_(false), |
| 214 user_did_type_(false), | 215 user_did_type_(false), |
| 215 user_did_autofill_(false), | 216 user_did_autofill_(false), |
| 216 user_did_edit_autofilled_field_(false) { | 217 user_did_edit_autofilled_field_(false) { |
| 217 DCHECK(tab_contents); | 218 DCHECK(tab_contents); |
| 218 | 219 |
| 219 // |personal_data_| is NULL when using TestTabContents. | 220 // |personal_data_| is NULL when using TestTabContents. |
| 220 personal_data_ = | 221 personal_data_ = PersonalDataManagerFactory::GetForProfile( |
| 221 tab_contents->profile()->GetOriginalProfile()->GetPersonalDataManager(); | 222 tab_contents->profile()->GetOriginalProfile()); |
| 222 download_manager_.SetObserver(this); | 223 download_manager_.SetObserver(this); |
| 223 } | 224 } |
| 224 | 225 |
| 225 AutofillManager::~AutofillManager() { | 226 AutofillManager::~AutofillManager() { |
| 226 download_manager_.SetObserver(NULL); | 227 download_manager_.SetObserver(NULL); |
| 227 } | 228 } |
| 228 | 229 |
| 229 // static | 230 // static |
| 230 void AutofillManager::RegisterUserPrefs(PrefService* prefs) { | 231 void AutofillManager::RegisterUserPrefs(PrefService* prefs) { |
| 231 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, | 232 prefs->RegisterBooleanPref(prefs::kAutofillEnabled, |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 *profile_guid = IDToGUID(profile_id); | 1215 *profile_guid = IDToGUID(profile_id); |
| 1215 } | 1216 } |
| 1216 | 1217 |
| 1217 void AutofillManager::UpdateInitialInteractionTimestamp( | 1218 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1218 const TimeTicks& interaction_timestamp) { | 1219 const TimeTicks& interaction_timestamp) { |
| 1219 if (initial_interaction_timestamp_.is_null() || | 1220 if (initial_interaction_timestamp_.is_null() || |
| 1220 interaction_timestamp < initial_interaction_timestamp_) { | 1221 interaction_timestamp < initial_interaction_timestamp_) { |
| 1221 initial_interaction_timestamp_ = interaction_timestamp; | 1222 initial_interaction_timestamp_ = interaction_timestamp; |
| 1222 } | 1223 } |
| 1223 } | 1224 } |
| OLD | NEW |