Chromium Code Reviews| 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 0; | 26 return views::kButtonHorizontalPadding; |
| 27 case Metric::BUTTON_MINIMUM_WIDTH: | |
| 28 return views::kMinimumButtonWidth; | |
|
sky
2017/02/24 04:15:43
Rather than exposing the constant in views could t
Peter Kasting
2017/02/24 06:32:31
I don't think we should do that in this patch set,
| |
| 27 case Metric::DIALOG_BUTTON_MARGIN: | 29 case Metric::DIALOG_BUTTON_MARGIN: |
| 28 return views::kButtonHEdgeMarginNew; | 30 return views::kButtonHEdgeMarginNew; |
| 29 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: | 31 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: |
| 30 return views::kDialogMinimumButtonWidth; | 32 return views::kDialogMinimumButtonWidth; |
| 31 case Metric::DIALOG_BUTTON_TOP_SPACING: | 33 case Metric::DIALOG_BUTTON_TOP_SPACING: |
| 32 return 0; | 34 return 0; |
| 33 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: | 35 case Metric::DIALOG_CLOSE_BUTTON_MARGIN: |
| 34 return views::kCloseButtonMargin; | 36 return views::kCloseButtonMargin; |
| 35 case Metric::PANEL_CONTENT_MARGIN: | 37 case Metric::PANEL_CONTENT_MARGIN: |
| 36 return views::kPanelHorizMargin; | 38 return views::kPanelHorizMargin; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 66 return true; | 68 return true; |
| 67 } | 69 } |
| 68 | 70 |
| 69 bool LayoutDelegate::IsHarmonyMode() const { | 71 bool LayoutDelegate::IsHarmonyMode() const { |
| 70 return false; | 72 return false; |
| 71 } | 73 } |
| 72 | 74 |
| 73 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { | 75 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { |
| 74 return 0; | 76 return 0; |
| 75 } | 77 } |
| OLD | NEW |