| 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 10 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ProfileItem(autofill::AutofillProfile* profile, | 51 ProfileItem(autofill::AutofillProfile* profile, |
| 52 PaymentRequestSpec* spec, | 52 PaymentRequestSpec* spec, |
| 53 PaymentRequestState* state, | 53 PaymentRequestState* state, |
| 54 PaymentRequestItemList* parent_list, | 54 PaymentRequestItemList* parent_list, |
| 55 ProfileListViewController* parent_view, | 55 ProfileListViewController* parent_view, |
| 56 PaymentRequestDialogView* dialog, | 56 PaymentRequestDialogView* dialog, |
| 57 bool selected) | 57 bool selected) |
| 58 : payments::PaymentRequestItemList::Item(spec, | 58 : payments::PaymentRequestItemList::Item(spec, |
| 59 state, | 59 state, |
| 60 parent_list, | 60 parent_list, |
| 61 selected), | 61 selected, |
| 62 /*show_edit_button=*/true), |
| 62 parent_view_(parent_view), | 63 parent_view_(parent_view), |
| 63 profile_(profile), | 64 profile_(profile), |
| 64 dialog_(dialog) {} | 65 dialog_(dialog) {} |
| 65 ~ProfileItem() override {} | 66 ~ProfileItem() override {} |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // payments::PaymentRequestItemList::Item: | 69 // payments::PaymentRequestItemList::Item: |
| 69 std::unique_ptr<views::View> CreateContentView() override { | 70 std::unique_ptr<views::View> CreateContentView() override { |
| 70 DCHECK(profile_); | 71 DCHECK(profile_); |
| 71 | 72 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 // PerformSelectionFallback() is called. | 88 // PerformSelectionFallback() is called. |
| 88 return IsEnabled() && parent_view_->IsValidProfile(*profile_); | 89 return IsEnabled() && parent_view_->IsValidProfile(*profile_); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void PerformSelectionFallback() override { | 92 void PerformSelectionFallback() override { |
| 92 // If enabled, the editor is opened to complete the invalid profile. | 93 // If enabled, the editor is opened to complete the invalid profile. |
| 93 if (IsEnabled()) | 94 if (IsEnabled()) |
| 94 parent_view_->ShowEditor(profile_); | 95 parent_view_->ShowEditor(profile_); |
| 95 } | 96 } |
| 96 | 97 |
| 98 void EditButtonPressed() override { parent_view_->ShowEditor(profile_); } |
| 99 |
| 97 ProfileListViewController* parent_view_; | 100 ProfileListViewController* parent_view_; |
| 98 autofill::AutofillProfile* profile_; | 101 autofill::AutofillProfile* profile_; |
| 99 PaymentRequestDialogView* dialog_; | 102 PaymentRequestDialogView* dialog_; |
| 100 | 103 |
| 101 DISALLOW_COPY_AND_ASSIGN(ProfileItem); | 104 DISALLOW_COPY_AND_ASSIGN(ProfileItem); |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 // The ProfileListViewController subtype for the Shipping address list | 107 // The ProfileListViewController subtype for the Shipping address list |
| 105 // screen of the Payment Request flow. | 108 // screen of the Payment Request flow. |
| 106 class ShippingProfileViewController : public ProfileListViewController { | 109 class ShippingProfileViewController : public ProfileListViewController { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 376 |
| 374 void ProfileListViewController::ButtonPressed(views::Button* sender, | 377 void ProfileListViewController::ButtonPressed(views::Button* sender, |
| 375 const ui::Event& event) { | 378 const ui::Event& event) { |
| 376 if (sender->tag() == GetSecondaryButtonTag()) | 379 if (sender->tag() == GetSecondaryButtonTag()) |
| 377 ShowEditor(nullptr); | 380 ShowEditor(nullptr); |
| 378 else | 381 else |
| 379 PaymentRequestSheetController::ButtonPressed(sender, event); | 382 PaymentRequestSheetController::ButtonPressed(sender, event); |
| 380 } | 383 } |
| 381 | 384 |
| 382 } // namespace payments | 385 } // namespace payments |
| OLD | NEW |