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 @@ ...@@ -35,13 +35,12 @@
namespace payments { namespace payments {
namespace { namespace {
constexpr int kFirstTagValue = static_cast<int>(
payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
enum class EditorViewControllerTags : int { enum class EditorViewControllerTags : int {
// The tag for the button that saves the model being edited. Starts at // The tag for the button that saves the model being edited. Starts
// |kFirstTagValue| not to conflict with tags common to all views. // at PAYMENT_REQUEST_COMMON_TAG_MAX not to conflict with tags
SAVE_BUTTON = kFirstTagValue, // common to all views.
SAVE_BUTTON = static_cast<int>(
PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
}; };
std::unique_ptr<views::View> CreateErrorLabelView( std::unique_ptr<views::View> CreateErrorLabelView(
......
...@@ -39,13 +39,12 @@ namespace payments { ...@@ -39,13 +39,12 @@ namespace payments {
namespace { namespace {
constexpr int kFirstTagValue =
static_cast<int>(PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
enum class PaymentMethodViewControllerTags : int { enum class PaymentMethodViewControllerTags : int {
// The tag for the button that triggers the "add card" flow. Starts at // The tag for the button that triggers the "add card" flow. Starts at
// |kFirstTagValue| not to conflict with tags common to all views. // |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict with tags common to all
ADD_CREDIT_CARD_BUTTON = kFirstTagValue, // 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. // This value is passed to inner views so they can use it as a starting tag.
MAX_TAG, MAX_TAG,
}; };
......
...@@ -62,12 +62,14 @@ ...@@ -62,12 +62,14 @@
namespace payments { namespace payments {
namespace { namespace {
constexpr int kFirstTagValue = static_cast<int>( // Tags for the buttons in the payment sheet. Starts at
payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); // |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict with tags common
// to all views.
// Tags for the buttons in the payment sheet
enum class PaymentSheetViewControllerTags { 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 SHOW_SHIPPING_BUTTON, // Navigate to the shipping address screen
ADD_SHIPPING_BUTTON, // Navigate to the shipping address editor ADD_SHIPPING_BUTTON, // Navigate to the shipping address editor
SHOW_PAYMENT_METHOD_BUTTON, // Navigate to the payment method screen SHOW_PAYMENT_METHOD_BUTTON, // Navigate to the payment method screen
......
...@@ -30,13 +30,12 @@ namespace payments { ...@@ -30,13 +30,12 @@ namespace payments {
namespace { namespace {
constexpr int kFirstTagValue = enum class ProfileListViewControllerTags : int {
static_cast<int>(PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); // The tag for the button that triggers the "add address"
// flow. Starts at |PAYMENT_REQUEST_COMMON_TAG_MAX| not to conflict
enum class PaymentMethodViewControllerTags : int { // with tags common to all views.
// The tag for the button that triggers the "add address" flow. Starts at ADD_SHIPPING_ADDRESS_BUTTON = static_cast<int>(
// |kFirstTagValue| not to conflict with tags common to all views. PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
ADD_SHIPPING_ADDRESS_BUTTON = kFirstTagValue,
ADD_CONTACT_BUTTON, ADD_CONTACT_BUTTON,
}; };
...@@ -232,7 +231,7 @@ class ShippingProfileViewController : public ProfileListViewController, ...@@ -232,7 +231,7 @@ class ShippingProfileViewController : public ProfileListViewController,
int GetSecondaryButtonTag() override { int GetSecondaryButtonTag() override {
return static_cast<int>( return static_cast<int>(
PaymentMethodViewControllerTags::ADD_SHIPPING_ADDRESS_BUTTON); ProfileListViewControllerTags::ADD_SHIPPING_ADDRESS_BUTTON);
} }
int GetSecondaryButtonViewId() override { int GetSecondaryButtonViewId() override {
...@@ -327,8 +326,7 @@ class ContactProfileViewController : public ProfileListViewController { ...@@ -327,8 +326,7 @@ class ContactProfileViewController : public ProfileListViewController {
int GetSecondaryButtonTextId() override { return IDS_PAYMENTS_ADD_CONTACT; } int GetSecondaryButtonTextId() override { return IDS_PAYMENTS_ADD_CONTACT; }
int GetSecondaryButtonTag() override { int GetSecondaryButtonTag() override {
return static_cast<int>( return static_cast<int>(ProfileListViewControllerTags::ADD_CONTACT_BUTTON);
PaymentMethodViewControllerTags::ADD_CONTACT_BUTTON);
} }
int GetSecondaryButtonViewId() override { 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