| 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::BUTTON_HORIZONTAL_PADDING: | 25 case Metric::BUTTON_HORIZONTAL_PADDING: |
| 26 return views::kButtonHorizontalPadding; | 26 return views::kButtonHorizontalPadding; |
| 27 case Metric::BUTTON_MARGIN: |
| 28 return views::kButtonExtraTouchSize; |
| 27 case Metric::BUTTON_MINIMUM_WIDTH: | 29 case Metric::BUTTON_MINIMUM_WIDTH: |
| 28 return views::kMinimumButtonWidth; | 30 return views::kMinimumButtonWidth; |
| 29 case Metric::DIALOG_BUTTON_MARGIN: | 31 case Metric::DIALOG_BUTTON_MARGIN: |
| 30 return views::kButtonHEdgeMarginNew; | 32 return views::kButtonHEdgeMarginNew; |
| 31 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: | 33 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: |
| 32 return views::kDialogMinimumButtonWidth; | 34 return views::kDialogMinimumButtonWidth; |
| 33 case Metric::DIALOG_BUTTON_TOP_SPACING: | 35 case Metric::DIALOG_BUTTON_TOP_SPACING: |
| 34 return 0; | 36 return 0; |
| 35 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: | 37 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: |
| 36 return views::kCloseButtonMargin; | 38 return views::kCloseButtonMargin; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return true; | 70 return true; |
| 69 } | 71 } |
| 70 | 72 |
| 71 bool LayoutDelegate::IsHarmonyMode() const { | 73 bool LayoutDelegate::IsHarmonyMode() const { |
| 72 return false; | 74 return false; |
| 73 } | 75 } |
| 74 | 76 |
| 75 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { | 77 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { |
| 76 return 0; | 78 return 0; |
| 77 } | 79 } |
| OLD | NEW |