| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_provider.h" | 5 #include "chrome/browser/ui/views/harmony/harmony_layout_provider.h" |
| 6 | 6 |
| 7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const { | 7 gfx::Insets HarmonyLayoutProvider::GetInsetsMetric(int metric) const { |
| 8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX); | 8 DCHECK_LT(metric, views::VIEWS_INSETS_MAX); |
| 9 switch (metric) { | 9 switch (metric) { |
| 10 case views::INSETS_DIALOG_BUTTON: | 10 case views::INSETS_DIALOG_BUTTON: |
| 11 case views::INSETS_PANEL: | 11 case views::INSETS_PANEL: |
| 12 case views::INSETS_BUBBLE_CONTENTS: | 12 case views::INSETS_BUBBLE_CONTENTS: |
| 13 return gfx::Insets(kHarmonyLayoutUnit); | 13 return gfx::Insets(kHarmonyLayoutUnit); |
| 14 case views::INSETS_DIALOG_TITLE: { | 14 case views::INSETS_DIALOG_TITLE: { |
| 15 constexpr int top = kHarmonyLayoutUnit; | 15 constexpr int top = kHarmonyLayoutUnit; |
| 16 constexpr int side = kHarmonyLayoutUnit; | 16 constexpr int side = kHarmonyLayoutUnit; |
| 17 // Titles are inset at the top and sides, but not at the bottom. | 17 // Titles are inset at the top and sides, but not at the bottom. |
| 18 return gfx::Insets(top, side, 0, side); | 18 return gfx::Insets(top, side, 0, side); |
| 19 } | 19 } |
| 20 case views::INSETS_VECTOR_IMAGE_BUTTON: | 20 case views::INSETS_VECTOR_IMAGE_BUTTON: |
| 21 return gfx::Insets(kHarmonyLayoutUnit / 4); | 21 return gfx::Insets(kHarmonyLayoutUnit / 4); |
| 22 } | 22 } |
| 23 NOTREACHED(); | 23 NOTREACHED(); |
| 24 return gfx::Insets(); | 24 return gfx::Insets(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 int HarmonyLayoutProvider::GetDistanceMetric(int metric) const { | 27 int HarmonyLayoutProvider::GetDistanceMetric(int metric) const { |
| 28 DCHECK_GE(metric, views::VIEWS_INSETS_MAX); | 28 DCHECK_GE(metric, views::VIEWS_INSETS_MAX); |
| 29 switch (metric) { | 29 switch (metric) { |
| 30 case DISTANCE_CONTROL_LIST_VERTICAL: |
| 31 return kHarmonyLayoutUnit * 3 / 4; |
| 30 case views::DISTANCE_CLOSE_BUTTON_MARGIN: { | 32 case views::DISTANCE_CLOSE_BUTTON_MARGIN: { |
| 31 constexpr int kVisibleMargin = kHarmonyLayoutUnit / 2; | 33 constexpr int kVisibleMargin = kHarmonyLayoutUnit / 2; |
| 32 // The visible margin is based on the unpadded size, so to get the actual | 34 // The visible margin is based on the unpadded size, so to get the actual |
| 33 // margin we need to subtract out the padding. | 35 // margin we need to subtract out the padding. |
| 34 return kVisibleMargin - kHarmonyLayoutUnit / 4; | 36 return kVisibleMargin - kHarmonyLayoutUnit / 4; |
| 35 } | 37 } |
| 36 case views::DISTANCE_RELATED_BUTTON_HORIZONTAL: | 38 case views::DISTANCE_RELATED_BUTTON_HORIZONTAL: |
| 37 return kHarmonyLayoutUnit / 2; | 39 return kHarmonyLayoutUnit / 2; |
| 38 case views::DISTANCE_RELATED_CONTROL_HORIZONTAL: | 40 case views::DISTANCE_RELATED_CONTROL_HORIZONTAL: |
| 39 return kHarmonyLayoutUnit; | 41 return kHarmonyLayoutUnit; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return 512; | 104 return 512; |
| 103 } | 105 } |
| 104 NOTREACHED(); | 106 NOTREACHED(); |
| 105 return 0; | 107 return 0; |
| 106 } | 108 } |
| 107 | 109 |
| 108 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider() | 110 const views::TypographyProvider& HarmonyLayoutProvider::GetTypographyProvider() |
| 109 const { | 111 const { |
| 110 return typography_provider_; | 112 return typography_provider_; |
| 111 } | 113 } |
| OLD | NEW |