| 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/payment_request_item_list.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_item_list.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 9 #include "ui/gfx/paint_vector_icon.h" | 9 #include "ui/gfx/paint_vector_icon.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 selected_ = selected; | 40 selected_ = selected; |
| 41 SelectedStateChanged(); | 41 SelectedStateChanged(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 std::unique_ptr<views::ImageView> PaymentRequestItemList::Item::CreateCheckmark( | 44 std::unique_ptr<views::ImageView> PaymentRequestItemList::Item::CreateCheckmark( |
| 45 bool selected) { | 45 bool selected) { |
| 46 std::unique_ptr<views::ImageView> checkmark = | 46 std::unique_ptr<views::ImageView> checkmark = |
| 47 base::MakeUnique<views::ImageView>(); | 47 base::MakeUnique<views::ImageView>(); |
| 48 checkmark->set_id(static_cast<int>(DialogViewID::CHECKMARK_VIEW)); | 48 checkmark->set_id(static_cast<int>(DialogViewID::CHECKMARK_VIEW)); |
| 49 checkmark->set_can_process_events_within_subtree(false); | 49 checkmark->set_can_process_events_within_subtree(false); |
| 50 checkmark->set_owned_by_client(); |
| 50 checkmark->SetImage( | 51 checkmark->SetImage( |
| 51 gfx::CreateVectorIcon(views::kMenuCheckIcon, kCheckmarkColor)); | 52 gfx::CreateVectorIcon(views::kMenuCheckIcon, kCheckmarkColor)); |
| 52 checkmark->SetVisible(selected); | 53 checkmark->SetVisible(selected); |
| 53 return checkmark; | 54 return checkmark; |
| 54 } | 55 } |
| 55 | 56 |
| 56 PaymentRequestItemList::PaymentRequestItemList() : selected_item_(nullptr) {} | 57 PaymentRequestItemList::PaymentRequestItemList() : selected_item_(nullptr) {} |
| 57 | 58 |
| 58 PaymentRequestItemList::~PaymentRequestItemList() {} | 59 PaymentRequestItemList::~PaymentRequestItemList() {} |
| 59 | 60 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // It's possible that no item is currently selected, either during list | 95 // It's possible that no item is currently selected, either during list |
| 95 // creation or in the middle of the selection operation when the previously | 96 // creation or in the middle of the selection operation when the previously |
| 96 // selected item has been deselected but the new one isn't selected yet. | 97 // selected item has been deselected but the new one isn't selected yet. |
| 97 if (selected_item_) | 98 if (selected_item_) |
| 98 selected_item_->SetSelected(false); | 99 selected_item_->SetSelected(false); |
| 99 | 100 |
| 100 selected_item_ = nullptr; | 101 selected_item_ = nullptr; |
| 101 } | 102 } |
| 102 | 103 |
| 103 } // namespace payments | 104 } // namespace payments |
| OLD | NEW |