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> |
(...skipping 11 matching lines...) Expand all Loading... |
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/phone_number.h" | 29 #include "chrome/browser/autofill/phone_number.h" |
30 #include "chrome/browser/autofill/phone_number_i18n.h" | 30 #include "chrome/browser/autofill/phone_number_i18n.h" |
31 #include "chrome/browser/autofill/select_control_handler.h" | 31 #include "chrome/browser/autofill/select_control_handler.h" |
| 32 #include "chrome/browser/infobars/infobar_tab_helper.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
33 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
35 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
37 #include "chrome/common/autofill_messages.h" | 38 #include "chrome/common/autofill_messages.h" |
38 #include "chrome/common/chrome_notification_types.h" | 39 #include "chrome/common/chrome_notification_types.h" |
39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/guid.h" | 41 #include "chrome/common/guid.h" |
41 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 string16 text = | 204 string16 text = |
204 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_TEXT); | 205 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_TEXT); |
205 string16 link = | 206 string16 link = |
206 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_LINK_TEXT); | 207 l10n_util::GetStringUTF16(IDS_AUTOFILL_FEEDBACK_INFOBAR_LINK_TEXT); |
207 std::string message = | 208 std::string message = |
208 l10n_util::GetStringFUTF8(IDS_AUTOFILL_FEEDBACK_POPULAR_FORM_MESSAGE, | 209 l10n_util::GetStringFUTF8(IDS_AUTOFILL_FEEDBACK_POPULAR_FORM_MESSAGE, |
209 ASCIIToUTF16(form_signature), | 210 ASCIIToUTF16(form_signature), |
210 UTF8ToUTF16((*it)->source_url().spec())); | 211 UTF8ToUTF16((*it)->source_url().spec())); |
211 | 212 |
212 tab_contents_wrapper->AddInfoBar( | 213 tab_contents_wrapper->infobar_tab_helper()->AddInfoBar( |
213 new AutofillFeedbackInfoBarDelegate(tab_contents, text, link, | 214 new AutofillFeedbackInfoBarDelegate(tab_contents, text, link, |
214 message)); | 215 message)); |
215 break; | 216 break; |
216 } | 217 } |
217 } | 218 } |
218 } | 219 } |
219 | 220 |
220 } // namespace | 221 } // namespace |
221 | 222 |
222 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) | 223 AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 730 |
730 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { | 731 void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
731 const CreditCard* imported_credit_card; | 732 const CreditCard* imported_credit_card; |
732 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) | 733 if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card)) |
733 return; | 734 return; |
734 | 735 |
735 // If credit card information was submitted, show an infobar to offer to save | 736 // If credit card information was submitted, show an infobar to offer to save |
736 // it. | 737 // it. |
737 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card); | 738 scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card); |
738 if (imported_credit_card && tab_contents()) { | 739 if (imported_credit_card && tab_contents()) { |
739 tab_contents_wrapper_->AddInfoBar( | 740 tab_contents_wrapper_->infobar_tab_helper()->AddInfoBar( |
740 new AutofillCCInfoBarDelegate(tab_contents(), | 741 new AutofillCCInfoBarDelegate(tab_contents(), |
741 scoped_credit_card.release(), | 742 scoped_credit_card.release(), |
742 personal_data_, | 743 personal_data_, |
743 metric_logger_.get())); | 744 metric_logger_.get())); |
744 } | 745 } |
745 } | 746 } |
746 | 747 |
747 void AutofillManager::UploadFormData(const FormStructure& submitted_form) { | 748 void AutofillManager::UploadFormData(const FormStructure& submitted_form) { |
748 if (disable_download_manager_requests_) | 749 if (disable_download_manager_requests_) |
749 return; | 750 return; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 void AutofillManager::UnpackGUIDs(int id, | 1144 void AutofillManager::UnpackGUIDs(int id, |
1144 GUIDPair* cc_guid, | 1145 GUIDPair* cc_guid, |
1145 GUIDPair* profile_guid) { | 1146 GUIDPair* profile_guid) { |
1146 int cc_id = id >> std::numeric_limits<unsigned short>::digits & | 1147 int cc_id = id >> std::numeric_limits<unsigned short>::digits & |
1147 std::numeric_limits<unsigned short>::max(); | 1148 std::numeric_limits<unsigned short>::max(); |
1148 int profile_id = id & std::numeric_limits<unsigned short>::max(); | 1149 int profile_id = id & std::numeric_limits<unsigned short>::max(); |
1149 | 1150 |
1150 *cc_guid = IDToGUID(cc_id); | 1151 *cc_guid = IDToGUID(cc_id); |
1151 *profile_guid = IDToGUID(profile_id); | 1152 *profile_guid = IDToGUID(profile_id); |
1152 } | 1153 } |
OLD | NEW |