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

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: Last final nit :-) 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 f417feccd0fa61f59a947fb8c1a25224fa82a59c..db1c052afc322cb30b1770ad765f15edcfc40e83 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"
@@ -254,6 +256,20 @@ void PaymentRequestSheetController::UpdateContentView() {
RelayoutPane();
}
+void PaymentRequestSheetController::UpdateFocus(views::View* focused_view) {
+ DialogViewID sheet_id;
+ if (GetSheetId(&sheet_id)) {
+ 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(focused_view);
+ dialog()->RequestFocus();
+ }
+ }
+}
+
void PaymentRequestSheetController::RelayoutPane() {
content_view_->Layout();
pane_->SizeToPreferredSize();

Powered by Google App Engine
This is Rietveld 408576698