Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_row_view.cc

Issue 2853163002: [Web Payments] Implement proper focusing in Payment Request (Closed)
Patch Set: Allow ViewControllers to specify their first focused view Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(views::ButtonListener* listener, 14 PaymentRequestRowView::PaymentRequestRowView(views::ButtonListener* listener,
15 bool clickable) 15 bool clickable)
16 : views::CustomButton(listener), clickable_(clickable) { 16 : views::CustomButton(listener), clickable_(clickable) {
17 SetEnabled(clickable_); 17 SetEnabled(clickable_);
18 SetBorder(payments::CreatePaymentRequestRowBorder()); 18 SetBorder(payments::CreatePaymentRequestRowBorder());
19 SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
19 } 20 }
20 21
21 PaymentRequestRowView::~PaymentRequestRowView() {} 22 PaymentRequestRowView::~PaymentRequestRowView() {}
22 23
23 // views::CustomButton: 24 // views::CustomButton:
24 void PaymentRequestRowView::StateChanged(ButtonState old_state) { 25 void PaymentRequestRowView::StateChanged(ButtonState old_state) {
25 if (clickable_ && (state() == views::Button::STATE_HOVERED || 26 if (clickable_ && (state() == views::Button::STATE_HOVERED ||
26 state() == views::Button::STATE_PRESSED)) { 27 state() == views::Button::STATE_PRESSED)) {
27 set_background(views::Background::CreateSolidBackground(SK_ColorLTGRAY)); 28 set_background(views::Background::CreateSolidBackground(SK_ColorLTGRAY));
28 } else { 29 } else {
29 set_background(nullptr); 30 set_background(nullptr);
30 } 31 }
31 } 32 }
32 33
34 void PaymentRequestRowView::OnFocus() {
35 if (clickable_) {
36 set_background(views::Background::CreateSolidBackground(SK_ColorLTGRAY));
Mathieu 2017/05/02 13:16:10 We should get the proper color from the theme to u
anthonyvd 2017/05/02 13:43:32 Oh good call! Done.
37 SchedulePaint();
38 }
39 }
40
41 void PaymentRequestRowView::OnBlur() {
42 if (clickable_) {
43 set_background(nullptr);
44 SchedulePaint();
45 }
46 }
47
33 } // namespace payments 48 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698