| 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 "ui/views/layout/layout_provider.h" | 5 #include "ui/views/layout/layout_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/views/layout/layout_constants.h" | 10 #include "ui/views/layout/layout_constants.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 LayoutProvider* LayoutProvider::Get() { | 29 LayoutProvider* LayoutProvider::Get() { |
| 30 return g_layout_delegate; | 30 return g_layout_delegate; |
| 31 } | 31 } |
| 32 | 32 |
| 33 gfx::Insets LayoutProvider::GetInsetsMetric(int metric) const { | 33 gfx::Insets LayoutProvider::GetInsetsMetric(int metric) const { |
| 34 DCHECK_LT(metric, VIEWS_INSETS_MAX); | 34 DCHECK_LT(metric, VIEWS_INSETS_MAX); |
| 35 switch (metric) { | 35 switch (metric) { |
| 36 case InsetsMetric::INSETS_BUBBLE_CONTENTS: |
| 37 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); |
| 38 case InsetsMetric::INSETS_BUBBLE_TITLE: |
| 39 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, |
| 40 kPanelHorizMargin); |
| 36 case InsetsMetric::INSETS_DIALOG_BUTTON: | 41 case InsetsMetric::INSETS_DIALOG_BUTTON: |
| 37 return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew, | 42 return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew, |
| 38 kButtonHEdgeMarginNew); | 43 kButtonHEdgeMarginNew); |
| 39 case InsetsMetric::INSETS_DIALOG_TITLE: | 44 case InsetsMetric::INSETS_DIALOG_TITLE: |
| 40 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0, | 45 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0, |
| 41 kButtonHEdgeMarginNew); | 46 kButtonHEdgeMarginNew); |
| 42 case InsetsMetric::INSETS_BUBBLE_CONTENTS: | |
| 43 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); | |
| 44 case InsetsMetric::INSETS_PANEL: | 47 case InsetsMetric::INSETS_PANEL: |
| 45 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew); | 48 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew); |
| 46 case InsetsMetric::INSETS_VECTOR_IMAGE_BUTTON: | 49 case InsetsMetric::INSETS_VECTOR_IMAGE_BUTTON: |
| 47 return gfx::Insets(kVectorButtonExtraTouchSize); | 50 return gfx::Insets(kVectorButtonExtraTouchSize); |
| 48 } | 51 } |
| 49 NOTREACHED(); | 52 NOTREACHED(); |
| 50 return gfx::Insets(); | 53 return gfx::Insets(); |
| 51 } | 54 } |
| 52 | 55 |
| 53 int LayoutProvider::GetDistanceMetric(int metric) const { | 56 int LayoutProvider::GetDistanceMetric(int metric) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 } | 71 } |
| 69 NOTREACHED(); | 72 NOTREACHED(); |
| 70 return 0; | 73 return 0; |
| 71 } | 74 } |
| 72 | 75 |
| 73 const TypographyProvider& LayoutProvider::GetTypographyProvider() const { | 76 const TypographyProvider& LayoutProvider::GetTypographyProvider() const { |
| 74 return typography_provider_; | 77 return typography_provider_; |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace views | 80 } // namespace views |
| OLD | NEW |