[Tab Groups] Add new View for group headers with placeholder appearance.

This patch adds the skeleton of a new View for tab group headers. The
View draws as a blue rectangle, with a placeholder title and a button
that does nothing. Usage and polish will be added in later patches.

Bug: 905491
Change-Id: I0cd56ea2e4205d5b7730f632f8f85ca4162d56b5
Reviewed-on: https://chromium-review.googlesource.com/c/1448740
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628129}
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 21ea97e..a7785e4 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -2807,6 +2807,8 @@
       "views/tabs/tab_controller.h",
       "views/tabs/tab_drag_controller.cc",
       "views/tabs/tab_drag_controller.h",
+      "views/tabs/tab_group_header.cc",
+      "views/tabs/tab_group_header.h",
       "views/tabs/tab_hover_card_bubble_view.cc",
       "views/tabs/tab_hover_card_bubble_view.h",
       "views/tabs/tab_icon.cc",
diff --git a/chrome/browser/ui/views/tabs/tab_group_header.cc b/chrome/browser/ui/views/tabs/tab_group_header.cc
new file mode 100644
index 0000000..0b635160
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_group_header.cc
@@ -0,0 +1,53 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/tabs/tab_group_header.h"
+
+#include <memory>
+
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/app/vector_icons/vector_icons.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "third_party/skia/include/core/SkPath.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/geometry/insets.h"
+#include "ui/views/border.h"
+#include "ui/views/controls/button/image_button.h"
+#include "ui/views/controls/button/image_button_factory.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/layout/flex_layout.h"
+#include "ui/views/layout/flex_layout_types.h"
+
+TabGroupHeader::TabGroupHeader() {
+  // TODO(crbug.com/905491): Call TabStyle::GetContentsInsets.
+  constexpr gfx::Insets kPlaceholderInsets = gfx::Insets(2, 10);
+  SetBorder(views::CreateEmptyBorder(kPlaceholderInsets));
+
+  views::FlexLayout* layout =
+      SetLayoutManager(std::make_unique<views::FlexLayout>());
+  layout->SetOrientation(views::LayoutOrientation::kHorizontal)
+      .SetCollapseMargins(true)
+      .SetMainAxisAlignment(views::LayoutAlignment::kStart)
+      .SetCrossAxisAlignment(views::LayoutAlignment::kCenter);
+
+  // TODO(crbug.com/905491): Get title from TabGroupData::title().
+  auto* title = new views::Label(base::ASCIIToUTF16("Placeholder Title"));
+  title->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD);
+  title->SetElideBehavior(gfx::FADE_TAIL);
+  AddChildView(title);
+  layout->SetFlexForView(title, views::FlexSpecification::ForSizeRule(
+                                    views::MinimumFlexSizeRule::kScaleToZero,
+                                    views::MaximumFlexSizeRule::kUnbounded));
+
+  auto* group_menu_button =
+      views::CreateVectorImageButton(/*listener*/ nullptr);
+  views::SetImageFromVectorIcon(group_menu_button, kBrowserToolsIcon);
+  AddChildView(group_menu_button);
+}
+
+void TabGroupHeader::OnPaint(gfx::Canvas* canvas) {
+  // TODO(crbug.com/905491): Call TabStyle::PaintTab.
+  constexpr SkColor kPlaceholderColor = SkColorSetRGB(0xAA, 0xBB, 0xCC);
+  canvas->FillRect(GetLocalBounds(), kPlaceholderColor);
+}
diff --git a/chrome/browser/ui/views/tabs/tab_group_header.h b/chrome/browser/ui/views/tabs/tab_group_header.h
new file mode 100644
index 0000000..01d111e9
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/tab_group_header.h
@@ -0,0 +1,28 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_GROUP_HEADER_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_GROUP_HEADER_H_
+
+#include "ui/views/view.h"
+
+namespace gfx {
+class Canvas;
+}
+
+// View for tab group headers in the tab strip, which are tab-shaped markers of
+// group boundaries. There is one header for each group, which is included in
+// the tab strip flow and positioned left of the leftmost tab in the group.
+class TabGroupHeader : public views::View {
+ public:
+  TabGroupHeader();
+
+  // views::View:
+  void OnPaint(gfx::Canvas* canvas) override;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(TabGroupHeader);
+};
+
+#endif  // CHROME_BROWSER_UI_VIEWS_TABS_TAB_GROUP_HEADER_H_