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

Unified Diff: chrome/browser/ui/views/payments/payment_request_sheet_controller.cc

Issue 2881643002: Focus first invalid field of payment request editor (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
index f34d57d135ff7b5f22866eeb172b6711a6220ec0..7cde73472e13503742150f77d01d7c245d2db57f 100644
--- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
+#include <utility>
+
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "components/payments/content/payment_request.h"
@@ -181,6 +183,17 @@ void PaymentRequestSheetController::UpdateContentView() {
content_view_->RemoveAllChildViews(true);
FillContentView(content_view_);
RelayoutPane();
+ DialogViewID sheet_id;
+ if (GetSheetId(&sheet_id)) {
anthonyvd 2017/05/12 14:19:44 Some views probably don't want this to happen here
MAD 2017/05/18 16:01:46 Done.
+ SheetView* sheet_view = static_cast<SheetView*>(
+ dialog()->GetViewByID(static_cast<int>(sheet_id)));
+ // This will be null on first call since it's not been set until CreateView
+ // returns, and the first call to UpdateContentView comes from CreateView.
+ if (sheet_view) {
+ sheet_view->SetFirstFocusableView(GetFirstFocusedView());
+ dialog()->RequestFocus();
+ }
+ }
}
void PaymentRequestSheetController::RelayoutPane() {

Powered by Google App Engine
This is Rietveld 408576698