| 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/native_theme/native_theme.h" | 9 #include "ui/native_theme/native_theme.h" |
| 10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
| 11 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
| 12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 13 | 13 |
| 14 namespace payments { | 14 namespace payments { |
| 15 | 15 |
| 16 PaymentRequestRowView::PaymentRequestRowView(views::ButtonListener* listener, | 16 PaymentRequestRowView::PaymentRequestRowView(views::ButtonListener* listener, |
| 17 bool clickable) | 17 bool clickable, |
| 18 const gfx::Insets& insets) |
| 18 : views::CustomButton(listener), clickable_(clickable) { | 19 : views::CustomButton(listener), clickable_(clickable) { |
| 19 SetEnabled(clickable_); | 20 SetEnabled(clickable_); |
| 20 SetBorder( | 21 SetBorder(payments::CreatePaymentRequestRowBorder( |
| 21 payments::CreatePaymentRequestRowBorder(GetNativeTheme()->GetSystemColor( | 22 GetNativeTheme()->GetSystemColor( |
| 22 ui::NativeTheme::kColorId_SeparatorColor))); | 23 ui::NativeTheme::kColorId_SeparatorColor), |
| 24 insets)); |
| 23 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); | 25 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 24 } | 26 } |
| 25 | 27 |
| 26 PaymentRequestRowView::~PaymentRequestRowView() {} | 28 PaymentRequestRowView::~PaymentRequestRowView() {} |
| 27 | 29 |
| 28 void PaymentRequestRowView::SetActiveBackground() { | 30 void PaymentRequestRowView::SetActiveBackground() { |
| 29 ui::NativeTheme* theme = GetWidget()->GetNativeTheme(); | 31 ui::NativeTheme* theme = GetWidget()->GetNativeTheme(); |
| 30 set_background(views::Background::CreateSolidBackground(theme->GetSystemColor( | 32 set_background(views::Background::CreateSolidBackground(theme->GetSystemColor( |
| 31 ui::NativeTheme::kColorId_ResultsTableHoveredBackground))); | 33 ui::NativeTheme::kColorId_ResultsTableHoveredBackground))); |
| 32 } | 34 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 49 } | 51 } |
| 50 | 52 |
| 51 void PaymentRequestRowView::OnBlur() { | 53 void PaymentRequestRowView::OnBlur() { |
| 52 if (clickable_) { | 54 if (clickable_) { |
| 53 set_background(nullptr); | 55 set_background(nullptr); |
| 54 SchedulePaint(); | 56 SchedulePaint(); |
| 55 } | 57 } |
| 56 } | 58 } |
| 57 | 59 |
| 58 } // namespace payments | 60 } // namespace payments |
| OLD | NEW |