| 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/layout_delegate.h" | 5 #include "chrome/browser/ui/views/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 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" | 9 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" |
| 10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| 11 #include "ui/views/layout/layout_constants.h" | 11 #include "ui/views/layout/layout_constants.h" |
| 12 | 12 |
| 13 static base::LazyInstance<LayoutDelegate> layout_delegate_ = | 13 static base::LazyInstance<LayoutDelegate> layout_delegate_ = |
| 14 LAZY_INSTANCE_INITIALIZER; | 14 LAZY_INSTANCE_INITIALIZER; |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 LayoutDelegate* LayoutDelegate::Get() { | 17 LayoutDelegate* LayoutDelegate::Get() { |
| 18 return ui::MaterialDesignController::IsSecondaryUiMaterial() | 18 return ui::MaterialDesignController::IsSecondaryUiMaterial() |
| 19 ? HarmonyLayoutDelegate::Get() | 19 ? HarmonyLayoutDelegate::Get() |
| 20 : layout_delegate_.Pointer(); | 20 : layout_delegate_.Pointer(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 int LayoutDelegate::GetMetric(Metric metric) const { | 23 int LayoutDelegate::GetMetric(Metric metric) const { |
| 24 switch (metric) { | 24 switch (metric) { |
| 25 case Metric::DIALOG_BUTTON_MARGIN: | 25 case Metric::DIALOG_BUTTON_MARGIN: |
| 26 return views::kButtonHEdgeMarginNew; | 26 return views::kButtonHEdgeMarginNew; |
| 27 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: |
| 28 return views::kCloseButtonMargin; |
| 27 case Metric::PANEL_CONTENT_MARGIN: | 29 case Metric::PANEL_CONTENT_MARGIN: |
| 28 return views::kPanelHorizMargin; | 30 return views::kPanelHorizMargin; |
| 29 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: | 31 case Metric::RELATED_BUTTON_HORIZONTAL_SPACING: |
| 30 return views::kRelatedButtonHSpacing; | 32 return views::kRelatedButtonHSpacing; |
| 31 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: | 33 case Metric::RELATED_CONTROL_HORIZONTAL_SPACING: |
| 32 return views::kRelatedControlHorizontalSpacing; | 34 return views::kRelatedControlHorizontalSpacing; |
| 33 case Metric::RELATED_CONTROL_VERTICAL_SPACING: | 35 case Metric::RELATED_CONTROL_VERTICAL_SPACING: |
| 34 return views::kRelatedControlVerticalSpacing; | 36 return views::kRelatedControlVerticalSpacing; |
| 35 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: | 37 case Metric::RELATED_LABEL_HORIZONTAL_SPACING: |
| 36 return views::kItemLabelSpacing; | 38 return views::kItemLabelSpacing; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 return true; | 56 return true; |
| 55 } | 57 } |
| 56 | 58 |
| 57 bool LayoutDelegate::IsHarmonyMode() const { | 59 bool LayoutDelegate::IsHarmonyMode() const { |
| 58 return false; | 60 return false; |
| 59 } | 61 } |
| 60 | 62 |
| 61 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { | 63 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { |
| 62 return 0; | 64 return 0; |
| 63 } | 65 } |
| OLD | NEW |