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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 } | 99 } |
100 | 100 |
101 // Returns true if |input| should be used for a site-requested |field|. | 101 // Returns true if |input| should be used for a site-requested |field|. |
102 bool DetailInputMatchesField(const DetailInput& input, | 102 bool DetailInputMatchesField(const DetailInput& input, |
103 const AutofillField& field) { | 103 const AutofillField& field) { |
104 bool right_section = !input.section_suffix || | 104 bool right_section = !input.section_suffix || |
105 EndsWith(field.section(), input.section_suffix, false); | 105 EndsWith(field.section(), input.section_suffix, false); |
106 return InputTypeMatchesFieldType(input, field) && right_section; | 106 return InputTypeMatchesFieldType(input, field) && right_section; |
107 } | 107 } |
108 | 108 |
109 bool CreditCardType(AutofillFieldType type) { | |
Ilya Sherman
2013/03/14 21:59:08
nit: IsCreditCardType
Dan Beam
2013/03/14 23:49:35
Done.
| |
110 return AutofillType(type).group() == AutofillType::CREDIT_CARD; | |
111 } | |
112 | |
113 bool DetailInputMatchesCreditCard(const DetailInput& input, | |
114 const AutofillField& field) { | |
115 return DetailInputMatchesField(input, field) && CreditCardType(input.type); | |
116 } | |
117 | |
118 bool DetailInputMatchesBilling(const DetailInput& input, | |
119 const AutofillField& field) { | |
120 return DetailInputMatchesField(input, field) && !CreditCardType(input.type); | |
121 } | |
122 | |
109 // Returns true if |input| should be used to fill a site-requested |field| which | 123 // Returns true if |input| should be used to fill a site-requested |field| which |
110 // is notated with a "shipping" tag, for use when the user has decided to use | 124 // is notated with a "shipping" tag, for use when the user has decided to use |
111 // the billing address as the shipping address. | 125 // the billing address as the shipping address. |
112 bool DetailInputMatchesShippingField(const DetailInput& input, | 126 bool DetailInputMatchesShippingField(const DetailInput& input, |
113 const AutofillField& field) { | 127 const AutofillField& field) { |
114 if (input.section_suffix && | 128 if (input.section_suffix && |
115 std::string(input.section_suffix) == "billing") { | 129 std::string(input.section_suffix) == "billing") { |
116 return InputTypeMatchesFieldType(input, field); | 130 return InputTypeMatchesFieldType(input, field); |
117 } | 131 } |
118 | 132 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 } | 166 } |
153 } | 167 } |
154 | 168 |
155 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. | 169 // Get billing info from |output| and put it into |card|, |cvc|, and |profile|. |
156 // These outparams are required because |card|/|profile| accept different types | 170 // These outparams are required because |card|/|profile| accept different types |
157 // of raw info, and CreditCard doesn't save CVCs. | 171 // of raw info, and CreditCard doesn't save CVCs. |
158 void GetBillingInfoFromOutputs(const DetailOutputMap& output, | 172 void GetBillingInfoFromOutputs(const DetailOutputMap& output, |
159 CreditCard* card, | 173 CreditCard* card, |
160 string16* cvc, | 174 string16* cvc, |
161 AutofillProfile* profile) { | 175 AutofillProfile* profile) { |
176 DCHECK(card); | |
177 DCHECK(cvc); | |
178 DCHECK(profile); | |
Ilya Sherman
2013/03/14 21:59:08
These don't seem very helpful, since you dereferen
Dan Beam
2013/03/14 23:49:35
Done.
| |
179 | |
162 for (DetailOutputMap::const_iterator it = output.begin(); | 180 for (DetailOutputMap::const_iterator it = output.begin(); |
163 it != output.end(); ++it) { | 181 it != output.end(); ++it) { |
164 string16 trimmed; | 182 string16 trimmed; |
165 TrimWhitespace(it->second, TRIM_ALL, &trimmed); | 183 TrimWhitespace(it->second, TRIM_ALL, &trimmed); |
166 | 184 |
167 // Special case CVC as CreditCard just swallows it. | 185 // Special case CVC as CreditCard just swallows it. |
168 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { | 186 if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) { |
169 *cvc = trimmed; | 187 cvc->assign(trimmed); |
Ilya Sherman
2013/03/14 21:59:08
Just curious, why did you change this?
Dan Beam
2013/03/14 23:49:35
seemed like this is the intended API, akin to sayi
| |
170 } else { | 188 } else { |
171 // Copy the credit card name to |profile| in addition to |card| as | 189 // Copy the credit card name to |profile| in addition to |card| as |
172 // wallet::Instrument requires a recipient name for its billing address. | 190 // wallet::Instrument requires a recipient name for its billing address. |
173 if (it->first->type == CREDIT_CARD_NAME) | 191 if (it->first->type == CREDIT_CARD_NAME) |
174 profile->SetRawInfo(NAME_FULL, trimmed); | 192 profile->SetRawInfo(NAME_FULL, trimmed); |
175 | 193 |
176 if (AutofillType(it->first->type).group() == AutofillType::CREDIT_CARD) | 194 if (CreditCardType(it->first->type)) |
177 card->SetRawInfo(it->first->type, trimmed); | 195 card->SetRawInfo(it->first->type, trimmed); |
178 else | 196 else |
179 profile->SetRawInfo(it->first->type, trimmed); | 197 profile->SetRawInfo(it->first->type, trimmed); |
180 } | 198 } |
181 } | 199 } |
182 } | 200 } |
183 | 201 |
184 // Returns the containing window for the given |web_contents|. The containing | 202 // Returns the containing window for the given |web_contents|. The containing |
185 // window might be a browser window for a Chrome tab, or it might be a shell | 203 // window might be a browser window for a Chrome tab, or it might be a shell |
186 // window for a platform app. | 204 // window for a platform app. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 | 606 |
589 scoped_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( | 607 scoped_ptr<DataModelWrapper> AutofillDialogControllerImpl::CreateWrapper( |
590 DialogSection section) { | 608 DialogSection section) { |
591 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); | 609 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); |
592 std::string item_key = model->GetItemKeyForCheckedItem(); | 610 std::string item_key = model->GetItemKeyForCheckedItem(); |
593 scoped_ptr<DataModelWrapper> wrapper; | 611 scoped_ptr<DataModelWrapper> wrapper; |
594 if (item_key.empty()) | 612 if (item_key.empty()) |
595 return wrapper.Pass(); | 613 return wrapper.Pass(); |
596 | 614 |
597 if (IsPayingWithWallet()) { | 615 if (IsPayingWithWallet()) { |
598 int index; | 616 if (did_submit_ && full_wallet_.get()) { |
599 bool success = base::StringToInt(item_key, &index); | 617 if (section == SECTION_CC_BILLING) |
600 DCHECK(success); | 618 wrapper.reset(new FullWalletBillingWrapper(full_wallet_.get())); |
619 else | |
620 wrapper.reset(new FullWalletShippingWrapper(full_wallet_.get())); | |
621 } else { | |
622 int index; | |
623 bool success = base::StringToInt(item_key, &index); | |
624 DCHECK(success); | |
601 | 625 |
602 if (section == SECTION_CC_BILLING) { | 626 if (section == SECTION_CC_BILLING) { |
603 wrapper.reset( | 627 wrapper.reset( |
604 new WalletInstrumentWrapper(wallet_items_->instruments()[index])); | 628 new WalletInstrumentWrapper(wallet_items_->instruments()[index])); |
605 } else { | 629 } else { |
606 wrapper.reset( | 630 wrapper.reset( |
607 new WalletAddressWrapper(wallet_items_->addresses()[index])); | 631 new WalletAddressWrapper(wallet_items_->addresses()[index])); |
632 } | |
608 } | 633 } |
Ilya Sherman
2013/03/14 21:59:08
nit: Some docs for the code flow logic here would
Dan Beam
2013/03/14 23:49:35
Done.
| |
609 } else if (section == SECTION_CC) { | 634 } else if (section == SECTION_CC) { |
610 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key); | 635 CreditCard* card = GetManager()->GetCreditCardByGUID(item_key); |
611 DCHECK(card); | 636 DCHECK(card); |
612 wrapper.reset(new AutofillCreditCardWrapper(card)); | 637 wrapper.reset(new AutofillCreditCardWrapper(card)); |
613 } else { | 638 } else { |
614 // Calculate the variant by looking at how many items come from the same | 639 // Calculate the variant by looking at how many items come from the same |
615 // FormGroup. | 640 // FormGroup. |
616 size_t variant = 0; | 641 size_t variant = 0; |
617 for (int i = model->checked_item() - 1; i >= 0; --i) { | 642 for (int i = model->checked_item() - 1; i >= 0; --i) { |
618 if (model->GetItemKeyAt(i) == item_key) | 643 if (model->GetItemKeyAt(i) == item_key) |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1176 if (popup_controller_) | 1201 if (popup_controller_) |
1177 return popup_controller_->HandleKeyPressEvent(event); | 1202 return popup_controller_->HandleKeyPressEvent(event); |
1178 | 1203 |
1179 return false; | 1204 return false; |
1180 } | 1205 } |
1181 | 1206 |
1182 bool AutofillDialogControllerImpl::RequestingCreditCardInfo() const { | 1207 bool AutofillDialogControllerImpl::RequestingCreditCardInfo() const { |
1183 DCHECK_GT(form_structure_.field_count(), 0U); | 1208 DCHECK_GT(form_structure_.field_count(), 0U); |
1184 | 1209 |
1185 for (size_t i = 0; i < form_structure_.field_count(); ++i) { | 1210 for (size_t i = 0; i < form_structure_.field_count(); ++i) { |
1186 if (AutofillType(form_structure_.field(i)->type()).group() == | 1211 if (CreditCardType(form_structure_.field(i)->type())) |
1187 AutofillType::CREDIT_CARD) { | |
1188 return true; | 1212 return true; |
1189 } | |
1190 } | 1213 } |
1191 | 1214 |
1192 return false; | 1215 return false; |
1193 } | 1216 } |
1194 | 1217 |
1195 bool AutofillDialogControllerImpl::TransmissionWillBeSecure() const { | 1218 bool AutofillDialogControllerImpl::TransmissionWillBeSecure() const { |
1196 return source_url_.SchemeIs(chrome::kHttpsScheme) && | 1219 return source_url_.SchemeIs(chrome::kHttpsScheme) && |
1197 !net::IsCertStatusError(ssl_status_.cert_status) && | 1220 !net::IsCertStatusError(ssl_status_.cert_status) && |
1198 !net::IsCertStatusMinorError(ssl_status_.cert_status); | 1221 !net::IsCertStatusMinorError(ssl_status_.cert_status); |
1199 } | 1222 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 return true; | 1346 return true; |
1324 } | 1347 } |
1325 | 1348 |
1326 void AutofillDialogControllerImpl::FillOutputForSectionWithComparator( | 1349 void AutofillDialogControllerImpl::FillOutputForSectionWithComparator( |
1327 DialogSection section, | 1350 DialogSection section, |
1328 const InputFieldComparator& compare) { | 1351 const InputFieldComparator& compare) { |
1329 if (!SectionIsActive(section)) | 1352 if (!SectionIsActive(section)) |
1330 return; | 1353 return; |
1331 | 1354 |
1332 if (!IsManuallyEditingSection(section)) { | 1355 if (!IsManuallyEditingSection(section)) { |
1333 if (section == SECTION_CC_BILLING) { | 1356 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); |
1334 // TODO(dbeam): implement. | 1357 // Only fill in data that is associated with this section. |
1335 } else { | 1358 const DetailInputs& inputs = RequestedFieldsForSection(section); |
1336 scoped_ptr<DataModelWrapper> model = CreateWrapper(section); | 1359 model->FillFormStructure(inputs, compare, &form_structure_); |
1337 // Only fill in data that is associated with this section. | |
1338 const DetailInputs& inputs = RequestedFieldsForSection(section); | |
1339 model->FillFormStructure(inputs, compare, &form_structure_); | |
1340 | 1360 |
1341 // CVC needs special-casing because the CreditCard class doesn't store | 1361 // CVC needs special-casing because the CreditCard class doesn't store |
1342 // or handle them. | 1362 // or handle them. |
1343 if (section == SECTION_CC) | 1363 if (section == SECTION_CC) |
Ilya Sherman
2013/03/14 21:59:08
Should this apply to SECTION_CC_BILLING as well?
Dan Beam
2013/03/14 23:49:35
No, we need to get the CVC from |full_wallet_|; ad
| |
1344 SetCvcResult(view_->GetCvc()); | 1364 SetCvcResult(view_->GetCvc()); |
1345 } | |
1346 } else { | 1365 } else { |
1347 // The user manually input data. | 1366 // The user manually input data. If using Autofill, save the info as new or |
1367 // edited data. Always fill local data into |form_structure_|. | |
1348 DetailOutputMap output; | 1368 DetailOutputMap output; |
1349 view_->GetUserInput(section, &output); | 1369 view_->GetUserInput(section, &output); |
1350 | 1370 |
1351 if (IsPayingWithWallet()) { | 1371 if (section == SECTION_CC_BILLING) { |
1352 // TODO(dbeam): implement. | 1372 CreditCard card; |
1373 string16 cvc; | |
1374 AutofillProfile profile; | |
1375 GetBillingInfoFromOutputs(output, &card, &cvc, &profile); | |
1376 | |
1377 // |card| and |profile| can't be asked for the wrong types without | |
1378 // DCHECK()'ing, so we split the filling into CC and non-CC. | |
1379 FillFormStructureForSection(card, 0, section, | |
1380 base::Bind(DetailInputMatchesCreditCard)); | |
1381 FillFormStructureForSection(profile, 0, section, | |
1382 base::Bind(DetailInputMatchesBilling)); | |
1383 SetCvcResult(cvc); | |
1384 } else if (section == SECTION_CC) { | |
1385 CreditCard card; | |
1386 FillFormGroupFromOutputs(output, &card); | |
1387 | |
1388 if (ShouldSaveDetailsLocally()) | |
1389 GetManager()->SaveImportedCreditCard(card); | |
1390 | |
1391 FillFormStructureForSection(card, 0, section, compare); | |
1392 | |
1393 // Again, CVC needs special-casing. Fill it in directly from |output|. | |
1394 SetCvcResult(GetValueForType(output, CREDIT_CARD_VERIFICATION_CODE)); | |
1353 } else { | 1395 } else { |
Ilya Sherman
2013/03/14 21:59:08
Can you DCHECK that the section is the one you exp
Dan Beam
2013/03/14 23:49:35
This hunk of the diff was reverted and now it'd be
| |
1354 // Save the info as new or edited data and fill it into |form_structure_|. | 1396 AutofillProfile profile; |
1355 if (section == SECTION_CC) { | 1397 FillFormGroupFromOutputs(output, &profile); |
1356 CreditCard card; | |
1357 FillFormGroupFromOutputs(output, &card); | |
1358 | 1398 |
1359 if (view_->SaveDetailsLocally()) | 1399 // TODO(estade): we should probably edit the existing profile in the |
1360 GetManager()->SaveImportedCreditCard(card); | 1400 // cases where the input data is based on an existing profile (user |
1401 // clicked "Edit" or autofill popup filled in the form). | |
1402 if (ShouldSaveDetailsLocally()) | |
1403 GetManager()->SaveImportedProfile(profile); | |
1361 | 1404 |
1362 FillFormStructureForSection(card, 0, section, compare); | 1405 FillFormStructureForSection(profile, 0, section, compare); |
1363 | |
1364 // Again, CVC needs special-casing. Fill it in directly from |output|. | |
1365 SetCvcResult(GetValueForType(output, CREDIT_CARD_VERIFICATION_CODE)); | |
1366 } else { | |
1367 AutofillProfile profile; | |
1368 FillFormGroupFromOutputs(output, &profile); | |
1369 | |
1370 // TODO(estade): we should probably edit the existing profile in the | |
1371 // cases where the input data is based on an existing profile (user | |
1372 // clicked "Edit" or autofill popup filled in the form). | |
1373 if (view_->SaveDetailsLocally()) | |
1374 GetManager()->SaveImportedProfile(profile); | |
1375 | |
1376 FillFormStructureForSection(profile, 0, section, compare); | |
1377 } | |
1378 } | 1406 } |
1379 } | 1407 } |
1380 } | 1408 } |
1381 | 1409 |
1382 void AutofillDialogControllerImpl::FillOutputForSection(DialogSection section) { | 1410 void AutofillDialogControllerImpl::FillOutputForSection(DialogSection section) { |
1383 FillOutputForSectionWithComparator(section, | 1411 FillOutputForSectionWithComparator(section, |
1384 base::Bind(DetailInputMatchesField)); | 1412 base::Bind(DetailInputMatchesField)); |
1385 } | 1413 } |
1386 | 1414 |
1387 void AutofillDialogControllerImpl::FillFormStructureForSection( | 1415 void AutofillDialogControllerImpl::FillFormStructureForSection( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1491 NOTIMPLEMENTED(); | 1519 NOTIMPLEMENTED(); |
1492 } | 1520 } |
1493 | 1521 |
1494 bool AutofillDialogControllerImpl::IsManuallyEditingSection( | 1522 bool AutofillDialogControllerImpl::IsManuallyEditingSection( |
1495 DialogSection section) { | 1523 DialogSection section) { |
1496 return section_editing_state_[section] || | 1524 return section_editing_state_[section] || |
1497 SuggestionsMenuModelForSection(section)-> | 1525 SuggestionsMenuModelForSection(section)-> |
1498 GetItemKeyForCheckedItem().empty(); | 1526 GetItemKeyForCheckedItem().empty(); |
1499 } | 1527 } |
1500 | 1528 |
1501 bool AutofillDialogControllerImpl::UseBillingForShipping() { | 1529 bool AutofillDialogControllerImpl::ShouldUseBillingForShipping() { |
1502 // If the user is editing or inputting data, ask the view. | 1530 // If the user is editing or inputting data, ask the view. |
1503 if (IsManuallyEditingSection(SECTION_SHIPPING)) | 1531 if (IsManuallyEditingSection(SECTION_SHIPPING)) |
1504 return view_->UseBillingForShipping(); | 1532 return view_->UseBillingForShipping(); |
1505 | 1533 |
1506 // Otherwise, the checkbox should be hidden so its state is irrelevant. | 1534 // Otherwise, the checkbox should be hidden so its state is irrelevant. |
1507 // Always use the shipping suggestion model. | 1535 // Always use the shipping suggestion model. |
1508 return false; | 1536 return false; |
1509 } | 1537 } |
1510 | 1538 |
1539 bool AutofillDialogControllerImpl::ShouldSaveDetailsLocally() { | |
1540 return !IsPayingWithWallet() && view_->SaveDetailsLocally(); | |
Ilya Sherman
2013/03/14 21:59:08
nit: Please include a comment explaining why we ne
Dan Beam
2013/03/14 23:49:35
Done.
| |
1541 } | |
1542 | |
1511 void AutofillDialogControllerImpl::SubmitWithWallet() { | 1543 void AutofillDialogControllerImpl::SubmitWithWallet() { |
1512 // TODO(dbeam): disallow interacting with the dialog while submitting. | 1544 // TODO(dbeam): disallow interacting with the dialog while submitting. |
1513 | 1545 |
1514 active_instrument_id_.clear(); | 1546 active_instrument_id_.clear(); |
1515 active_address_id_.clear(); | 1547 active_address_id_.clear(); |
1516 | 1548 |
1517 if (!section_editing_state_[SECTION_CC_BILLING]) { | 1549 if (!section_editing_state_[SECTION_CC_BILLING]) { |
1518 SuggestionsMenuModel* billing = | 1550 SuggestionsMenuModel* billing = |
1519 SuggestionsMenuModelForSection(SECTION_CC_BILLING); | 1551 SuggestionsMenuModelForSection(SECTION_CC_BILLING); |
1520 if (!billing->GetItemKeyForCheckedItem().empty() && | 1552 if (!billing->GetItemKeyForCheckedItem().empty() && |
1521 billing->checked_item() < | 1553 billing->checked_item() < |
1522 static_cast<int>(wallet_items_->instruments().size())) { | 1554 static_cast<int>(wallet_items_->instruments().size())) { |
1523 const wallet::WalletItems::MaskedInstrument* active_instrument = | 1555 const wallet::WalletItems::MaskedInstrument* active_instrument = |
1524 wallet_items_->instruments()[billing->checked_item()]; | 1556 wallet_items_->instruments()[billing->checked_item()]; |
1525 active_instrument_id_ = active_instrument->object_id(); | 1557 active_instrument_id_ = active_instrument->object_id(); |
1526 | 1558 |
1527 // TODO(dbeam): does re-using instrument address IDs work? | 1559 // TODO(dbeam): does re-using instrument address IDs work? |
1528 if (UseBillingForShipping()) | 1560 if (ShouldUseBillingForShipping()) |
1529 active_address_id_ = active_instrument->address().object_id(); | 1561 active_address_id_ = active_instrument->address().object_id(); |
1530 } | 1562 } |
1531 } | 1563 } |
1532 | 1564 |
1533 if (!section_editing_state_[SECTION_SHIPPING] && active_address_id_.empty()) { | 1565 if (!section_editing_state_[SECTION_SHIPPING] && active_address_id_.empty()) { |
1534 SuggestionsMenuModel* shipping = | 1566 SuggestionsMenuModel* shipping = |
1535 SuggestionsMenuModelForSection(SECTION_SHIPPING); | 1567 SuggestionsMenuModelForSection(SECTION_SHIPPING); |
1536 if (!shipping->GetItemKeyForCheckedItem().empty() && | 1568 if (!shipping->GetItemKeyForCheckedItem().empty() && |
1537 shipping->checked_item() < | 1569 shipping->checked_item() < |
1538 static_cast<int>(wallet_items_->addresses().size())) { | 1570 static_cast<int>(wallet_items_->addresses().size())) { |
(...skipping 20 matching lines...) Expand all Loading... | |
1559 CreditCard card; | 1591 CreditCard card; |
1560 AutofillProfile profile; | 1592 AutofillProfile profile; |
1561 string16 cvc; | 1593 string16 cvc; |
1562 GetBillingInfoFromOutputs(output, &card, &cvc, &profile); | 1594 GetBillingInfoFromOutputs(output, &card, &cvc, &profile); |
1563 | 1595 |
1564 new_instrument.reset(new wallet::Instrument(card, cvc, profile)); | 1596 new_instrument.reset(new wallet::Instrument(card, cvc, profile)); |
1565 } | 1597 } |
1566 | 1598 |
1567 scoped_ptr<wallet::Address> new_address; | 1599 scoped_ptr<wallet::Address> new_address; |
1568 if (active_address_id_.empty()) { | 1600 if (active_address_id_.empty()) { |
1569 if (UseBillingForShipping() && new_instrument.get()) { | 1601 if (ShouldUseBillingForShipping() && new_instrument.get()) { |
1570 new_address.reset(new wallet::Address(new_instrument->address())); | 1602 new_address.reset(new wallet::Address(new_instrument->address())); |
1571 } else { | 1603 } else { |
1572 DetailOutputMap output; | 1604 DetailOutputMap output; |
1573 view_->GetUserInput(SECTION_SHIPPING, &output); | 1605 view_->GetUserInput(SECTION_SHIPPING, &output); |
1574 | 1606 |
1575 AutofillProfile profile; | 1607 AutofillProfile profile; |
1576 FillFormGroupFromOutputs(output, &profile); | 1608 FillFormGroupFromOutputs(output, &profile); |
1577 | 1609 |
1578 new_address.reset(new wallet::Address(profile)); | 1610 new_address.reset(new wallet::Address(profile)); |
1579 } | 1611 } |
(...skipping 30 matching lines...) Expand all Loading... | |
1610 wallet_items_->google_transaction_id(), | 1642 wallet_items_->google_transaction_id(), |
1611 dialog_type_, | 1643 dialog_type_, |
1612 std::vector<wallet::WalletClient::RiskCapability>())); | 1644 std::vector<wallet::WalletClient::RiskCapability>())); |
1613 } | 1645 } |
1614 | 1646 |
1615 void AutofillDialogControllerImpl::FinishSubmit() { | 1647 void AutofillDialogControllerImpl::FinishSubmit() { |
1616 FillOutputForSection(SECTION_EMAIL); | 1648 FillOutputForSection(SECTION_EMAIL); |
1617 FillOutputForSection(SECTION_CC); | 1649 FillOutputForSection(SECTION_CC); |
1618 FillOutputForSection(SECTION_BILLING); | 1650 FillOutputForSection(SECTION_BILLING); |
1619 FillOutputForSection(SECTION_CC_BILLING); | 1651 FillOutputForSection(SECTION_CC_BILLING); |
1620 if (UseBillingForShipping()) { | 1652 if (ShouldUseBillingForShipping()) { |
1621 FillOutputForSectionWithComparator( | 1653 FillOutputForSectionWithComparator( |
1622 SECTION_BILLING, | 1654 SECTION_BILLING, |
1623 base::Bind(DetailInputMatchesShippingField)); | 1655 base::Bind(DetailInputMatchesShippingField)); |
1624 FillOutputForSectionWithComparator( | 1656 FillOutputForSectionWithComparator( |
1625 SECTION_CC, | 1657 SECTION_CC, |
1626 base::Bind(DetailInputMatchesShippingField)); | 1658 base::Bind(DetailInputMatchesShippingField)); |
1627 } else { | 1659 } else { |
1628 FillOutputForSection(SECTION_SHIPPING); | 1660 FillOutputForSection(SECTION_SHIPPING); |
1629 } | 1661 } |
1630 callback_.Run(&form_structure_); | 1662 callback_.Run(&form_structure_); |
1631 callback_ = base::Callback<void(const FormStructure*)>(); | 1663 callback_ = base::Callback<void(const FormStructure*)>(); |
1632 | 1664 |
1633 if (dialog_type_ == DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { | 1665 if (dialog_type_ == DIALOG_TYPE_REQUEST_AUTOCOMPLETE) { |
1634 // This may delete us. | 1666 // This may delete us. |
1635 Hide(); | 1667 Hide(); |
1636 } | 1668 } |
1637 } | 1669 } |
1638 | 1670 |
1639 } // namespace autofill | 1671 } // namespace autofill |
OLD | NEW |