Commit e63a902a authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Change some payments code to not have so many kFirstTagValue

In jumbo build experiments all the kFirstTag variables ended up
in the same translation unit and prevented compilation. This patch
retires those variables, and also renames an enum that had got
a copy-paste name.

Bug: 803406
Change-Id: I887d85a3632766845a7caede089d99ed73efba35
Reviewed-on: https://chromium-review.googlesource.com/1073308
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561861}
parent f204eb66
......@@ -35,13 +35,12 @@
namespace payments {
namespace {
constexpr int kFirstTagValue = static_cast<int>(
payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
enum class EditorViewControllerTags : int {
// The tag for the button that saves the model being edited. Starts at
// |kFirstTagValue| not to conflict with tags common to all views.
SAVE_BUTTON = kFirstTagValue,
// The tag for the button that saves the model being edited. Starts
// at PAYMENT_REQUEST_COMMON_TAG_MAX not to conflict with tags
// common to all views.
SAVE_BUTTON = static_cast<int>(
PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
};
std::unique_ptr<views::View> CreateErrorLabelView(
......
......@@ -39,13 +39,12 @@ namespace payments {
namespace {
constexpr int kFirstTagValue =
static_cast<int>(PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
enum class PaymentMethodViewControllerTags : int {
// The tag for the button that triggers the "add card" flow. Starts at
// |kFirstTagValue| not to conflict with tags common to all views.
ADD_CREDIT_CARD_BUTTON = kFirstTagValue,
// |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict with tags common to all
// views.
ADD_CREDIT_CARD_BUTTON = static_cast<int>(
PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
// This value is passed to inner views so they can use it as a starting tag.
MAX_TAG,
};
......
......@@ -62,12 +62,14 @@
namespace payments {
namespace {
constexpr int kFirstTagValue = static_cast<int>(
payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
// Tags for the buttons in the payment sheet
// Tags for the buttons in the payment sheet. Starts at
// |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict with tags common
// to all views.
enum class PaymentSheetViewControllerTags {
SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue, // Navigate to order summary
SHOW_ORDER_SUMMARY_BUTTON = static_cast<int>(
PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX), // Navigate to
// order
// summary
SHOW_SHIPPING_BUTTON, // Navigate to the shipping address screen
ADD_SHIPPING_BUTTON, // Navigate to the shipping address editor
SHOW_PAYMENT_METHOD_BUTTON, // Navigate to the payment method screen
......
......@@ -30,13 +30,12 @@ namespace payments {
namespace {
constexpr int kFirstTagValue =
static_cast<int>(PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
enum class PaymentMethodViewControllerTags : int {
// The tag for the button that triggers the "add address" flow. Starts at
// |kFirstTagValue| not to conflict with tags common to all views.
ADD_SHIPPING_ADDRESS_BUTTON = kFirstTagValue,
enum class ProfileListViewControllerTags : int {
// The tag for the button that triggers the "add address"
// flow. Starts at |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict
// with tags common to all views.
ADD_SHIPPING_ADDRESS_BUTTON = static_cast<int>(
PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
ADD_CONTACT_BUTTON,
};
......@@ -232,7 +231,7 @@ class ShippingProfileViewController : public ProfileListViewController,
int GetSecondaryButtonTag() override {
return static_cast<int>(
PaymentMethodViewControllerTags::ADD_SHIPPING_ADDRESS_BUTTON);
ProfileListViewControllerTags::ADD_SHIPPING_ADDRESS_BUTTON);
}
int GetSecondaryButtonViewId() override {
......@@ -327,8 +326,7 @@ class ContactProfileViewController : public ProfileListViewController {
int GetSecondaryButtonTextId() override { return IDS_PAYMENTS_ADD_CONTACT; }
int GetSecondaryButtonTag() override {
return static_cast<int>(
PaymentMethodViewControllerTags::ADD_CONTACT_BUTTON);
return static_cast<int>(ProfileListViewControllerTags::ADD_CONTACT_BUTTON);
}
int GetSecondaryButtonViewId() override {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment