Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc

Issue 2943113003: Merge-60 Select saved region when loaded async in ship addr editor. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return; 428 return;
429 autofill::RegionComboboxModel* model = 429 autofill::RegionComboboxModel* model =
430 static_cast<autofill::RegionComboboxModel*>(combobox->model()); 430 static_cast<autofill::RegionComboboxModel*>(combobox->model());
431 if (model->IsPendingRegionDataLoad()) 431 if (model->IsPendingRegionDataLoad())
432 return; 432 return;
433 if (model->failed_to_load_data()) { 433 if (model->failed_to_load_data()) {
434 failed_to_load_region_data_ = true; 434 failed_to_load_region_data_ = true;
435 // It is safe to update synchronously since the change comes from the model 435 // It is safe to update synchronously since the change comes from the model
436 // and not from the UI. 436 // and not from the UI.
437 OnDataChanged(/*synchronous=*/true); 437 OnDataChanged(/*synchronous=*/true);
438 } else {
439 base::string16 state_value =
440 GetInitialValueForType(autofill::ADDRESS_HOME_STATE);
441 if (!state_value.empty()) {
442 combobox->SelectValue(state_value);
443 OnPerformAction(combobox);
444 }
438 } 445 }
439 } 446 }
440 447
441 bool ShippingAddressEditorViewController::GetSheetId(DialogViewID* sheet_id) { 448 bool ShippingAddressEditorViewController::GetSheetId(DialogViewID* sheet_id) {
442 *sheet_id = DialogViewID::SHIPPING_ADDRESS_EDITOR_SHEET; 449 *sheet_id = DialogViewID::SHIPPING_ADDRESS_EDITOR_SHEET;
443 return true; 450 return true;
444 } 451 }
445 452
446 ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: 453 ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
447 ShippingAddressValidationDelegate( 454 ShippingAddressValidationDelegate(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 return true; 537 return true;
531 } 538 }
532 if (error_message && field_.required) { 539 if (error_message && field_.required) {
533 *error_message = l10n_util::GetStringUTF16( 540 *error_message = l10n_util::GetStringUTF16(
534 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 541 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
535 } 542 }
536 return !field_.required; 543 return !field_.required;
537 } 544 }
538 545
539 } // namespace payments 546 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698