| 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::GetMetric(Metric metric) const { | 18 int HarmonyLayoutDelegate::GetMetric(Metric metric) const { |
| 19 switch (metric) { | 19 switch (metric) { |
| 20 case Metric::DIALOG_BUTTON_MARGIN: | 20 case Metric::DIALOG_BUTTON_MARGIN: |
| 21 return kHarmonyLayoutUnit; | 21 return kHarmonyLayoutUnit; |
| 22 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: |
| 23 // TODO(pkasting): The "- 4" here is a hack that matches the extra padding |
| 24 // in vector_icon_button.cc and should be removed when that padding is. |
| 25 return (kHarmonyLayoutUnit / 2) - 4; |
| 22 case Metric::PANEL_CONTENT_MARGIN: | 26 case Metric::PANEL_CONTENT_MARGIN: |
| 23 return kHarmonyLayoutUnit; | 27 return kHarmonyLayoutUnit; |
| 24 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: | 28 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: |
| 25 return kHarmonyLayoutUnit / 2; | 29 return kHarmonyLayoutUnit / 2; |
| 26 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: | 30 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: |
| 27 return kHarmonyLayoutUnit; | 31 return kHarmonyLayoutUnit; |
| 28 case Metric::RELATED_CONTROL_VERTICAL_SPACING: | 32 case Metric::RELATED_CONTROL_VERTICAL_SPACING: |
| 29 return kHarmonyLayoutUnit / 2; | 33 return kHarmonyLayoutUnit / 2; |
| 30 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: | 34 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: |
| 31 return kHarmonyLayoutUnit; | 35 return kHarmonyLayoutUnit; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 case DialogWidth::SMALL: | 62 case DialogWidth::SMALL: |
| 59 return 320; | 63 return 320; |
| 60 case DialogWidth::MEDIUM: | 64 case DialogWidth::MEDIUM: |
| 61 return 448; | 65 return 448; |
| 62 case DialogWidth::LARGE: | 66 case DialogWidth::LARGE: |
| 63 return 512; | 67 return 512; |
| 64 } | 68 } |
| 65 NOTREACHED(); | 69 NOTREACHED(); |
| 66 return 0; | 70 return 0; |
| 67 } | 71 } |
| OLD | NEW |