OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 inputs->push_back(*input); | 142 inputs->push_back(*input); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 // Initializes |form_group| from user-entered data. | 146 // Initializes |form_group| from user-entered data. |
147 void FillFormGroupFromOutputs(const DetailOutputMap& detail_outputs, | 147 void FillFormGroupFromOutputs(const DetailOutputMap& detail_outputs, |
148 FormGroup* form_group) { | 148 FormGroup* form_group) { |
149 for (DetailOutputMap::const_iterator iter = detail_outputs.begin(); | 149 for (DetailOutputMap::const_iterator iter = detail_outputs.begin(); |
150 iter != detail_outputs.end(); ++iter) { | 150 iter != detail_outputs.end(); ++iter) { |
151 if (!iter->second.empty()) { | 151 if (!iter->second.empty()) { |
152 AutofillFieldType type = iter->first->type; | 152 AutofillFieldType type = iter->first; |
153 if (type == ADDRESS_HOME_COUNTRY || type == ADDRESS_BILLING_COUNTRY) { | 153 if (type == ADDRESS_HOME_COUNTRY || type == ADDRESS_BILLING_COUNTRY) { |
154 form_group->SetInfo(type, | 154 form_group->SetInfo(type, |
155 iter->second, | 155 iter->second, |
156 g_browser_process->GetApplicationLocale()); | 156 g_browser_process->GetApplicationLocale()); |
157 } else { | 157 } else { |
158 form_group->SetRawInfo(iter->first->type, iter->second); | 158 form_group->SetRawInfo(iter->first, iter->second); |
159 } | 159 } |
160 } | 160 } |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. | 164 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. |
165 // These outparams are required because |card|/|profile| accept different types | 165 // These outparams are required because |card|/|profile| accept different types |
166 // of raw info, and CreditCard doesn't save CVCs. | 166 // of raw info, and CreditCard doesn't save CVCs. |
167 void GetBillingInfoFromOutputs(const DetailOutputMap& output, | 167 void GetBillingInfoFromOutputs(const DetailOutputMap& output, |
168 CreditCard* card, | 168 CreditCard* card, |
169 string16* cvc, | 169 string16* cvc, |
170 AutofillProfile* profile) { | 170 AutofillProfile* profile) { |
171 for (DetailOutputMap::const_iterator it = output.begin(); | 171 for (DetailOutputMap::const_iterator it = output.begin(); |
172 it != output.end(); ++it) { | 172 it != output.end(); ++it) { |
173 string16 trimmed; | 173 string16 trimmed; |
174 TrimWhitespace(it->second, TRIM_ALL, &trimmed); | 174 TrimWhitespace(it->second, TRIM_ALL, &trimmed); |
175 | 175 |
176 // Special case CVC as CreditCard just swallows it. | 176 // Special case CVC as CreditCard just swallows it. |
177 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { | 177 if (it->first == CREDIT_CARD_VERIFICATION_CODE) { |
178 if (cvc) | 178 if (cvc) |
179 cvc->assign(trimmed); | 179 cvc->assign(trimmed); |
180 } else if (it->first->type == ADDRESS_HOME_COUNTRY || | 180 } else if (it->first == ADDRESS_HOME_COUNTRY || |
181 it->first->type == ADDRESS_BILLING_COUNTRY) { | 181 it->first == ADDRESS_BILLING_COUNTRY) { |
182 profile->SetInfo(it->first->type, | 182 profile->SetInfo( |
183 trimmed, | 183 it->first, trimmed, g_browser_process->GetApplicationLocale()); |
184 g_browser_process->GetApplicationLocale()); | |
185 } else { | 184 } else { |
186 // Copy the credit card name to |profile| in addition to |card| as | 185 // Copy the credit card name to |profile| in addition to |card| as |
187 // wallet::Instrument requires a recipient name for its billing address. | 186 // wallet::Instrument requires a recipient name for its billing address. |
188 if (profile && it->first->type == CREDIT_CARD_NAME) | 187 if (profile && it->first == CREDIT_CARD_NAME) |
189 profile->SetRawInfo(NAME_FULL, trimmed); | 188 profile->SetRawInfo(NAME_FULL, trimmed); |
190 | 189 |
191 if (IsCreditCardType(it->first->type)) { | 190 if (IsCreditCardType(it->first)) { |
192 if (card) | 191 if (card) |
193 card->SetRawInfo(it->first->type, trimmed); | 192 card->SetRawInfo(it->first, trimmed); |
194 } else if (profile) { | 193 } else if (profile) { |
195 profile->SetRawInfo(it->first->type, trimmed); | 194 profile->SetRawInfo(it->first, trimmed); |
196 } | 195 } |
197 } | 196 } |
198 } | 197 } |
199 } | 198 } |
200 | 199 |
201 // Returns the containing window for the given |web_contents|. The containing | 200 // Returns the containing window for the given |web_contents|. The containing |
202 // window might be a browser window for a Chrome tab, or it might be a shell | 201 // window might be a browser window for a Chrome tab, or it might be a shell |
203 // window for a platform app. | 202 // window for a platform app. |
204 BaseWindow* GetBaseWindowForWebContents( | 203 BaseWindow* GetBaseWindowForWebContents( |
205 const content::WebContents* web_contents) { | 204 const content::WebContents* web_contents) { |
206 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 205 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
207 if (browser) | 206 if (browser) |
208 return browser->window(); | 207 return browser->window(); |
209 | 208 |
210 gfx::NativeWindow native_window = | 209 gfx::NativeWindow native_window = |
211 web_contents->GetView()->GetTopLevelNativeWindow(); | 210 web_contents->GetView()->GetTopLevelNativeWindow(); |
212 ShellWindow* shell_window = | 211 ShellWindow* shell_window = |
213 extensions::ShellWindowRegistry:: | 212 extensions::ShellWindowRegistry:: |
214 GetShellWindowForNativeWindowAnyProfile(native_window); | 213 GetShellWindowForNativeWindowAnyProfile(native_window); |
215 return shell_window->GetBaseWindow(); | 214 return shell_window->GetBaseWindow(); |
216 } | 215 } |
217 | 216 |
218 // Extracts the string value of a field with |type| from |output|. This is | 217 // Extracts the string value of a field with |type| from |output|. This is |
219 // useful when you only need the value of 1 input from a section of view inputs. | 218 // useful when you only need the value of 1 input from a section of view inputs. |
220 string16 GetValueForType(const DetailOutputMap& output, | 219 string16 GetValueForType(const DetailOutputMap& output, |
221 AutofillFieldType type) { | 220 AutofillFieldType type) { |
222 for (DetailOutputMap::const_iterator it = output.begin(); | 221 DetailOutputMap::const_iterator it = output.find(type); |
223 it != output.end(); ++it) { | 222 DCHECK(it != output.end()); |
224 if (it->first->type == type) | 223 return it->second; |
225 return it->second; | |
226 } | |
227 NOTREACHED(); | |
228 return string16(); | |
229 } | 224 } |
230 | 225 |
231 } // namespace | 226 } // namespace |
232 | 227 |
233 AutofillDialogController::~AutofillDialogController() {} | 228 AutofillDialogController::~AutofillDialogController() {} |
234 | 229 |
235 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { | 230 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { |
236 if (popup_controller_) | 231 if (popup_controller_) |
237 popup_controller_->Hide(); | 232 popup_controller_->Hide(); |
238 | 233 |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 NOTREACHED(); // Trying to validate unknown field. | 1004 NOTREACHED(); // Trying to validate unknown field. |
1010 break; | 1005 break; |
1011 } | 1006 } |
1012 | 1007 |
1013 return !value.empty(); | 1008 return !value.empty(); |
1014 } | 1009 } |
1015 | 1010 |
1016 std::vector<AutofillFieldType> AutofillDialogControllerImpl::InputsAreValid( | 1011 std::vector<AutofillFieldType> AutofillDialogControllerImpl::InputsAreValid( |
1017 const DetailOutputMap& inputs, ValidationType validation_type) const { | 1012 const DetailOutputMap& inputs, ValidationType validation_type) const { |
1018 std::vector<AutofillFieldType> invalid_fields; | 1013 std::vector<AutofillFieldType> invalid_fields; |
1019 std::map<AutofillFieldType, string16> field_values; | |
1020 for (DetailOutputMap::const_iterator iter = inputs.begin(); | 1014 for (DetailOutputMap::const_iterator iter = inputs.begin(); |
1021 iter != inputs.end(); ++iter) { | 1015 iter != inputs.end(); ++iter) { |
1022 // Skip empty fields in edit mode. | 1016 // Skip empty fields in edit mode. |
1023 if (validation_type == VALIDATE_EDIT && iter->second.empty()) | 1017 if (validation_type == VALIDATE_EDIT && iter->second.empty()) |
1024 continue; | 1018 continue; |
1025 | 1019 |
1026 field_values[iter->first->type] = iter->second; | 1020 if (!InputIsValid(iter->first, iter->second)) |
1027 | 1021 invalid_fields.push_back(iter->first); |
1028 if (!InputIsValid(iter->first->type, iter->second)) | |
1029 invalid_fields.push_back(iter->first->type); | |
1030 } | 1022 } |
1031 | 1023 |
1032 // Validate the date formed by month and year field. (Autofill dialog is | 1024 // Validate the date formed by month and year field. (Autofill dialog is |
1033 // never supposed to have 2-digit years, so not checked). | 1025 // never supposed to have 2-digit years, so not checked). |
1034 if (field_values.count(CREDIT_CARD_EXP_MONTH) && | 1026 DetailOutputMap::const_iterator field1 = inputs.find(CREDIT_CARD_EXP_MONTH); |
1035 field_values.count(CREDIT_CARD_EXP_4_DIGIT_YEAR)) { | 1027 DetailOutputMap::const_iterator field2 = |
| 1028 inputs.find(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
| 1029 if (field1 != inputs.end() && field2 != inputs.end()) { |
1036 if (!autofill::IsValidCreditCardExpirationDate( | 1030 if (!autofill::IsValidCreditCardExpirationDate( |
1037 field_values[CREDIT_CARD_EXP_4_DIGIT_YEAR], | 1031 field1->second, field2->second, base::Time::Now())) { |
1038 field_values[CREDIT_CARD_EXP_MONTH], | |
1039 base::Time::Now())) { | |
1040 invalid_fields.push_back(CREDIT_CARD_EXP_MONTH); | 1032 invalid_fields.push_back(CREDIT_CARD_EXP_MONTH); |
1041 invalid_fields.push_back(CREDIT_CARD_EXP_4_DIGIT_YEAR); | 1033 invalid_fields.push_back(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
1042 } | 1034 } |
1043 } | 1035 } |
1044 | 1036 |
1045 // If there is a credit card number and a CVC, validate them together. | 1037 // If there is a credit card number and a CVC, validate them together. |
1046 if (field_values.count(CREDIT_CARD_NUMBER) && | 1038 field1 = inputs.find(CREDIT_CARD_NUMBER); |
1047 field_values.count(CREDIT_CARD_VERIFICATION_CODE) && | 1039 field2 = inputs.find(CREDIT_CARD_VERIFICATION_CODE); |
1048 InputIsValid(CREDIT_CARD_NUMBER, field_values[CREDIT_CARD_NUMBER])) { | 1040 if (field1 != inputs.end() && field2 != inputs.end() && |
1049 if (!autofill::IsValidCreditCardSecurityCode( | 1041 InputIsValid(CREDIT_CARD_NUMBER, field1->second)) { |
1050 field_values[CREDIT_CARD_VERIFICATION_CODE], | 1042 if (!autofill::IsValidCreditCardSecurityCode(field2->second, |
1051 field_values[CREDIT_CARD_NUMBER])) { | 1043 field1->second)) { |
1052 invalid_fields.push_back(CREDIT_CARD_VERIFICATION_CODE); | 1044 invalid_fields.push_back(CREDIT_CARD_VERIFICATION_CODE); |
1053 } | 1045 } |
1054 } | 1046 } |
1055 | 1047 |
1056 // De-duplicate invalid fields. | 1048 // De-duplicate invalid fields. |
1057 std::sort(invalid_fields.begin(), invalid_fields.end()); | 1049 std::sort(invalid_fields.begin(), invalid_fields.end()); |
1058 invalid_fields.erase(std::unique( | 1050 invalid_fields.erase(std::unique( |
1059 invalid_fields.begin(), invalid_fields.end()), invalid_fields.end()); | 1051 invalid_fields.begin(), invalid_fields.end()), invalid_fields.end()); |
1060 | 1052 |
1061 return invalid_fields; | 1053 return invalid_fields; |
1062 } | 1054 } |
1063 | 1055 |
1064 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( | 1056 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( |
1065 const DetailInput* input, | 1057 DialogSection section, |
| 1058 AutofillFieldType type, |
1066 gfx::NativeView parent_view, | 1059 gfx::NativeView parent_view, |
1067 const gfx::Rect& content_bounds, | 1060 const gfx::Rect& content_bounds, |
1068 const string16& field_contents, | 1061 const string16& field_contents, |
1069 bool was_edit) { | 1062 bool was_edit) { |
1070 // If the field is edited down to empty, don't show a popup. | 1063 // If the field is edited down to empty, don't show a popup. |
1071 if (was_edit && field_contents.empty()) { | 1064 if (was_edit && field_contents.empty()) { |
1072 HidePopup(); | 1065 HidePopup(); |
1073 return; | 1066 return; |
1074 } | 1067 } |
1075 | 1068 |
1076 // If the user clicks while the popup is already showing, be sure to hide | 1069 // If the user clicks while the popup is already showing, be sure to hide |
1077 // it. | 1070 // it. |
1078 if (!was_edit && popup_controller_) { | 1071 if (!was_edit && popup_controller_) { |
1079 HidePopup(); | 1072 HidePopup(); |
1080 return; | 1073 return; |
1081 } | 1074 } |
1082 | 1075 |
1083 std::vector<string16> popup_values, popup_labels, popup_icons; | 1076 std::vector<string16> popup_values, popup_labels, popup_icons; |
1084 if (IsCreditCardType(input->type)) { | 1077 if (IsCreditCardType(type)) { |
1085 GetManager()->GetCreditCardSuggestions(input->type, | 1078 GetManager()->GetCreditCardSuggestions(type, |
1086 field_contents, | 1079 field_contents, |
1087 &popup_values, | 1080 &popup_values, |
1088 &popup_labels, | 1081 &popup_labels, |
1089 &popup_icons, | 1082 &popup_icons, |
1090 &popup_guids_); | 1083 &popup_guids_); |
1091 } else { | 1084 } else { |
1092 std::vector<AutofillFieldType> field_types; | 1085 std::vector<AutofillFieldType> field_types; |
1093 field_types.push_back(EMAIL_ADDRESS); | 1086 field_types.push_back(EMAIL_ADDRESS); |
1094 for (DetailInputs::const_iterator iter = requested_shipping_fields_.begin(); | 1087 for (DetailInputs::const_iterator iter = requested_shipping_fields_.begin(); |
1095 iter != requested_shipping_fields_.end(); ++iter) { | 1088 iter != requested_shipping_fields_.end(); ++iter) { |
1096 field_types.push_back(iter->type); | 1089 field_types.push_back(iter->type); |
1097 } | 1090 } |
1098 GetManager()->GetProfileSuggestions(input->type, | 1091 GetManager()->GetProfileSuggestions(type, |
1099 field_contents, | 1092 field_contents, |
1100 false, | 1093 false, |
1101 field_types, | 1094 field_types, |
1102 &popup_values, | 1095 &popup_values, |
1103 &popup_labels, | 1096 &popup_labels, |
1104 &popup_icons, | 1097 &popup_icons, |
1105 &popup_guids_); | 1098 &popup_guids_); |
1106 } | 1099 } |
1107 | 1100 |
1108 if (popup_values.empty()) | 1101 if (popup_values.empty()) |
1109 return; | 1102 return; |
1110 | 1103 |
1111 // TODO(estade): do we need separators and control rows like 'Clear | 1104 // TODO(estade): do we need separators and control rows like 'Clear |
1112 // Form'? | 1105 // Form'? |
1113 std::vector<int> popup_ids; | 1106 std::vector<int> popup_ids; |
1114 for (size_t i = 0; i < popup_guids_.size(); ++i) { | 1107 for (size_t i = 0; i < popup_guids_.size(); ++i) { |
1115 popup_ids.push_back(i); | 1108 popup_ids.push_back(i); |
1116 } | 1109 } |
1117 | 1110 |
1118 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( | 1111 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( |
1119 popup_controller_, | 1112 popup_controller_, |
1120 weak_ptr_factory_.GetWeakPtr(), | 1113 weak_ptr_factory_.GetWeakPtr(), |
1121 parent_view, | 1114 parent_view, |
1122 content_bounds); | 1115 content_bounds); |
1123 popup_controller_->Show(popup_values, | 1116 popup_controller_->Show(popup_values, |
1124 popup_labels, | 1117 popup_labels, |
1125 popup_icons, | 1118 popup_icons, |
1126 popup_ids); | 1119 popup_ids); |
1127 input_showing_popup_ = input; | 1120 input_showing_popup_type_ = type; |
1128 } | 1121 } |
1129 | 1122 |
1130 void AutofillDialogControllerImpl::FocusMoved() { | 1123 void AutofillDialogControllerImpl::FocusMoved() { |
1131 HidePopup(); | 1124 HidePopup(); |
1132 } | 1125 } |
1133 | 1126 |
1134 void AutofillDialogControllerImpl::ViewClosed() { | 1127 void AutofillDialogControllerImpl::ViewClosed() { |
1135 GetManager()->RemoveObserver(this); | 1128 GetManager()->RemoveObserver(this); |
1136 | 1129 |
1137 if (autocheckout_is_running_ || had_autocheckout_error_) { | 1130 if (autocheckout_is_running_ || had_autocheckout_error_) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 | 1313 |
1321 void AutofillDialogControllerImpl::DidSelectSuggestion(int identifier) { | 1314 void AutofillDialogControllerImpl::DidSelectSuggestion(int identifier) { |
1322 // TODO(estade): implement. | 1315 // TODO(estade): implement. |
1323 } | 1316 } |
1324 | 1317 |
1325 void AutofillDialogControllerImpl::DidAcceptSuggestion(const string16& value, | 1318 void AutofillDialogControllerImpl::DidAcceptSuggestion(const string16& value, |
1326 int identifier) { | 1319 int identifier) { |
1327 const PersonalDataManager::GUIDPair& pair = popup_guids_[identifier]; | 1320 const PersonalDataManager::GUIDPair& pair = popup_guids_[identifier]; |
1328 | 1321 |
1329 scoped_ptr<DataModelWrapper> wrapper; | 1322 scoped_ptr<DataModelWrapper> wrapper; |
1330 if (IsCreditCardType(input_showing_popup_->type)) { | 1323 if (IsCreditCardType(input_showing_popup_type_)) { |
1331 wrapper.reset(new AutofillCreditCardWrapper( | 1324 wrapper.reset(new AutofillCreditCardWrapper( |
1332 GetManager()->GetCreditCardByGUID(pair.first))); | 1325 GetManager()->GetCreditCardByGUID(pair.first))); |
1333 } else { | 1326 } else { |
1334 wrapper.reset(new AutofillProfileWrapper( | 1327 wrapper.reset(new AutofillProfileWrapper( |
1335 GetManager()->GetProfileByGUID(pair.first), pair.second)); | 1328 GetManager()->GetProfileByGUID(pair.first), pair.second)); |
1336 } | 1329 } |
1337 | 1330 |
1338 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { | 1331 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { |
1339 DialogSection section = static_cast<DialogSection>(i); | 1332 DialogSection section = static_cast<DialogSection>(i); |
1340 wrapper->FillInputs(MutableRequestedFieldsForSection(section)); | 1333 wrapper->FillInputs(MutableRequestedFieldsForSection(section)); |
1341 view_->FillSection(section, *input_showing_popup_); | 1334 view_->FillSection(section, input_showing_popup_type_); |
1342 } | 1335 } |
1343 | 1336 |
1344 GetMetricLogger().LogDialogPopupEvent( | 1337 GetMetricLogger().LogDialogPopupEvent( |
1345 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED); | 1338 dialog_type_, AutofillMetrics::DIALOG_POPUP_FORM_FILLED); |
1346 | 1339 |
1347 // TODO(estade): not sure why it's necessary to do this explicitly. | 1340 // TODO(estade): not sure why it's necessary to do this explicitly. |
1348 HidePopup(); | 1341 HidePopup(); |
1349 } | 1342 } |
1350 | 1343 |
1351 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value, | 1344 void AutofillDialogControllerImpl::RemoveSuggestion(const string16& value, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 return source_url_.SchemeIs(chrome::kHttpsScheme) && | 1634 return source_url_.SchemeIs(chrome::kHttpsScheme) && |
1642 !net::IsCertStatusError(ssl_status_.cert_status) && | 1635 !net::IsCertStatusError(ssl_status_.cert_status) && |
1643 !net::IsCertStatusMinorError(ssl_status_.cert_status); | 1636 !net::IsCertStatusMinorError(ssl_status_.cert_status); |
1644 } | 1637 } |
1645 | 1638 |
1646 AutofillDialogControllerImpl::AutofillDialogControllerImpl( | 1639 AutofillDialogControllerImpl::AutofillDialogControllerImpl( |
1647 content::WebContents* contents, | 1640 content::WebContents* contents, |
1648 const FormData& form_structure, | 1641 const FormData& form_structure, |
1649 const GURL& source_url, | 1642 const GURL& source_url, |
1650 const DialogType dialog_type, | 1643 const DialogType dialog_type, |
1651 const base::Callback<void(const FormStructure*, | 1644 const base::Callback<void(const FormStructure*, const std::string&)>& |
1652 const std::string&)>& callback) | 1645 callback) |
1653 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | 1646 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), |
1654 contents_(contents), | 1647 contents_(contents), |
1655 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), | 1648 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
1656 dialog_type_(dialog_type), | 1649 dialog_type_(dialog_type), |
1657 form_structure_(form_structure, std::string()), | 1650 form_structure_(form_structure, std::string()), |
1658 invoked_from_same_origin_(true), | 1651 invoked_from_same_origin_(true), |
1659 source_url_(source_url), | 1652 source_url_(source_url), |
1660 ssl_status_(form_structure.ssl_status), | 1653 ssl_status_(form_structure.ssl_status), |
1661 callback_(callback), | 1654 callback_(callback), |
1662 account_chooser_model_(this, profile_->GetPrefs(), metric_logger_, | 1655 account_chooser_model_(this, |
| 1656 profile_->GetPrefs(), |
| 1657 metric_logger_, |
1663 dialog_type), | 1658 dialog_type), |
1664 wallet_client_(profile_->GetRequestContext(), this), | 1659 wallet_client_(profile_->GetRequestContext(), this), |
1665 suggested_email_(this), | 1660 suggested_email_(this), |
1666 suggested_cc_(this), | 1661 suggested_cc_(this), |
1667 suggested_billing_(this), | 1662 suggested_billing_(this), |
1668 suggested_cc_billing_(this), | 1663 suggested_cc_billing_(this), |
1669 suggested_shipping_(this), | 1664 suggested_shipping_(this), |
1670 input_showing_popup_(NULL), | 1665 input_showing_popup_type_(UNKNOWN_TYPE), |
1671 weak_ptr_factory_(this), | 1666 weak_ptr_factory_(this), |
1672 is_first_run_(!profile_->GetPrefs()->HasPrefPath( | 1667 is_first_run_(!profile_->GetPrefs()->HasPrefPath( |
1673 ::prefs::kAutofillDialogPayWithoutWallet)), | 1668 ::prefs::kAutofillDialogPayWithoutWallet)), |
1674 is_submitting_(false), | 1669 is_submitting_(false), |
1675 autocheckout_is_running_(false), | 1670 autocheckout_is_running_(false), |
1676 had_autocheckout_error_(false), | 1671 had_autocheckout_error_(false), |
1677 was_ui_latency_logged_(false) { | 1672 was_ui_latency_logged_(false) { |
1678 // TODO(estade): remove duplicates from |form_structure|? | 1673 // TODO(estade): remove duplicates from |form_structure|? |
1679 DCHECK(!callback_.is_null()); | 1674 DCHECK(!callback_.is_null()); |
1680 } | 1675 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 } | 1996 } |
2002 | 1997 |
2003 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( | 1998 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( |
2004 DialogSection section) { | 1999 DialogSection section) { |
2005 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); | 2000 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); |
2006 } | 2001 } |
2007 | 2002 |
2008 void AutofillDialogControllerImpl::HidePopup() { | 2003 void AutofillDialogControllerImpl::HidePopup() { |
2009 if (popup_controller_) | 2004 if (popup_controller_) |
2010 popup_controller_->Hide(); | 2005 popup_controller_->Hide(); |
2011 input_showing_popup_ = NULL; | 2006 input_showing_popup_type_ = UNKNOWN_TYPE; |
2012 } | 2007 } |
2013 | 2008 |
2014 void AutofillDialogControllerImpl::LoadRiskFingerprintData() { | 2009 void AutofillDialogControllerImpl::LoadRiskFingerprintData() { |
2015 // TODO(dbeam): Add a CHECK or otherwise strong guarantee that the ToS have | 2010 // TODO(dbeam): Add a CHECK or otherwise strong guarantee that the ToS have |
2016 // been accepted prior to calling into this method. Also, ensure that the UI | 2011 // been accepted prior to calling into this method. Also, ensure that the UI |
2017 // contains a clear indication to the user as to what data will be collected. | 2012 // contains a clear indication to the user as to what data will be collected. |
2018 // Until then, this code should not be called. http://crbug.com/173505 | 2013 // Until then, this code should not be called. http://crbug.com/173505 |
2019 | 2014 |
2020 int64 gaia_id = 0; | 2015 int64 gaia_id = 0; |
2021 bool success = | 2016 bool success = |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 url, | 2367 url, |
2373 content::PAGE_TRANSITION_AUTO_BOOKMARK); | 2368 content::PAGE_TRANSITION_AUTO_BOOKMARK); |
2374 params.disposition = NEW_FOREGROUND_TAB; | 2369 params.disposition = NEW_FOREGROUND_TAB; |
2375 chrome::Navigate(¶ms); | 2370 chrome::Navigate(¶ms); |
2376 #else | 2371 #else |
2377 // TODO(estade): use TabModelList? | 2372 // TODO(estade): use TabModelList? |
2378 #endif | 2373 #endif |
2379 } | 2374 } |
2380 | 2375 |
2381 } // namespace autofill | 2376 } // namespace autofill |
OLD | NEW |