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

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

Issue 2862913002: [Web Payments] Let subsheets define the initial focus (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
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_sheet_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6052121600bf91362124c395b28c2162db5bb34e..ae2dfa5e576bce39738dfc04e835b58543a54603 100644
--- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
@@ -107,59 +107,6 @@ PaymentRequestSheetController::PaymentRequestSheetController(
PaymentRequestSheetController::~PaymentRequestSheetController() {}
std::unique_ptr<views::View> PaymentRequestSheetController::CreateView() {
- std::unique_ptr<views::View> view = CreatePaymentView();
- UpdateContentView();
- return view;
-}
-
-void PaymentRequestSheetController::UpdateContentView() {
- content_view_->RemoveAllChildViews(true);
- FillContentView(content_view_);
- content_view_->Layout();
- pane_->SizeToPreferredSize();
- // Now that the content and its surrounding pane are updated, force a Layout
- // on the ScrollView so that it updates its scroll bars now.
- scroll_->Layout();
-}
-
-std::unique_ptr<views::Button>
-PaymentRequestSheetController::CreatePrimaryButton() {
- return nullptr;
-}
-
-base::string16 PaymentRequestSheetController::GetSecondaryButtonLabel() {
- return l10n_util::GetStringUTF16(IDS_CANCEL);
-}
-
-bool PaymentRequestSheetController::ShouldShowHeaderBackArrow() {
- return true;
-}
-
-std::unique_ptr<views::View>
-PaymentRequestSheetController::CreateExtraFooterView() {
- return nullptr;
-}
-
-void PaymentRequestSheetController::ButtonPressed(
- views::Button* sender, const ui::Event& event) {
- switch (static_cast<PaymentRequestCommonTags>(sender->tag())) {
- case PaymentRequestCommonTags::CLOSE_BUTTON_TAG:
- dialog()->CloseDialog();
- break;
- case PaymentRequestCommonTags::BACK_BUTTON_TAG:
- dialog()->GoBack();
- break;
- case PaymentRequestCommonTags::PAY_BUTTON_TAG:
- dialog()->Pay();
- break;
- case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX:
- NOTREACHED();
- break;
- }
-}
-
-std::unique_ptr<views::View>
-PaymentRequestSheetController::CreatePaymentView() {
// Create the footer now so that it's known if there's a primary button or not
// before creating the sheet view. This way, it's possible to determine
// whether there's something to do when the user hits enter.
@@ -223,11 +170,58 @@ PaymentRequestSheetController::CreatePaymentView() {
layout->StartRow(0, 0);
layout->AddView(footer.release());
- view->SetFirstFocusableView(GetFirstFocusedView());
+ UpdateContentView();
+ view->SetFirstFocusableView(GetFirstFocusedView());
return std::move(view);
}
+void PaymentRequestSheetController::UpdateContentView() {
+ content_view_->RemoveAllChildViews(true);
+ FillContentView(content_view_);
+ content_view_->Layout();
+ pane_->SizeToPreferredSize();
+ // Now that the content and its surrounding pane are updated, force a Layout
+ // on the ScrollView so that it updates its scroll bars now.
+ scroll_->Layout();
+}
+
+std::unique_ptr<views::Button>
+PaymentRequestSheetController::CreatePrimaryButton() {
+ return nullptr;
+}
+
+base::string16 PaymentRequestSheetController::GetSecondaryButtonLabel() {
+ return l10n_util::GetStringUTF16(IDS_CANCEL);
+}
+
+bool PaymentRequestSheetController::ShouldShowHeaderBackArrow() {
+ return true;
+}
+
+std::unique_ptr<views::View>
+PaymentRequestSheetController::CreateExtraFooterView() {
+ return nullptr;
+}
+
+void PaymentRequestSheetController::ButtonPressed(views::Button* sender,
+ const ui::Event& event) {
+ switch (static_cast<PaymentRequestCommonTags>(sender->tag())) {
+ case PaymentRequestCommonTags::CLOSE_BUTTON_TAG:
+ dialog()->CloseDialog();
+ break;
+ case PaymentRequestCommonTags::BACK_BUTTON_TAG:
+ dialog()->GoBack();
+ break;
+ case PaymentRequestCommonTags::PAY_BUTTON_TAG:
+ dialog()->Pay();
+ break;
+ case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX:
+ NOTREACHED();
+ break;
+ }
+}
+
std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() {
std::unique_ptr<views::View> container = base::MakeUnique<views::View>();
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_sheet_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698