Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/views/payments/shipping_address_editor_view_controll er.h" | 5 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 for (const auto& field : text_fields()) { | 327 for (const auto& field : text_fields()) { |
| 328 // Force a blur in case the value was left untouched. | 328 // Force a blur in case the value was left untouched. |
| 329 field.first->OnBlur(); | 329 field.first->OnBlur(); |
| 330 // ValidatingTextfield* is the key, EditorField is the value. | 330 // ValidatingTextfield* is the key, EditorField is the value. |
| 331 if (field.first->invalid()) { | 331 if (field.first->invalid()) { |
| 332 success = false; | 332 success = false; |
| 333 } else { | 333 } else { |
| 334 success = profile->SetInfo(autofill::AutofillType(field.second.type), | 334 success = profile->SetInfo(autofill::AutofillType(field.second.type), |
| 335 field.first->text(), locale); | 335 field.first->text(), locale); |
| 336 } | 336 } |
| 337 DCHECK(success || ignore_errors) | 337 LOG_IF(ERROR, success || ignore_errors) |
|
anthonyvd
2017/05/11 20:06:29
Are those going to be useful (especially after we
MAD
2017/05/11 20:19:53
Should still be useful in browser tests. Doesn't t
anthonyvd
2017/05/11 20:21:59
I don't think so. This is called when the Done but
| |
| 338 << "Can't setinfo(" << field.second.type << ", " << field.first->text(); | 338 << "Can't setinfo(" << field.second.type << ", " << field.first->text(); |
| 339 if (!success && !ignore_errors) | 339 if (!success && !ignore_errors) |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 for (const auto& field : comboboxes()) { | 342 for (const auto& field : comboboxes()) { |
| 343 // ValidatingCombobox* is the key, EditorField is the value. | 343 // ValidatingCombobox* is the key, EditorField is the value. |
| 344 ValidatingCombobox* combobox = field.first; | 344 ValidatingCombobox* combobox = field.first; |
| 345 if (combobox->invalid()) { | 345 if (combobox->invalid()) { |
| 346 success = false; | 346 success = false; |
| 347 } else { | 347 } else { |
| 348 if (combobox->id() == autofill::ADDRESS_HOME_COUNTRY) { | 348 if (combobox->id() == autofill::ADDRESS_HOME_COUNTRY) { |
| 349 success = profile->SetInfo( | 349 success = profile->SetInfo( |
| 350 autofill::AutofillType(field.second.type), | 350 autofill::AutofillType(field.second.type), |
| 351 base::UTF8ToUTF16(country_codes_[combobox->selected_index()]), | 351 base::UTF8ToUTF16(country_codes_[combobox->selected_index()]), |
| 352 locale); | 352 locale); |
| 353 } else { | 353 } else { |
| 354 success = profile->SetInfo( | 354 success = profile->SetInfo( |
| 355 autofill::AutofillType(field.second.type), | 355 autofill::AutofillType(field.second.type), |
| 356 combobox->GetTextForRow(combobox->selected_index()), locale); | 356 combobox->GetTextForRow(combobox->selected_index()), locale); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 DCHECK(success || ignore_errors) | 359 LOG_IF(ERROR, success || ignore_errors) |
| 360 << "Can't setinfo(" << field.second.type << ", " | 360 << "Can't setinfo(" << field.second.type << ", " |
| 361 | |
| 362 << combobox->GetTextForRow(combobox->selected_index()); | 361 << combobox->GetTextForRow(combobox->selected_index()); |
| 363 if (!success && !ignore_errors) | 362 if (!success && !ignore_errors) |
| 364 return false; | 363 return false; |
| 365 } | 364 } |
| 366 return success; | 365 return success; |
| 367 } | 366 } |
| 368 | 367 |
| 369 void ShippingAddressEditorViewController::OnComboboxModelChanged( | 368 void ShippingAddressEditorViewController::OnComboboxModelChanged( |
| 370 views::Combobox* combobox) { | 369 views::Combobox* combobox) { |
| 371 if (combobox->id() != autofill::ADDRESS_HOME_STATE) | 370 if (combobox->id() != autofill::ADDRESS_HOME_STATE) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 bool is_required_valid = !field_.required; | 429 bool is_required_valid = !field_.required; |
| 431 const base::string16 displayed_message = | 430 const base::string16 displayed_message = |
| 432 is_required_valid ? base::ASCIIToUTF16("") | 431 is_required_valid ? base::ASCIIToUTF16("") |
| 433 : l10n_util::GetStringUTF16( | 432 : l10n_util::GetStringUTF16( |
| 434 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 433 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); |
| 435 controller_->DisplayErrorMessageForField(field_, displayed_message); | 434 controller_->DisplayErrorMessageForField(field_, displayed_message); |
| 436 return is_required_valid; | 435 return is_required_valid; |
| 437 } | 436 } |
| 438 | 437 |
| 439 } // namespace payments | 438 } // namespace payments |
| OLD | NEW |