Commit 34436dd8 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Remove HarmonyLayoutProvider

Moves all of HarmonyLayoutProvider back into ChromeLayoutProvider which
becomes the new default layout provider. This obsoletes
LegacyTypographyProvider which is removed.

Bug: chromium:867557
Change-Id: I124c3d0992faedd1daae2b6cca60f190b5e8259c
Reviewed-on: https://chromium-review.googlesource.com/1171362Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583115}
parent 4a2dfc81
...@@ -2891,8 +2891,6 @@ jumbo_split_static_library("ui") { ...@@ -2891,8 +2891,6 @@ jumbo_split_static_library("ui") {
"views/harmony/chrome_layout_provider.h", "views/harmony/chrome_layout_provider.h",
"views/harmony/chrome_typography.cc", "views/harmony/chrome_typography.cc",
"views/harmony/chrome_typography.h", "views/harmony/chrome_typography.h",
"views/harmony/harmony_layout_provider.cc",
"views/harmony/harmony_layout_provider.h",
"views/harmony/harmony_typography_provider.cc", "views/harmony/harmony_typography_provider.cc",
"views/harmony/harmony_typography_provider.h", "views/harmony/harmony_typography_provider.h",
"views/harmony/material_refresh_layout_provider.cc", "views/harmony/material_refresh_layout_provider.cc",
......
...@@ -8,12 +8,19 @@ ...@@ -8,12 +8,19 @@
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h" #include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "chrome/browser/ui/views/harmony/harmony_layout_provider.h"
#include "chrome/browser/ui/views/harmony/material_refresh_layout_provider.h" #include "chrome/browser/ui/views/harmony/material_refresh_layout_provider.h"
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
namespace { namespace {
// TODO(pbos): Inline kHarmonyLayoutUnit calculations below as it's not really
// respected (there's 3 * unit / 4 in use to express 12).
// The Harmony layout unit. All distances are in terms of this unit.
constexpr int kHarmonyLayoutUnit = 16;
constexpr int kSmallSnapPoint = 320;
constexpr int kMediumSnapPoint = 448;
constexpr int kLargeSnapPoint = 512;
ChromeLayoutProvider* g_chrome_layout_provider = nullptr; ChromeLayoutProvider* g_chrome_layout_provider = nullptr;
} // namespace } // namespace
...@@ -38,44 +45,148 @@ ChromeLayoutProvider* ChromeLayoutProvider::Get() { ...@@ -38,44 +45,148 @@ ChromeLayoutProvider* ChromeLayoutProvider::Get() {
// static // static
std::unique_ptr<views::LayoutProvider> std::unique_ptr<views::LayoutProvider>
ChromeLayoutProvider::CreateLayoutProvider() { ChromeLayoutProvider::CreateLayoutProvider() {
// TODO(pbos): Consolidate HarmonyLayoutProvider into ChromeLayoutProvider as
// it is no longer active, or wait until Refresh is always on then consolidate
// all three.
if (ui::MaterialDesignController::IsRefreshUi()) if (ui::MaterialDesignController::IsRefreshUi())
return std::make_unique<MaterialRefreshLayoutProvider>(); return std::make_unique<MaterialRefreshLayoutProvider>();
return std::make_unique<HarmonyLayoutProvider>(); return std::make_unique<ChromeLayoutProvider>();
} }
gfx::Insets ChromeLayoutProvider::GetInsetsMetric(int metric) const { gfx::Insets ChromeLayoutProvider::GetInsetsMetric(int metric) const {
CHECK(false); DCHECK_LT(metric, views::VIEWS_INSETS_MAX);
return gfx::Insets(); switch (metric) {
case views::INSETS_DIALOG:
case views::INSETS_DIALOG_SUBSECTION:
return gfx::Insets(kHarmonyLayoutUnit);
case views::INSETS_CHECKBOX_RADIO_BUTTON: {
gfx::Insets insets = LayoutProvider::GetInsetsMetric(metric);
// Material Design requires that checkboxes and radio buttons are aligned
// flush to the left edge.
return gfx::Insets(insets.top(), 0, insets.bottom(), insets.right());
}
case views::INSETS_VECTOR_IMAGE_BUTTON:
return gfx::Insets(kHarmonyLayoutUnit / 4);
case views::InsetsMetric::INSETS_LABEL_BUTTON:
if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
return gfx::Insets(kHarmonyLayoutUnit / 2, kHarmonyLayoutUnit / 2);
return LayoutProvider::GetInsetsMetric(metric);
case INSETS_BOOKMARKS_BAR_BUTTON:
if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
return gfx::Insets(8, 12);
return GetInsetsMetric(views::InsetsMetric::INSETS_LABEL_BUTTON);
case INSETS_TOAST:
return gfx::Insets(0, kHarmonyLayoutUnit);
default:
return LayoutProvider::GetInsetsMetric(metric);
}
} }
int ChromeLayoutProvider::GetDistanceMetric(int metric) const { int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
CHECK(false); DCHECK_GE(metric, views::VIEWS_INSETS_MAX);
return 0; switch (metric) {
case DISTANCE_CONTENT_LIST_VERTICAL_SINGLE:
return kHarmonyLayoutUnit / 4;
case DISTANCE_CONTENT_LIST_VERTICAL_MULTI:
return kHarmonyLayoutUnit / 2;
case DISTANCE_CONTROL_LIST_VERTICAL:
return kHarmonyLayoutUnit * 3 / 4;
case views::DISTANCE_CLOSE_BUTTON_MARGIN: {
constexpr int kVisibleMargin = kHarmonyLayoutUnit / 2;
// The visible margin is based on the unpadded size, so to get the actual
// margin we need to subtract out the padding.
return kVisibleMargin - kHarmonyLayoutUnit / 4;
}
case views::DISTANCE_CONTROL_VERTICAL_TEXT_PADDING:
return kHarmonyLayoutUnit / 4;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL:
return kHarmonyLayoutUnit * 3 / 2;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT: {
// This is reduced so there is about the same amount of visible
// whitespace, compensating for the text's internal leading.
return GetDistanceMetric(
views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL) -
8;
}
case views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_CONTROL:
return kHarmonyLayoutUnit;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_TEXT: {
// See the comment in DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT above.
return GetDistanceMetric(
views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_CONTROL) -
8;
}
case views::DISTANCE_RELATED_BUTTON_HORIZONTAL:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_RELATED_CONTROL_HORIZONTAL:
return kHarmonyLayoutUnit;
case DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL:
return kHarmonyLayoutUnit;
case views::DISTANCE_RELATED_CONTROL_VERTICAL:
return kHarmonyLayoutUnit / 2;
case DISTANCE_RELATED_CONTROL_VERTICAL_SMALL:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH:
case DISTANCE_BUTTON_MINIMUM_WIDTH:
// Minimum label size plus padding.
return 2 * kHarmonyLayoutUnit +
2 * GetDistanceMetric(views::DISTANCE_BUTTON_HORIZONTAL_PADDING);
case views::DISTANCE_BUTTON_HORIZONTAL_PADDING:
return kHarmonyLayoutUnit;
case views::DISTANCE_BUTTON_MAX_LINKABLE_WIDTH:
return kHarmonyLayoutUnit * 7;
case views::DISTANCE_RELATED_LABEL_HORIZONTAL:
case views::DISTANCE_TABLE_CELL_HORIZONTAL_MARGIN:
return 3 * kHarmonyLayoutUnit / 4;
case DISTANCE_RELATED_LABEL_HORIZONTAL_LIST:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_DIALOG_SCROLLABLE_AREA_MAX_HEIGHT:
return kHarmonyLayoutUnit * 12;
case DISTANCE_SUBSECTION_HORIZONTAL_INDENT:
return 0;
case DISTANCE_TOAST_CONTROL_VERTICAL:
return 8;
case DISTANCE_TOAST_LABEL_VERTICAL:
return 12;
case views::DISTANCE_TEXTFIELD_HORIZONTAL_TEXT_PADDING:
return kHarmonyLayoutUnit / 2;
case DISTANCE_UNRELATED_CONTROL_HORIZONTAL:
return kHarmonyLayoutUnit;
case DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE:
return kHarmonyLayoutUnit;
case views::DISTANCE_UNRELATED_CONTROL_VERTICAL:
return kHarmonyLayoutUnit;
case DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE:
return kHarmonyLayoutUnit;
case DISTANCE_BUBBLE_PREFERRED_WIDTH:
return kSmallSnapPoint;
case DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH:
return kMediumSnapPoint;
default:
return LayoutProvider::GetDistanceMetric(metric);
}
}
int ChromeLayoutProvider::GetSnappedDialogWidth(int min_width) const {
for (int snap_point : {kSmallSnapPoint, kMediumSnapPoint, kLargeSnapPoint}) {
if (min_width <= snap_point)
return snap_point;
}
return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) *
kHarmonyLayoutUnit;
} }
const views::TypographyProvider& ChromeLayoutProvider::GetTypographyProvider() const views::TypographyProvider& ChromeLayoutProvider::GetTypographyProvider()
const { const {
CHECK(false); return typography_provider_;
// This is not a data member because then HarmonyLayoutProvider would inherit
// it, even when it provides its own.
CR_DEFINE_STATIC_LOCAL(LegacyTypographyProvider, legacy_provider, ());
return legacy_provider;
} }
views::GridLayout::Alignment views::GridLayout::Alignment
ChromeLayoutProvider::GetControlLabelGridAlignment() const { ChromeLayoutProvider::GetControlLabelGridAlignment() const {
CHECK(false); return views::GridLayout::LEADING;
return views::GridLayout::TRAILING;
} }
bool ChromeLayoutProvider::UseExtraDialogPadding() const { bool ChromeLayoutProvider::UseExtraDialogPadding() const {
CHECK(false); return false;
return true;
} }
bool ChromeLayoutProvider::ShouldShowWindowIcon() const { bool ChromeLayoutProvider::ShouldShowWindowIcon() const {
CHECK(false); return false;
return true;
} }
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/ui/views/harmony/harmony_typography_provider.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
...@@ -73,6 +74,7 @@ class ChromeLayoutProvider : public views::LayoutProvider { ...@@ -73,6 +74,7 @@ class ChromeLayoutProvider : public views::LayoutProvider {
// views::LayoutProvider: // views::LayoutProvider:
gfx::Insets GetInsetsMetric(int metric) const override; gfx::Insets GetInsetsMetric(int metric) const override;
int GetDistanceMetric(int metric) const override; int GetDistanceMetric(int metric) const override;
int GetSnappedDialogWidth(int min_width) const override;
const views::TypographyProvider& GetTypographyProvider() const override; const views::TypographyProvider& GetTypographyProvider() const override;
// Returns the alignment used for control labels in a GridLayout; for example, // Returns the alignment used for control labels in a GridLayout; for example,
...@@ -92,6 +94,8 @@ class ChromeLayoutProvider : public views::LayoutProvider { ...@@ -92,6 +94,8 @@ class ChromeLayoutProvider : public views::LayoutProvider {
virtual bool ShouldShowWindowIcon() const; virtual bool ShouldShowWindowIcon() const;
private: private:
const HarmonyTypographyProvider typography_provider_;
DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider); DISALLOW_COPY_AND_ASSIGN(ChromeLayoutProvider);
}; };
......
...@@ -101,54 +101,3 @@ void ApplyCommonFontStyles(int context, ...@@ -101,54 +101,3 @@ void ApplyCommonFontStyles(int context,
#endif #endif
} }
} }
const gfx::FontList& LegacyTypographyProvider::GetFont(int context,
int style) const {
constexpr int kHeadlineDelta = 8;
constexpr int kDialogMessageDelta = 1;
int size_delta;
gfx::Font::Weight font_weight;
GetDefaultFont(context, style, &size_delta, &font_weight);
#if defined(OS_CHROMEOS)
ash::ApplyAshFontStyles(context, style, &size_delta, &font_weight);
#endif
ApplyCommonFontStyles(context, style, &size_delta, &font_weight);
switch (context) {
case CONTEXT_HEADLINE:
size_delta = kHeadlineDelta;
break;
case CONTEXT_BODY_TEXT_LARGE:
// Note: Not using ui::kMessageFontSizeDelta, so 13pt in most cases.
size_delta = kDialogMessageDelta;
break;
case CONTEXT_BODY_TEXT_SMALL:
size_delta = ui::kLabelFontSizeDelta;
break;
}
switch (style) {
case STYLE_EMPHASIZED:
case STYLE_EMPHASIZED_SECONDARY:
font_weight = gfx::Font::Weight::BOLD;
break;
}
constexpr gfx::Font::FontStyle kFontStyle = gfx::Font::NORMAL;
return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
size_delta, kFontStyle, font_weight);
}
SkColor LegacyTypographyProvider::GetColor(const views::View& view,
int context,
int style) const {
// Use "disabled grey" for HINT and SECONDARY when Harmony is disabled.
if (style == STYLE_HINT || style == STYLE_SECONDARY ||
style == STYLE_EMPHASIZED_SECONDARY) {
style = views::style::STYLE_DISABLED;
}
return DefaultTypographyProvider::GetColor(view, context, style);
}
...@@ -86,19 +86,4 @@ void ApplyCommonFontStyles(int context, ...@@ -86,19 +86,4 @@ void ApplyCommonFontStyles(int context,
int* size_delta, int* size_delta,
gfx::Font::Weight* weight); gfx::Font::Weight* weight);
// TypographyProvider that provides pre-Harmony fonts in Chrome.
class LegacyTypographyProvider : public views::DefaultTypographyProvider {
public:
LegacyTypographyProvider() = default;
// DefaultTypographyProvider:
const gfx::FontList& GetFont(int context, int style) const override;
SkColor GetColor(const views::View& view,
int context,
int style) const override;
private:
DISALLOW_COPY_AND_ASSIGN(LegacyTypographyProvider);
};
#endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_ #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_CHROME_TYPOGRAPHY_H_
// Copyright 2017 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/harmony/harmony_layout_provider.h"
#include "ui/base/material_design/material_design_controller.h"
namespace {
// TODO(pbos): Inline kHarmonyLayoutUnit calculations below as it's not really
// respected (there's 3 * unit / 4 in use to express 12).
// The Harmony layout unit. All distances are in terms of this unit.
constexpr int kHarmonyLayoutUnit = 16;
constexpr int kSmallSnapPoint = 320;
constexpr int kMediumSnapPoint = 448;
constexpr int kLargeSnapPoint = 512;
} // namespace
gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const {
DCHECK_LT(metric, views::VIEWS_INSETS_MAX);
switch (metric) {
case views::INSETS_DIALOG:
case views::INSETS_DIALOG_SUBSECTION:
return gfx::Insets(kHarmonyLayoutUnit);
case views::INSETS_CHECKBOX_RADIO_BUTTON: {
gfx::Insets insets = LayoutProvider::GetInsetsMetric(metric);
// Material Design requires that checkboxes and radio buttons are aligned
// flush to the left edge.
return gfx::Insets(insets.top(), 0, insets.bottom(), insets.right());
}
case views::INSETS_VECTOR_IMAGE_BUTTON:
return gfx::Insets(kHarmonyLayoutUnit / 4);
case views::InsetsMetric::INSETS_LABEL_BUTTON:
if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
return gfx::Insets(kHarmonyLayoutUnit / 2, kHarmonyLayoutUnit / 2);
return LayoutProvider::GetInsetsMetric(metric);
case INSETS_BOOKMARKS_BAR_BUTTON:
if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
return gfx::Insets(8, 12);
return GetInsetsMetric(views::InsetsMetric::INSETS_LABEL_BUTTON);
case INSETS_TOAST:
return gfx::Insets(0, kHarmonyLayoutUnit);
default:
return LayoutProvider::GetInsetsMetric(metric);
}
}
int HarmonyLayoutProvider::GetDistanceMetric(int metric) const {
DCHECK_GE(metric, views::VIEWS_INSETS_MAX);
switch (metric) {
case DISTANCE_CONTENT_LIST_VERTICAL_SINGLE:
return kHarmonyLayoutUnit / 4;
case DISTANCE_CONTENT_LIST_VERTICAL_MULTI:
return kHarmonyLayoutUnit / 2;
case DISTANCE_CONTROL_LIST_VERTICAL:
return kHarmonyLayoutUnit * 3 / 4;
case views::DISTANCE_CLOSE_BUTTON_MARGIN: {
constexpr int kVisibleMargin = kHarmonyLayoutUnit / 2;
// The visible margin is based on the unpadded size, so to get the actual
// margin we need to subtract out the padding.
return kVisibleMargin - kHarmonyLayoutUnit / 4;
}
case views::DISTANCE_CONTROL_VERTICAL_TEXT_PADDING:
return kHarmonyLayoutUnit / 4;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL:
return kHarmonyLayoutUnit * 3 / 2;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT: {
// This is reduced so there is about the same amount of visible
// whitespace, compensating for the text's internal leading.
return GetDistanceMetric(
views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL) -
8;
}
case views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_CONTROL:
return kHarmonyLayoutUnit;
case views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_TEXT: {
// See the comment in DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT above.
return GetDistanceMetric(
views::DISTANCE_DIALOG_CONTENT_MARGIN_TOP_CONTROL) -
8;
}
case views::DISTANCE_RELATED_BUTTON_HORIZONTAL:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_RELATED_CONTROL_HORIZONTAL:
return kHarmonyLayoutUnit;
case DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL:
return kHarmonyLayoutUnit;
case views::DISTANCE_RELATED_CONTROL_VERTICAL:
return kHarmonyLayoutUnit / 2;
case DISTANCE_RELATED_CONTROL_VERTICAL_SMALL:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH:
case DISTANCE_BUTTON_MINIMUM_WIDTH:
// Minimum label size plus padding.
return 2 * kHarmonyLayoutUnit +
2 * GetDistanceMetric(views::DISTANCE_BUTTON_HORIZONTAL_PADDING);
case views::DISTANCE_BUTTON_HORIZONTAL_PADDING:
return kHarmonyLayoutUnit;
case views::DISTANCE_BUTTON_MAX_LINKABLE_WIDTH:
return kHarmonyLayoutUnit * 7;
case views::DISTANCE_RELATED_LABEL_HORIZONTAL:
case views::DISTANCE_TABLE_CELL_HORIZONTAL_MARGIN:
return 3 * kHarmonyLayoutUnit / 4;
case DISTANCE_RELATED_LABEL_HORIZONTAL_LIST:
return kHarmonyLayoutUnit / 2;
case views::DISTANCE_DIALOG_SCROLLABLE_AREA_MAX_HEIGHT:
return kHarmonyLayoutUnit * 12;
case DISTANCE_SUBSECTION_HORIZONTAL_INDENT:
return 0;
case DISTANCE_TOAST_CONTROL_VERTICAL:
return 8;
case DISTANCE_TOAST_LABEL_VERTICAL:
return 12;
case views::DISTANCE_TEXTFIELD_HORIZONTAL_TEXT_PADDING:
return kHarmonyLayoutUnit / 2;
case DISTANCE_UNRELATED_CONTROL_HORIZONTAL:
return kHarmonyLayoutUnit;
case DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE:
return kHarmonyLayoutUnit;
case views::DISTANCE_UNRELATED_CONTROL_VERTICAL:
return kHarmonyLayoutUnit;
case DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE:
return kHarmonyLayoutUnit;
case DISTANCE_BUBBLE_PREFERRED_WIDTH:
return kSmallSnapPoint;
case DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH:
return kMediumSnapPoint;
default:
return LayoutProvider::GetDistanceMetric(metric);
}
}
views::GridLayout::Alignment
HarmonyLayoutProvider::GetControlLabelGridAlignment() const {
return views::GridLayout::LEADING;
}
bool HarmonyLayoutProvider::UseExtraDialogPadding() const {
return false;
}
bool HarmonyLayoutProvider::ShouldShowWindowIcon() const {
return false;
}
int HarmonyLayoutProvider::GetSnappedDialogWidth(int min_width) const {
for (int snap_point : {kSmallSnapPoint, kMediumSnapPoint, kLargeSnapPoint}) {
if (min_width <= snap_point)
return snap_point;
}
return ((min_width + kHarmonyLayoutUnit - 1) / kHarmonyLayoutUnit) *
kHarmonyLayoutUnit;
}
const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider()
const {
return typography_provider_;
}
// Copyright 2017 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_HARMONY_HARMONY_LAYOUT_PROVIDER_H_
#define CHROME_BROWSER_UI_VIEWS_HARMONY_HARMONY_LAYOUT_PROVIDER_H_
#include "base/macros.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/browser/ui/views/harmony/harmony_typography_provider.h"
class HarmonyLayoutProvider : public ChromeLayoutProvider {
public:
HarmonyLayoutProvider() {}
~HarmonyLayoutProvider() override {}
gfx::Insets GetInsetsMetric(int metric) const override;
int GetDistanceMetric(int metric) const override;
views::GridLayout::Alignment GetControlLabelGridAlignment() const override;
bool UseExtraDialogPadding() const override;
bool ShouldShowWindowIcon() const override;
const views::TypographyProvider& GetTypographyProvider() const override;
int GetSnappedDialogWidth(int min_width) const override;
private:
const HarmonyTypographyProvider typography_provider_;
DISALLOW_COPY_AND_ASSIGN(HarmonyLayoutProvider);
};
#endif // CHROME_BROWSER_UI_VIEWS_HARMONY_HARMONY_LAYOUT_PROVIDER_H_
...@@ -14,7 +14,7 @@ int MaterialRefreshLayoutProvider::GetDistanceMetric(int metric) const { ...@@ -14,7 +14,7 @@ int MaterialRefreshLayoutProvider::GetDistanceMetric(int metric) const {
case views::DistanceMetric::DISTANCE_CONTROL_VERTICAL_TEXT_PADDING: case views::DistanceMetric::DISTANCE_CONTROL_VERTICAL_TEXT_PADDING:
return 6; return 6;
} }
return HarmonyLayoutProvider::GetDistanceMetric(metric); return ChromeLayoutProvider::GetDistanceMetric(metric);
} }
gfx::Insets MaterialRefreshLayoutProvider::GetInsetsMetric(int metric) const { gfx::Insets MaterialRefreshLayoutProvider::GetInsetsMetric(int metric) const {
...@@ -26,7 +26,7 @@ gfx::Insets MaterialRefreshLayoutProvider::GetInsetsMetric(int metric) const { ...@@ -26,7 +26,7 @@ gfx::Insets MaterialRefreshLayoutProvider::GetInsetsMetric(int metric) const {
return gfx::Insets(8, 10); return gfx::Insets(8, 10);
return gfx::Insets(5, 6); return gfx::Insets(5, 6);
} }
return HarmonyLayoutProvider::GetInsetsMetric(metric); return ChromeLayoutProvider::GetInsetsMetric(metric);
} }
int MaterialRefreshLayoutProvider::GetCornerRadiusMetric( int MaterialRefreshLayoutProvider::GetCornerRadiusMetric(
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#define CHROME_BROWSER_UI_VIEWS_HARMONY_MATERIAL_REFRESH_LAYOUT_PROVIDER_H_ #define CHROME_BROWSER_UI_VIEWS_HARMONY_MATERIAL_REFRESH_LAYOUT_PROVIDER_H_
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/ui/views/harmony/harmony_layout_provider.h" #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
class MaterialRefreshLayoutProvider : public HarmonyLayoutProvider { class MaterialRefreshLayoutProvider : public ChromeLayoutProvider {
public: public:
MaterialRefreshLayoutProvider() = default; MaterialRefreshLayoutProvider() = default;
~MaterialRefreshLayoutProvider() override = default; ~MaterialRefreshLayoutProvider() override = default;
......
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