Move constants from namespace to class (browser/ui)

When building using Jumbo unnamed namespaces gets merged
and variables with the same name conflict. This happens
for the variables kStartPadding and kEndPadding in
chrome/browser/ui/views/download/download_item_view.cc
and chrome/browser/ui/views/download/download_shelf_view.cc.

This commit solves the issue by moving the variables from
the namespace to the class. It also moves other variables
in the same namespace, to keep the files locally consistent.

Bug: 773275
Change-Id: I8d23ae9999fe404d253a3a189e6d17d81786939d
Reviewed-on: https://chromium-review.googlesource.com/1107063
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Bret Sepulveda <bsep@chromium.org>
Commit-Queue: Oscar Johansson <oscarj@opera.com>
Cr-Commit-Position: refs/heads/master@{#571901}
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 7be04405..3e615d5 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -77,54 +77,16 @@
 
 namespace {
 
-// All values in dp.
-const int kTextWidth = 140;
-
-// The normal height of the item which may be exceeded if text is large.
-const int kDefaultHeight = 48;
-
-// The vertical distance between the item's visual upper bound (as delineated by
-// the separator on the right) and the edge of the shelf.
-const int kTopBottomPadding = 6;
+// The vertical distance between the item's visual upper bound (as delineated
+// by the separator on the right) and the edge of the shelf.
+constexpr int kTopBottomPadding = 6;
 
 // The minimum vertical padding above and below contents of the download item.
 // This is only used when the text size is large.
-const int kMinimumVerticalPadding = 2 + kTopBottomPadding;
+constexpr int kMinimumVerticalPadding = 2 + kTopBottomPadding;
 
-// Vertical padding between filename and status text.
-const int kVerticalTextPadding = 1;
-
-const int kTooltipMaxWidth = 800;
-
-// Padding before the icon and at end of the item.
-const int kStartPadding = 12;
-const int kEndPadding = 6;
-
-// Horizontal padding between progress indicator and filename/status text.
-const int kProgressTextPadding = 8;
-
-// The space between the Save and Discard buttons when prompting for a dangerous
-// download.
-const int kSaveDiscardButtonPadding = 5;
-
-// The touchable space around the dropdown button's icon.
-const int kDropdownBorderWidth = 10;
-
-// The space on the right side of the dangerous download label.
-const int kLabelPadding = 8;
-
-// Height/width of the warning icon, also in dp.
-const int kWarningIconSize = 24;
-
-// How long the 'download complete' animation should last for.
-const int kCompleteAnimationDurationMs = 2500;
-
-// How long the 'download interrupted' animation should last for.
-const int kInterruptedAnimationDurationMs = 2500;
-
-// How long we keep the item disabled after the user clicked it to open the
-// downloaded item.
-const int kDisabledOnOpenDuration = 3000;
+// The normal height of the item which may be exceeded if text is large.
+constexpr int kDefaultHeight = 48;
 
 // Amount of time between accessible alert events.
 constexpr base::TimeDelta kAccessibleAlertInterval =
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h
index 84bb66a..148487d 100644
--- a/chrome/browser/ui/views/download/download_item_view.h
+++ b/chrome/browser/ui/views/download/download_item_view.h
@@ -148,6 +148,43 @@
     MALICIOUS_MODE    // Displaying the malicious download warning.
   };
 
+  static constexpr int kTextWidth = 140;
+
+  // Vertical padding between filename and status text.
+  static constexpr int kVerticalTextPadding = 1;
+
+  static constexpr int kTooltipMaxWidth = 800;
+
+  // Padding before the icon and at end of the item.
+  static constexpr int kStartPadding = 12;
+  static constexpr int kEndPadding = 6;
+
+  // Horizontal padding between progress indicator and filename/status text.
+  static constexpr int kProgressTextPadding = 8;
+
+  // The space between the Save and Discard buttons when prompting for a
+  // dangerous download.
+  static constexpr int kSaveDiscardButtonPadding = 5;
+
+  // The touchable space around the dropdown button's icon.
+  static constexpr int kDropdownBorderWidth = 10;
+
+  // The space on the right side of the dangerous download label.
+  static constexpr int kLabelPadding = 8;
+
+  // Height/width of the warning icon, also in dp.
+  static constexpr int kWarningIconSize = 24;
+
+  // How long the 'download complete' animation should last for.
+  static constexpr int kCompleteAnimationDurationMs = 2500;
+
+  // How long the 'download interrupted' animation should last for.
+  static constexpr int kInterruptedAnimationDurationMs = 2500;
+
+  // How long we keep the item disabled after the user clicked it to open the
+  // downloaded item.
+  static constexpr int kDisabledOnOpenDuration = 3000;
+
   void OpenDownload();
 
   // Submits the downloaded file to the safebrowsing download feedback service.
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc
index b952f924..51e40b1 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -43,37 +43,8 @@
 
 namespace {
 
-// Max number of download views we'll contain. Any time a view is added and
-// we already have this many download views, one is removed.
-const size_t kMaxDownloadViews = 15;
-
-// Padding from left edge and first download view.
-const int kStartPadding = 4;
-
-// Padding from right edge and close button/show downloads link.
-const int kEndPadding = 6;
-
-// Padding between the show all link and close button.
-const int kCloseAndLinkPadding = 6;
-
 // Padding above the content.
-const int kTopPadding = 1;
-
-// Border color.
-const SkColor kBorderColor = SkColorSetRGB(214, 214, 214);
-
-// New download item animation speed in milliseconds.
-const int kNewItemAnimationDurationMs = 800;
-
-// Shelf show/hide speed.
-const int kShelfAnimationDurationMs = 120;
-
-// Amount of time to delay if the mouse leaves the shelf by way of entering
-// another window. This is much larger than the normal delay as opening a
-// download is most likely going to trigger a new window to appear over the
-// button. Delay the time so that the user has a chance to quickly close the
-// other app and return to chrome with the download shelf still open.
-const int kNotifyOnExitTimeMS = 5000;
+constexpr int kTopPadding = 1;
 
 // Sets size->width() to view's preferred width + size->width().
 // Sets size->height() to the max of the view's preferred height and
diff --git a/chrome/browser/ui/views/download/download_shelf_view.h b/chrome/browser/ui/views/download/download_shelf_view.h
index 359b2fd..be5ff1b 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.h
+++ b/chrome/browser/ui/views/download/download_shelf_view.h
@@ -50,7 +50,6 @@
  public:
   DownloadShelfView(Browser* browser, BrowserView* parent);
   ~DownloadShelfView() override;
-
   // Sent from the DownloadItemView when the user opens an item.
   void OpenedDownload();
 
@@ -107,6 +106,35 @@
   views::View* GetDefaultFocusableChild() override;
 
  private:
+  // Max number of download views we'll contain. Any time a view is added and
+  // we already have this many download views, one is removed.
+  static constexpr size_t kMaxDownloadViews = 15;
+
+  // Padding from left edge and first download view.
+  static constexpr int kStartPadding = 4;
+
+  // Padding from right edge and close button/show downloads link.
+  static constexpr int kEndPadding = 6;
+
+  // Padding between the show all link and close button.
+  static constexpr int kCloseAndLinkPadding = 6;
+
+  // Border color.
+  static constexpr SkColor kBorderColor = SkColorSetRGB(214, 214, 214);
+
+  // New download item animation speed in milliseconds.
+  static constexpr int kNewItemAnimationDurationMs = 800;
+
+  // Shelf show/hide speed.
+  static constexpr int kShelfAnimationDurationMs = 120;
+
+  // Amount of time to delay if the mouse leaves the shelf by way of entering
+  // another window. This is much larger than the normal delay as opening a
+  // download is most likely going to trigger a new window to appear over the
+  // button. Delay the time so that the user has a chance to quickly close the
+  // other app and return to chrome with the download shelf still open.
+  static constexpr int kNotifyOnExitTimeMS = 5000;
+
   // Adds a View representing a download to this DownloadShelfView.
   // DownloadShelfView takes ownership of the View, and will delete it as
   // necessary.