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

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

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: Components Unittests fix 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.h
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.h b/chrome/browser/ui/views/payments/editor_view_controller.h
index ec792873ff2893e2abe30538a9ed89669ef12846..179326266b5a5ef2c48cba3defa5769a7e50e5b7 100644
--- a/chrome/browser/ui/views/payments/editor_view_controller.h
+++ b/chrome/browser/ui/views/payments/editor_view_controller.h
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
+#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
#include "chrome/browser/ui/views/payments/validation_delegate.h"
#include "components/autofill/core/browser/field_types.h"
@@ -37,7 +38,6 @@ namespace payments {
class PaymentRequestSpec;
class PaymentRequestState;
-class PaymentRequestDialogView;
class ValidatingCombobox;
class ValidatingTextfield;
@@ -89,9 +89,13 @@ class EditorViewController : public PaymentRequestSheetController,
std::map<const EditorField, views::Label*, EditorField::Compare>;
// Does not take ownership of the arguments, which should outlive this object.
+ // |back_navigation_type| identify which other view to navigate to when the
Mathieu 2017/05/04 20:29:19 *identifies what sort of back navigation should be
MAD 2017/05/05 00:50:07 Done.
+ // editing is completed successfully (as opposed to the back arrow which
+ // always go back a single step).
EditorViewController(PaymentRequestSpec* spec,
PaymentRequestState* state,
- PaymentRequestDialogView* dialog);
+ PaymentRequestDialogView* dialog,
+ BackNavigationType back_navigation_type);
~EditorViewController() override;
// Will display |error_message| alongside the input field represented by
@@ -104,6 +108,7 @@ class EditorViewController : public PaymentRequestSheetController,
protected:
virtual std::unique_ptr<views::View> CreateHeaderView() = 0;
+ virtual std::unique_ptr<views::View> CreateCustomFieldsView() = 0;
// Returns the field definitions used to build the UI.
virtual std::vector<EditorField> GetFieldDefinitions() = 0;
virtual base::string16 GetInitialValueForType(
@@ -131,10 +136,20 @@ class EditorViewController : public PaymentRequestSheetController,
// UpdateEditorView.
virtual void UpdateEditorView();
- private:
// PaymentRequestSheetController:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+ // To allow derived classes to use the exact same values in their custom
+ // fields view. |kLabelInputFieldHorizontalPadding| sets the distance between
+ // intput fields and their label.
Mathieu 2017/05/04 20:29:19 *input
MAD 2017/05/05 00:50:07 Done.
+ static constexpr int kLabelInputFieldHorizontalPadding = 16;
+ // The spacing in between input rows.
+ static constexpr int kInputRowSpacing = 6;
+ // |kMaximumLabelWidth| value was picked so that left + right label padding
+ // bring the label to half-way in the dialog (~225).
+ static constexpr int kMaximumLabelWidth = 192;
+
+ private:
// views::TextfieldController:
void ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) override;
@@ -158,6 +173,9 @@ class EditorViewController : public PaymentRequestSheetController,
// Tracks the relationship between a field and its error label.
ErrorLabelMap error_labels_;
+ // Identifies where to go back when the editing completes successfully.
+ BackNavigationType back_navigation_type_;
+
DISALLOW_COPY_AND_ASSIGN(EditorViewController);
};

Powered by Google App Engine
This is Rietveld 408576698