| 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_row_view.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/views/background.h" | 9 #include "ui/views/background.h" |
| 10 #include "ui/views/border.h" | 10 #include "ui/views/border.h" |
| 11 | 11 |
| 12 namespace payments { | 12 namespace payments { |
| 13 | 13 |
| 14 PaymentRequestRowView::PaymentRequestRowView( | 14 PaymentRequestRowView::PaymentRequestRowView(views::ButtonListener* listener, |
| 15 views::ButtonListener* listener) | 15 bool clickable) |
| 16 : views::CustomButton(listener) { | 16 : views::CustomButton(listener), clickable_(clickable) { |
| 17 SetEnabled(clickable_); |
| 17 SetBorder(payments::CreatePaymentRequestRowBorder()); | 18 SetBorder(payments::CreatePaymentRequestRowBorder()); |
| 18 } | 19 } |
| 19 | 20 |
| 20 PaymentRequestRowView::~PaymentRequestRowView() {} | 21 PaymentRequestRowView::~PaymentRequestRowView() {} |
| 21 | 22 |
| 22 // views::CustomButton: | 23 // views::CustomButton: |
| 23 void PaymentRequestRowView::StateChanged(ButtonState old_state) { | 24 void PaymentRequestRowView::StateChanged(ButtonState old_state) { |
| 24 if (state() == views::Button::STATE_HOVERED || | 25 if (clickable_ && (state() == views::Button::STATE_HOVERED || |
| 25 state() == views::Button::STATE_PRESSED) { | 26 state() == views::Button::STATE_PRESSED)) { |
| 26 set_background(views::Background::CreateSolidBackground(SK_ColorLTGRAY)); | 27 set_background(views::Background::CreateSolidBackground(SK_ColorLTGRAY)); |
| 27 } else { | 28 } else { |
| 28 set_background(nullptr); | 29 set_background(nullptr); |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 } // namespace payments | 33 } // namespace payments |
| OLD | NEW |