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

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

Issue 2922483002: [WebPayments] Making all fields and buttons focusable (Closed)
Patch Set: Created 3 years, 6 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_method_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_method_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 extra_view->SetLayoutManager(new views::BoxLayout( 198 extra_view->SetLayoutManager(new views::BoxLayout(
199 views::BoxLayout::kHorizontal, 0, 0, kPaymentRequestButtonSpacing)); 199 views::BoxLayout::kHorizontal, 0, 0, kPaymentRequestButtonSpacing));
200 200
201 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( 201 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton(
202 this, l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_CREDITCARD_CAPTION)); 202 this, l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_CREDITCARD_CAPTION));
203 button->set_tag(static_cast<int>( 203 button->set_tag(static_cast<int>(
204 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON)); 204 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON));
205 button->set_id( 205 button->set_id(
206 static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON)); 206 static_cast<int>(DialogViewID::PAYMENT_METHOD_ADD_CARD_BUTTON));
207 button->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
207 extra_view->AddChildView(button); 208 extra_view->AddChildView(button);
208 209
209 return extra_view; 210 return extra_view;
210 } 211 }
211 212
212 void PaymentMethodViewController::ButtonPressed(views::Button* sender, 213 void PaymentMethodViewController::ButtonPressed(views::Button* sender,
213 const ui::Event& event) { 214 const ui::Event& event) {
214 switch (sender->tag()) { 215 switch (sender->tag()) {
215 case static_cast<int>( 216 case static_cast<int>(
216 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON): 217 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON):
217 // Only provide the |on_added| callback, in response to this button. 218 // Only provide the |on_added| callback, in response to this button.
218 dialog()->ShowCreditCardEditor( 219 dialog()->ShowCreditCardEditor(
219 BackNavigationType::kPaymentSheet, 220 BackNavigationType::kPaymentSheet,
220 static_cast<int>(PaymentMethodViewControllerTags::MAX_TAG), 221 static_cast<int>(PaymentMethodViewControllerTags::MAX_TAG),
221 /*on_edited=*/base::OnceClosure(), 222 /*on_edited=*/base::OnceClosure(),
222 /*on_added=*/ 223 /*on_added=*/
223 base::BindOnce(&PaymentRequestState::AddAutofillPaymentInstrument, 224 base::BindOnce(&PaymentRequestState::AddAutofillPaymentInstrument,
224 base::Unretained(state()), /*selected=*/true), 225 base::Unretained(state()), /*selected=*/true),
225 /*credit_card=*/nullptr); 226 /*credit_card=*/nullptr);
226 break; 227 break;
227 default: 228 default:
228 PaymentRequestSheetController::ButtonPressed(sender, event); 229 PaymentRequestSheetController::ButtonPressed(sender, event);
229 break; 230 break;
230 } 231 }
231 } 232 }
232 233
233 } // namespace payments 234 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698