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

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

Issue 2768133002: [Web Payments] Refactor sheet display to allow updating view content (Closed)
Patch Set: Add comments. Created 3 years, 9 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/profile_list_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
index d328f2e79672b50eaa3a8d4f1cc8b40fe65e05d4..c026f5fcc2163df0ab244e26e78ea72c18f01341 100644
--- a/chrome/browser/ui/views/payments/profile_list_view_controller.cc
+++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -17,6 +17,7 @@
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/layout/box_layout.h"
+#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
namespace payments {
@@ -95,7 +96,9 @@ class ShippingProfileViewController : public ProfileListViewController {
ShippingProfileViewController(PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog)
- : ProfileListViewController(spec, state, dialog) {}
+ : ProfileListViewController(spec, state, dialog) {
+ PopulateList();
+ }
~ShippingProfileViewController() override {}
protected:
@@ -118,7 +121,7 @@ class ShippingProfileViewController : public ProfileListViewController {
return state()->shipping_profiles();
}
- base::string16 GetHeaderString() override {
+ base::string16 GetSheetTitle() override {
return GetShippingAddressSectionString(spec()->options().shipping_type);
}
@@ -148,7 +151,9 @@ class ContactProfileViewController : public ProfileListViewController {
ContactProfileViewController(PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog)
- : ProfileListViewController(spec, state, dialog) {}
+ : ProfileListViewController(spec, state, dialog) {
+ PopulateList();
+ }
~ContactProfileViewController() override {}
protected:
@@ -173,7 +178,7 @@ class ContactProfileViewController : public ProfileListViewController {
return state()->contact_profiles();
}
- base::string16 GetHeaderString() override {
+ base::string16 GetSheetTitle() override {
return l10n_util::GetStringUTF16(
IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME);
}
@@ -227,7 +232,7 @@ ProfileListViewController::ProfileListViewController(
ProfileListViewController::~ProfileListViewController() {}
-std::unique_ptr<views::View> ProfileListViewController::CreateView() {
+void ProfileListViewController::PopulateList() {
autofill::AutofillProfile* selected_profile = GetSelectedProfile();
// This must be done at Create-time, rather than construct-time, because
@@ -237,11 +242,11 @@ std::unique_ptr<views::View> ProfileListViewController::CreateView() {
&list_, this, dialog(),
profile == selected_profile));
}
+}
- return CreatePaymentView(
- CreateSheetHeaderView(
- /* show_back_arrow = */ true, GetHeaderString(), this),
- list_.CreateListView());
+void ProfileListViewController::FillContentView(views::View* content_view) {
+ content_view->SetLayoutManager(new views::FillLayout);
+ content_view->AddChildView(list_.CreateListView().release());
}
std::unique_ptr<views::View>

Powered by Google App Engine
This is Rietveld 408576698