Chromium Code Reviews| Index: chrome/browser/ui/views/harmony/layout_delegate.cc |
| diff --git a/chrome/browser/ui/views/harmony/layout_delegate.cc b/chrome/browser/ui/views/harmony/layout_delegate.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1b6939fd8aee4a29138e51e488403f8fda77847 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/harmony/layout_delegate.cc |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2016 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/layout_delegate.h" |
| +#include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" |
| +#include "ui/base/material_design/material_design_controller.h" |
| +#include "ui/views/layout/layout_constants.h" |
| + |
| +namespace chrome { |
| + |
| +static LayoutDelegate layout_delegate_; |
|
sky
2016/11/14 21:49:32
Same comment about statics.
Elly Fong-Jones
2016/11/15 17:13:39
Done.
|
| + |
| +// static |
| +LayoutDelegate* LayoutDelegate::Get() { |
| + return &layout_delegate_; |
| +} |
| + |
| +// static |
| +LayoutDelegate* LayoutDelegate::GetActiveInstance() { |
| + return ui::MaterialDesignController::IsSecondaryUiMaterial() |
| + ? HarmonyLayoutDelegate::Get() |
| + : LayoutDelegate::Get(); |
| +} |
| + |
| +int LayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const { |
| + switch (type) { |
| + case PANEL_VERT_MARGIN: |
| + return views::kPanelVertMargin; |
| + case RELATED_BUTTON_HORIZONTAL_SPACING: |
| + return views::kRelatedButtonHSpacing; |
| + case RELATED_CONTROL_HORIZONTAL_SPACING: |
| + return views::kRelatedControlHorizontalSpacing; |
| + case RELATED_CONTROL_VERTICAL_SPACING: |
| + return views::kRelatedControlVerticalSpacing; |
| + case UNRELATED_CONTROL_VERTICAL_SPACING: |
| + return views::kUnrelatedControlVerticalSpacing; |
| + case UNRELATED_CONTROL_LARGE_VERTICAL_SPACING: |
| + return views::kUnrelatedControlLargeVerticalSpacing; |
| + case BUTTON_VEDGE_MARGIN_NEW: |
| + return views::kButtonVEdgeMarginNew; |
| + case BUTTON_HEDGE_MARGIN_NEW: |
| + return views::kButtonHEdgeMarginNew; |
| + } |
| + return 0; |
| +} |
| + |
| +views::GridLayout::Alignment LayoutDelegate::GetControlLabelGridAlignment() |
| + const { |
| + return views::kControlLabelGridAlignment; |
| +} |
| + |
| +bool LayoutDelegate::UseExtraDialogPadding() const { |
| + return true; |
| +} |
| + |
| +} // namespace chrome |