| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" | 5 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 static base::LazyInstance<HarmonyLayoutDelegate> harmony_layout_delegate_ = | 10 static base::LazyInstance<HarmonyLayoutDelegate> harmony_layout_delegate_ = |
| 11 LAZY_INSTANCE_INITIALIZER; | 11 LAZY_INSTANCE_INITIALIZER; |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 HarmonyLayoutDelegate* HarmonyLayoutDelegate::Get() { | 14 HarmonyLayoutDelegate* HarmonyLayoutDelegate::Get() { |
| 15 return harmony_layout_delegate_.Pointer(); | 15 return harmony_layout_delegate_.Pointer(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 int HarmonyLayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const { | 18 int HarmonyLayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const { |
| 19 switch (type) { | 19 switch (type) { |
| 20 case LayoutDistanceType::PANEL_HORIZ_MARGIN: | 20 case LayoutDistanceType::DIALOG_BUTTON_MARGIN: |
| 21 return kHarmonyLayoutUnit; | 21 return kHarmonyLayoutUnit; |
| 22 case LayoutDistanceType::PANEL_VERT_MARGIN: | 22 case LayoutDistanceType::PANEL_CONTENT_MARGIN: |
| 23 return kHarmonyLayoutUnit; | 23 return kHarmonyLayoutUnit; |
| 24 case LayoutDistanceType::RELATED_BUTTON_HORIZONTAL_SPACING: | 24 case LayoutDistanceType::RELATED_BUTTON_HORIZONTAL_SPACING: |
| 25 return kHarmonyLayoutUnit / 2; | 25 return kHarmonyLayoutUnit / 2; |
| 26 case LayoutDistanceType::RELATED_CONTROL_HORIZONTAL_SPACING: | 26 case LayoutDistanceType::RELATED_CONTROL_HORIZONTAL_SPACING: |
| 27 return kHarmonyLayoutUnit; | 27 return kHarmonyLayoutUnit; |
| 28 case LayoutDistanceType::RELATED_CONTROL_VERTICAL_SPACING: | 28 case LayoutDistanceType::RELATED_CONTROL_VERTICAL_SPACING: |
| 29 return kHarmonyLayoutUnit / 2; | 29 return kHarmonyLayoutUnit / 2; |
| 30 case LayoutDistanceType::SUBSECTION_HORIZONTAL_INDENT: |
| 31 return 0; |
| 30 case LayoutDistanceType::UNRELATED_CONTROL_VERTICAL_SPACING: | 32 case LayoutDistanceType::UNRELATED_CONTROL_VERTICAL_SPACING: |
| 31 return kHarmonyLayoutUnit; | 33 return kHarmonyLayoutUnit; |
| 32 case LayoutDistanceType::UNRELATED_CONTROL_LARGE_VERTICAL_SPACING: | 34 case LayoutDistanceType::UNRELATED_CONTROL_VERTICAL_SPACING_LARGE: |
| 33 return kHarmonyLayoutUnit; | 35 return kHarmonyLayoutUnit; |
| 34 case LayoutDistanceType::BUTTON_VEDGE_MARGIN_NEW: | |
| 35 return kHarmonyLayoutUnit; | |
| 36 case LayoutDistanceType::BUTTON_HEDGE_MARGIN_NEW: | |
| 37 return kHarmonyLayoutUnit; | |
| 38 case LayoutDistanceType::CHECKBOX_INDENT: | |
| 39 return 0; | |
| 40 } | 36 } |
| 41 NOTREACHED(); | 37 NOTREACHED(); |
| 42 return 0; | 38 return 0; |
| 43 } | 39 } |
| 44 | 40 |
| 45 views::GridLayout::Alignment | 41 views::GridLayout::Alignment |
| 46 HarmonyLayoutDelegate::GetControlLabelGridAlignment() const { | 42 HarmonyLayoutDelegate::GetControlLabelGridAlignment() const { |
| 47 return views::GridLayout::LEADING; | 43 return views::GridLayout::LEADING; |
| 48 } | 44 } |
| 49 | 45 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 case DialogWidthType::SMALL: | 56 case DialogWidthType::SMALL: |
| 61 return 320; | 57 return 320; |
| 62 case DialogWidthType::MEDIUM: | 58 case DialogWidthType::MEDIUM: |
| 63 return 448; | 59 return 448; |
| 64 case DialogWidthType::LARGE: | 60 case DialogWidthType::LARGE: |
| 65 return 512; | 61 return 512; |
| 66 } | 62 } |
| 67 NOTREACHED(); | 63 NOTREACHED(); |
| 68 return 0; | 64 return 0; |
| 69 } | 65 } |
| OLD | NEW |