| 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/chrome_layout_provider.h" | 5 #include "chrome/browser/ui/views/harmony/chrome_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 "chrome/browser/ui/views/harmony/chrome_typography.h" | 9 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 10 #include "chrome/browser/ui/views/harmony/harmony_layout_provider.h" | 10 #include "chrome/browser/ui/views/harmony/harmony_layout_provider.h" |
| 11 #include "ui/base/material_design/material_design_controller.h" | 11 #include "ui/base/material_design/material_design_controller.h" |
| 12 #include "ui/views/layout/layout_constants.h" | 12 #include "ui/views/layout/layout_constants.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 ChromeLayoutProvider* ChromeLayoutProvider::Get() { | 15 ChromeLayoutProvider* ChromeLayoutProvider::Get() { |
| 16 return static_cast<ChromeLayoutProvider*>(views::LayoutProvider::Get()); | 16 return static_cast<ChromeLayoutProvider*>(views::LayoutProvider::Get()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 std::unique_ptr<views::LayoutProvider> | 20 std::unique_ptr<views::LayoutProvider> |
| 21 ChromeLayoutProvider::CreateLayoutProvider() { | 21 ChromeLayoutProvider::CreateLayoutProvider() { |
| 22 return ui::MaterialDesignController::IsSecondaryUiMaterial() | 22 return ui::MaterialDesignController::IsSecondaryUiMaterial() |
| 23 ? base::MakeUnique<HarmonyLayoutProvider>() | 23 ? base::MakeUnique<HarmonyLayoutProvider>() |
| 24 : base::MakeUnique<ChromeLayoutProvider>(); | 24 : base::MakeUnique<ChromeLayoutProvider>(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 int ChromeLayoutProvider::GetDistanceMetric(int metric) const { | 27 int ChromeLayoutProvider::GetDistanceMetric(int metric) const { |
| 28 switch (metric) { | 28 switch (metric) { |
| 29 case DISTANCE_BUTTON_MAX_LINKABLE_WIDTH: | |
| 30 return 0; | |
| 31 case DISTANCE_BUTTON_MINIMUM_WIDTH: | 29 case DISTANCE_BUTTON_MINIMUM_WIDTH: |
| 32 return views::kMinimumButtonWidth; | 30 return views::kMinimumButtonWidth; |
| 33 case DISTANCE_CONTROL_LIST_VERTICAL: | 31 case DISTANCE_CONTROL_LIST_VERTICAL: |
| 34 return GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL); | 32 return GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL); |
| 35 case DISTANCE_DIALOG_BUTTON_MARGIN: | 33 case DISTANCE_DIALOG_BUTTON_MARGIN: |
| 36 return views::kButtonHEdgeMarginNew; | 34 return views::kButtonHEdgeMarginNew; |
| 37 case DISTANCE_DIALOG_BUTTON_TOP: | 35 case DISTANCE_DIALOG_BUTTON_TOP: |
| 38 return 0; | 36 return 0; |
| 39 case DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL: | 37 case DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL: |
| 40 return views::kRelatedControlSmallHorizontalSpacing; | 38 return views::kRelatedControlSmallHorizontalSpacing; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return true; | 74 return true; |
| 77 } | 75 } |
| 78 | 76 |
| 79 bool ChromeLayoutProvider::ShouldShowWindowIcon() const { | 77 bool ChromeLayoutProvider::ShouldShowWindowIcon() const { |
| 80 return true; | 78 return true; |
| 81 } | 79 } |
| 82 | 80 |
| 83 bool ChromeLayoutProvider::IsHarmonyMode() const { | 81 bool ChromeLayoutProvider::IsHarmonyMode() const { |
| 84 return false; | 82 return false; |
| 85 } | 83 } |
| OLD | NEW |