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/profile_list_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 void SelectedStateChanged() override { | 70 void SelectedStateChanged() override { |
71 if (selected()) { | 71 if (selected()) { |
72 parent_view_->SelectProfile(profile_); | 72 parent_view_->SelectProfile(profile_); |
73 dialog_->GoBack(); | 73 dialog_->GoBack(); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 bool CanBeSelected() const override { | 77 bool CanBeSelected() const override { |
78 // TODO(anthonyvd): Check for profile completedness. | 78 // TODO(crbug.com/709454): Check for profile completeness. Currently a giant |
79 return true; | 79 // hack to test the UI. |
| 80 return !profile_->GetRawInfo(autofill::ADDRESS_HOME_ZIP).empty(); |
80 } | 81 } |
81 | 82 |
82 void PerformSelectionFallback() override { | 83 void PerformSelectionFallback() override { |
83 // TODO(anthonyvd): Open the editor pre-populated with this profile's data. | 84 dialog_->ShowShippingAddressEditor(profile_); |
84 } | 85 } |
85 | 86 |
86 ProfileListViewController* parent_view_; | 87 ProfileListViewController* parent_view_; |
87 autofill::AutofillProfile* profile_; | 88 autofill::AutofillProfile* profile_; |
88 PaymentRequestDialogView* dialog_; | 89 PaymentRequestDialogView* dialog_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(ProfileItem); | 91 DISALLOW_COPY_AND_ASSIGN(ProfileItem); |
91 }; | 92 }; |
92 | 93 |
93 // The ProfileListViewController subtype for the Shipping address list | 94 // The ProfileListViewController subtype for the Shipping address list |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 278 |
278 void ProfileListViewController::ButtonPressed(views::Button* sender, | 279 void ProfileListViewController::ButtonPressed(views::Button* sender, |
279 const ui::Event& event) { | 280 const ui::Event& event) { |
280 if (sender->tag() == GetSecondaryButtonTag()) | 281 if (sender->tag() == GetSecondaryButtonTag()) |
281 OnSecondaryButtonPressed(); | 282 OnSecondaryButtonPressed(); |
282 else | 283 else |
283 PaymentRequestSheetController::ButtonPressed(sender, event); | 284 PaymentRequestSheetController::ButtonPressed(sender, event); |
284 } | 285 } |
285 | 286 |
286 } // namespace payments | 287 } // namespace payments |
OLD | NEW |