Chromium Code Reviews| Index: chrome/browser/themes/theme_properties.cc |
| diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc |
| index f32530f28d53452f5f7b5f88a0fd00753d329b2b..89f7171023f3818bbe459ef438b39706453601aa 100644 |
| --- a/chrome/browser/themes/theme_properties.cc |
| +++ b/chrome/browser/themes/theme_properties.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/strings/string_util.h" |
| #include "chrome/browser/themes/browser_theme_pack.h" |
| #include "grit/theme_resources.h" |
| +#include "ui/base/resource/material_design/material_design_controller.h" |
| #include "ui/resources/grit/ui_resources.h" |
| namespace { |
| @@ -96,6 +97,32 @@ const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163); |
| #endif |
| // ---------------------------------------------------------------------------- |
| +// Defaults for layout properties which are not stored in the browser theme |
| +// pack. The array indices here are the values of |
| +// ui::MaterialDesignController::Mode, see |
| +// ui/base/resource/material_design/material_design_controller.h |
| +COMPILE_ASSERT( |
|
Peter Kasting
2015/07/08 21:18:42
I think these compile asserts are more big and ugl
jonross
2015/07/08 22:30:43
Done.
|
| + static_cast<int>(ui::MaterialDesignController::Mode::NON_MATERIAL) == 0, |
| + material_design_mode_order_changed); |
| +COMPILE_ASSERT(static_cast<int>(ui::MaterialDesignController::Mode::MATERIAL) == |
| + 1, |
| + material_design_mode_order_changed); |
| +COMPILE_ASSERT( |
| + static_cast<int>(ui::MaterialDesignController::Mode::MATERIAL_HYBRID) == 2, |
| + material_design_mode_order_changed); |
| + |
| +// The edge graphics have some built-in spacing/shadowing, so we have to adjust |
| +// our spacing to make it match. |
| +const int kToolbarViewLeftEdgeSpacing[] = {3, 4, 8}; |
| +const int kToolbarViewRightEdgeSpacing[] = {2, 4, 8}; |
| + |
| +// Ash doesn't use a rounded content area and its top edge has an extra shadow. |
| +const int kToolbarViewContentShadowHeightAsh[] = {2, 0, 0}; |
| + |
| +// Non-ash uses a rounded content area with no shadow in the assets. |
| +const int kToolbarViewContentShadowHeight[] = {0, 0, 0}; |
| + |
| +// ---------------------------------------------------------------------------- |
| // Strings used in alignment properties. |
| const char kAlignmentCenter[] = "center"; |
| @@ -299,14 +326,23 @@ SkColor ThemeProperties::GetDefaultColor(int id) { |
| // static |
| int ThemeProperties::GetDefaultDisplayProperty(int id) { |
| + int mode = static_cast<int>(ui::MaterialDesignController::GetMode()); |
| switch (id) { |
| - case NTP_BACKGROUND_ALIGNMENT: |
| + case ThemeProperties::NTP_BACKGROUND_ALIGNMENT: |
| return kDefaultDisplayPropertyNTPAlignment; |
| - case NTP_BACKGROUND_TILING: |
| + case ThemeProperties::NTP_BACKGROUND_TILING: |
| return kDefaultDisplayPropertyNTPTiling; |
| - case NTP_LOGO_ALTERNATE: |
| + case ThemeProperties::NTP_LOGO_ALTERNATE: |
| return kDefaultDisplayPropertyNTPAlternateLogo; |
| + case ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING: |
| + return kToolbarViewLeftEdgeSpacing[mode]; |
| + case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING: |
| + return kToolbarViewRightEdgeSpacing[mode]; |
| + case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH: |
| + return kToolbarViewContentShadowHeightAsh[mode]; |
| + case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT: |
| + return kToolbarViewContentShadowHeight[mode]; |
| + default: |
| + return -1; |
| } |
| - |
| - return -1; |
| } |