Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6728)

Unified Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 2664073006: Implement ChromeViewsDelegate methods in terms of LayoutDelegate where possible. (Closed)
Patch Set: Now with correct type names Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.h ('k') | ui/views/views_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/chrome_views_delegate.cc
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index 88741a15dc8edce8caa5472b33bda44f58baf480..8eb0a06b0f4505e36d25363a3ef9ca50028e4e60 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -541,37 +541,34 @@ ChromeViewsDelegate::GetBlockingPoolTaskRunner() {
return content::BrowserThread::GetBlockingPool();
}
-gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit);
- return ViewsDelegate::GetDialogButtonInsets();
+gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() const {
+ return gfx::Insets(LayoutDelegate::Get()->GetMetric(
+ LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN));
}
-int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2;
- return ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing();
+int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const {
+ return LayoutDelegate::Get()->GetMetric(
+ LayoutDelegate::Metric::RELATED_BUTTON_HORIZONTAL_SPACING);
sky 2017/02/01 16:29:01 I'm assuming all these calls result in the same va
Peter Kasting 2017/02/01 19:58:43 They should, if I did my cross-checking correctly.
}
-int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2;
- return ViewsDelegate::GetDialogRelatedControlVerticalSpacing();
+int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() const {
+ return LayoutDelegate::Get()->GetMetric(
+ LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
}
-gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- // Titles are inset at the top and sides, but not at the bottom.
- return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit,
- HarmonyLayoutDelegate::kHarmonyLayoutUnit, 0,
- HarmonyLayoutDelegate::kHarmonyLayoutUnit);
- return ViewsDelegate::GetDialogFrameViewInsets();
+gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() const {
+ const LayoutDelegate* layout_delegate = LayoutDelegate::Get();
+ const int top = layout_delegate->GetMetric(
+ LayoutDelegate::Metric::PANEL_CONTENT_MARGIN);
+ const int side = layout_delegate->GetMetric(
+ LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
+ // Titles are inset at the top and sides, but not at the bottom.
+ return gfx::Insets(top, side, 0, side);
}
-gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit);
- return ViewsDelegate::GetBubbleDialogMargins();
+gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() const {
+ return gfx::Insets(LayoutDelegate::Get()->GetMetric(
+ LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
}
#if !defined(USE_ASH)
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.h ('k') | ui/views/views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698