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

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

Issue 2862913002: [Web Payments] Let subsheets define the initial focus (Closed)
Patch Set: 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/editor_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.cc b/chrome/browser/ui/views/payments/editor_view_controller.cc
index 94b23bce9d0ec82646bd231ead9807c8a99eb64f..c20c2caafe2c1092a5738b658c9bb5ef29d494e5 100644
--- a/chrome/browser/ui/views/payments/editor_view_controller.cc
+++ b/chrome/browser/ui/views/payments/editor_view_controller.cc
@@ -49,7 +49,8 @@ constexpr int kNumCharactersInLongField = 20;
EditorViewController::EditorViewController(PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog)
- : PaymentRequestSheetController(spec, state, dialog) {}
+ : PaymentRequestSheetController(spec, state, dialog),
+ first_field_view_(nullptr) {}
EditorViewController::~EditorViewController() {}
@@ -132,6 +133,12 @@ void EditorViewController::ButtonPressed(views::Button* sender,
}
}
+views::View* EditorViewController::GetFirstFocusedView() {
+ if (first_field_view_)
+ return first_field_view_;
+ return PaymentRequestSheetController::GetFirstFocusedView();
+}
+
void EditorViewController::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
static_cast<ValidatingTextfield*>(sender)->OnContentsChanged();
@@ -214,6 +221,10 @@ void EditorViewController::CreateInputField(views::GridLayout* layout,
: kNumCharactersInLongField);
text_fields_.insert(std::make_pair(text_field, field));
+
+ if (!first_field_view_)
Mathieu 2017/05/04 19:32:34 TODO(crbug.com/xxxxxx): Should be the first view t
anthonyvd 2017/05/04 20:56:59 Done.
+ first_field_view_ = text_field;
+
// |text_field| will now be owned by |row|.
layout->AddView(text_field);
} else if (field.control_type == EditorField::ControlType::COMBOBOX) {
@@ -224,6 +235,10 @@ void EditorViewController::CreateInputField(views::GridLayout* layout,
combobox->set_id(static_cast<int>(field.type));
combobox->set_listener(this);
comboboxes_.insert(std::make_pair(combobox, field));
+
+ if (!first_field_view_)
+ first_field_view_ = combobox;
+
// |combobox| will now be owned by |row|.
layout->AddView(combobox);
} else {

Powered by Google App Engine
This is Rietveld 408576698