| Index: ui/harmony/harmony_layout_delegate.cc
|
| diff --git a/ui/harmony/harmony_layout_delegate.cc b/ui/harmony/harmony_layout_delegate.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cb9be386055f7befb1374982564d243ca31d02f4
|
| --- /dev/null
|
| +++ b/ui/harmony/harmony_layout_delegate.cc
|
| @@ -0,0 +1,50 @@
|
| +// 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 "ui/base/material_design/material_design_controller.h"
|
| +#include "ui/harmony/harmony_layout_delegate.h"
|
| +#include "ui/views/view.h"
|
| +
|
| +namespace ui {
|
| +
|
| +static HarmonyLayoutDelegate harmony_layout_delegate_;
|
| +
|
| +// static
|
| +HarmonyLayoutDelegate* HarmonyLayoutDelegate::Get() {
|
| + return &harmony_layout_delegate_;
|
| +}
|
| +
|
| +// static
|
| +void HarmonyLayoutDelegate::ApplyToViewIfNeeded(views::View* view) {
|
| + if (ui::MaterialDesignController::IsSecondaryUiMaterial())
|
| + view->SetLayoutDelegate(&harmony_layout_delegate_);
|
| +}
|
| +
|
| +int HarmonyLayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const {
|
| + const int kLayoutUnit = 16;
|
| + switch (type) {
|
| + case PANEL_VERT_MARGIN:
|
| + return kLayoutUnit;
|
| + case RELATED_BUTTON_HORIZONTAL_SPACING:
|
| + return kLayoutUnit / 2;
|
| + case RELATED_CONTROL_HORIZONTAL_SPACING:
|
| + return kLayoutUnit;
|
| + case RELATED_CONTROL_VERTICAL_SPACING:
|
| + return kLayoutUnit / 2;
|
| + case UNRELATED_CONTROL_VERTICAL_SPACING:
|
| + return kLayoutUnit;
|
| + case UNRELATED_CONTROL_LARGE_VERTICAL_SPACING:
|
| + return kLayoutUnit;
|
| + case BUTTON_VEDGE_MARGIN_NEW:
|
| + return kLayoutUnit;
|
| + case BUTTON_HEDGE_MARGIN_NEW:
|
| + return kLayoutUnit;
|
| + }
|
| +}
|
| +
|
| +bool HarmonyLayoutDelegate::UseExtraDialogPadding() const {
|
| + return false;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|