| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 views::Combobox* country_combo_box = static_cast<views::Combobox*>( | 200 views::Combobox* country_combo_box = static_cast<views::Combobox*>( |
| 201 dialog()->GetViewByID(autofill::ADDRESS_HOME_COUNTRY)); | 201 dialog()->GetViewByID(autofill::ADDRESS_HOME_COUNTRY)); |
| 202 DCHECK(country_combo_box); | 202 DCHECK(country_combo_box); |
| 203 country_combo_box->SetSelectedIndex(chosen_country_index_); | 203 country_combo_box->SetSelectedIndex(chosen_country_index_); |
| 204 } | 204 } |
| 205 // Ignore temporary profile once the editor view has been updated. | 205 // Ignore temporary profile once the editor view has been updated. |
| 206 temporary_profile_.reset(nullptr); | 206 temporary_profile_.reset(nullptr); |
| 207 } | 207 } |
| 208 | 208 |
| 209 base::string16 ShippingAddressEditorViewController::GetSheetTitle() { | 209 base::string16 ShippingAddressEditorViewController::GetSheetTitle() { |
| 210 return l10n_util::GetStringUTF16( | 210 // TODO(crbug.com/712074): Editor title should reflect the missing information |
| 211 IDS_PAYMENT_REQUEST_ADDRESS_EDITOR_ADD_TITLE); | 211 // in the case that one or more fields are missing. |
| 212 return profile_to_edit_ ? l10n_util::GetStringUTF16(IDS_PAYMENTS_EDIT_ADDRESS) |
| 213 : l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_ADDRESS); |
| 212 } | 214 } |
| 213 | 215 |
| 214 void ShippingAddressEditorViewController::UpdateEditorFields() { | 216 void ShippingAddressEditorViewController::UpdateEditorFields() { |
| 215 editor_fields_.clear(); | 217 editor_fields_.clear(); |
| 216 std::string chosen_country_code; | 218 std::string chosen_country_code; |
| 217 if (chosen_country_index_ < country_codes_.size()) | 219 if (chosen_country_index_ < country_codes_.size()) |
| 218 chosen_country_code = country_codes_[chosen_country_index_]; | 220 chosen_country_code = country_codes_[chosen_country_index_]; |
| 219 | 221 |
| 220 std::unique_ptr<base::ListValue> components(new base::ListValue); | 222 std::unique_ptr<base::ListValue> components(new base::ListValue); |
| 221 std::string unused; | 223 std::string unused; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 bool is_required_valid = !field_.required; | 406 bool is_required_valid = !field_.required; |
| 405 const base::string16 displayed_message = | 407 const base::string16 displayed_message = |
| 406 is_required_valid ? base::ASCIIToUTF16("") | 408 is_required_valid ? base::ASCIIToUTF16("") |
| 407 : l10n_util::GetStringUTF16( | 409 : l10n_util::GetStringUTF16( |
| 408 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 410 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); |
| 409 controller_->DisplayErrorMessageForField(field_, displayed_message); | 411 controller_->DisplayErrorMessageForField(field_, displayed_message); |
| 410 return is_required_valid; | 412 return is_required_valid; |
| 411 } | 413 } |
| 412 | 414 |
| 413 } // namespace payments | 415 } // namespace payments |
| OLD | NEW |