Fixate toolbar button font height

This fixes an issue where Hindi increases ToolbarButton's height
resulting in oblong InkDrop shapes. It also increases the font size for
touchable Chrome which matches the larger shape of the toolbar better.

Bug: chromium:862514
Change-Id: I66cd2d7e06a27e6c03402e28679b55eaaaeaccf8
Reviewed-on: https://chromium-review.googlesource.com/1150960
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578385}
diff --git a/chrome/browser/ui/views/harmony/chrome_typography.cc b/chrome/browser/ui/views/harmony/chrome_typography.cc
index de8c33f3..83cf11f 100644
--- a/chrome/browser/ui/views/harmony/chrome_typography.cc
+++ b/chrome/browser/ui/views/harmony/chrome_typography.cc
@@ -50,6 +50,17 @@
                            int* size_delta,
                            gfx::Font::Weight* weight) {
   switch (context) {
+    case CONTEXT_TOOLBAR_BUTTON: {
+      // TODO(pbos): Instead of fixing the toolbar button height this way
+      // consider dynamically resizing all of the toolbar based on the actual
+      // final item height.
+      static const int fixed_height =
+          ui::MaterialDesignController::IsTouchOptimizedUiEnabled() ? 22 : 18;
+      static const int toolbar_button_delta =
+          GetFontSizeDeltaBoundedByAvailableHeight(fixed_height, fixed_height);
+      *size_delta = toolbar_button_delta;
+      break;
+    }
 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER)
     case CONTEXT_OMNIBOX_PRIMARY:
     case CONTEXT_OMNIBOX_DEEMPHASIZED: {
diff --git a/chrome/browser/ui/views/harmony/chrome_typography.h b/chrome/browser/ui/views/harmony/chrome_typography.h
index fbda359..a4b00179 100644
--- a/chrome/browser/ui/views/harmony/chrome_typography.h
+++ b/chrome/browser/ui/views/harmony/chrome_typography.h
@@ -48,6 +48,9 @@
   // Harmony spec, so new code should not be using this. It is only provided to
   // avoid changing existing UI and it will eventually be removed.
   CONTEXT_DEPRECATED_SMALL,
+
+  // ToolbarButton label
+  CONTEXT_TOOLBAR_BUTTON,
 };
 
 enum ChromeTextStyle {
diff --git a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
index cd066972..80ffe31 100644
--- a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
+++ b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
@@ -266,6 +266,7 @@
   switch (context) {
     case views::style::CONTEXT_BUTTON:
     case views::style::CONTEXT_BUTTON_MD:
+    case CONTEXT_TOOLBAR_BUTTON:
       return kButtonAbsoluteHeight;
     case views::style::CONTEXT_DIALOG_TITLE:
       return title_height;
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index d53a341..a946367 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -14,6 +14,7 @@
 #include "chrome/browser/ui/layout_constants.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
+#include "chrome/browser/ui/views/harmony/chrome_typography.h"
 #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
 #include "ui/accessibility/ax_node_data.h"
 #include "ui/base/material_design/material_design_controller.h"
@@ -33,7 +34,7 @@
 ToolbarButton::ToolbarButton(views::ButtonListener* listener,
                              std::unique_ptr<ui::MenuModel> model,
                              TabStripModel* tab_strip_model)
-    : views::LabelButton(listener, base::string16()),
+    : views::LabelButton(listener, base::string16(), CONTEXT_TOOLBAR_BUTTON),
       model_(std::move(model)),
       tab_strip_model_(tab_strip_model),
       layout_insets_(GetLayoutInsets(TOOLBAR_BUTTON)),