| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/themes/theme_properties.h" | 5 #include "chrome/browser/themes/theme_properties.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/themes/browser_theme_pack.h" | 10 #include "chrome/browser/themes/browser_theme_pack.h" |
| 11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 12 #include "ui/base/resource/material_design/material_design_controller.h" |
| 12 #include "ui/resources/grit/ui_resources.h" | 13 #include "ui/resources/grit/ui_resources.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // ---------------------------------------------------------------------------- | 17 // ---------------------------------------------------------------------------- |
| 17 // Defaults for properties which are stored in the browser theme pack. If you | 18 // Defaults for properties which are stored in the browser theme pack. If you |
| 18 // change these defaults, you must increment the version number in | 19 // change these defaults, you must increment the version number in |
| 19 // browser_theme_pack.h | 20 // browser_theme_pack.h |
| 20 | 21 |
| 21 // Default colors. | 22 // Default colors. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #if defined(OS_MACOSX) | 90 #if defined(OS_MACOSX) |
| 90 const SkColor kDefaultColorToolbarButtonStroke = SkColorSetARGB(75, 81, 81, 81); | 91 const SkColor kDefaultColorToolbarButtonStroke = SkColorSetARGB(75, 81, 81, 81); |
| 91 const SkColor kDefaultColorToolbarButtonStrokeInactive = | 92 const SkColor kDefaultColorToolbarButtonStrokeInactive = |
| 92 SkColorSetARGB(75, 99, 99, 99); | 93 SkColorSetARGB(75, 99, 99, 99); |
| 93 const SkColor kDefaultColorToolbarBezel = SkColorSetRGB(204, 204, 204); | 94 const SkColor kDefaultColorToolbarBezel = SkColorSetRGB(204, 204, 204); |
| 94 const SkColor kDefaultColorToolbarStroke = SkColorSetRGB(103, 103, 103); | 95 const SkColor kDefaultColorToolbarStroke = SkColorSetRGB(103, 103, 103); |
| 95 const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163); | 96 const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163); |
| 96 #endif | 97 #endif |
| 97 | 98 |
| 98 // ---------------------------------------------------------------------------- | 99 // ---------------------------------------------------------------------------- |
| 100 // Defaults for layout properties which are not stored in the browser theme |
| 101 // pack. The array indices here are the values of |
| 102 // ui::MaterialDesignController::Mode, see |
| 103 // ui/base/resource/material_design/material_design_controller.h |
| 104 |
| 105 // The edge graphics have some built-in spacing/shadowing, so we have to adjust |
| 106 // our spacing to make it match. |
| 107 const int kToolbarViewLeftEdgeSpacing[] = {3, 4, 8}; |
| 108 const int kToolbarViewRightEdgeSpacing[] = {2, 4, 8}; |
| 109 |
| 110 // Ash doesn't use a rounded content area and its top edge has an extra shadow. |
| 111 const int kToolbarViewContentShadowHeightAsh[] = {2, 0, 0}; |
| 112 |
| 113 // Non-ash uses a rounded content area with no shadow in the assets. |
| 114 const int kToolbarViewContentShadowHeight[] = {0, 0, 0}; |
| 115 |
| 116 // ---------------------------------------------------------------------------- |
| 99 | 117 |
| 100 // Strings used in alignment properties. | 118 // Strings used in alignment properties. |
| 101 const char kAlignmentCenter[] = "center"; | 119 const char kAlignmentCenter[] = "center"; |
| 102 const char kAlignmentTop[] = "top"; | 120 const char kAlignmentTop[] = "top"; |
| 103 const char kAlignmentBottom[] = "bottom"; | 121 const char kAlignmentBottom[] = "bottom"; |
| 104 const char kAlignmentLeft[] = "left"; | 122 const char kAlignmentLeft[] = "left"; |
| 105 const char kAlignmentRight[] = "right"; | 123 const char kAlignmentRight[] = "right"; |
| 106 | 124 |
| 107 // Strings used in background tiling repetition properties. | 125 // Strings used in background tiling repetition properties. |
| 108 const char kTilingNoRepeat[] = "no-repeat"; | 126 const char kTilingNoRepeat[] = "no-repeat"; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 return kDefaultColorToolbarStrokeInactive; | 310 return kDefaultColorToolbarStrokeInactive; |
| 293 #endif | 311 #endif |
| 294 default: | 312 default: |
| 295 // Return a debugging red color. | 313 // Return a debugging red color. |
| 296 return SK_ColorRED; | 314 return SK_ColorRED; |
| 297 } | 315 } |
| 298 } | 316 } |
| 299 | 317 |
| 300 // static | 318 // static |
| 301 int ThemeProperties::GetDefaultDisplayProperty(int id) { | 319 int ThemeProperties::GetDefaultDisplayProperty(int id) { |
| 320 int mode = ui::MaterialDesignController::GetMode(); |
| 302 switch (id) { | 321 switch (id) { |
| 303 case NTP_BACKGROUND_ALIGNMENT: | 322 case ThemeProperties::NTP_BACKGROUND_ALIGNMENT: |
| 304 return kDefaultDisplayPropertyNTPAlignment; | 323 return kDefaultDisplayPropertyNTPAlignment; |
| 305 case NTP_BACKGROUND_TILING: | 324 case ThemeProperties::NTP_BACKGROUND_TILING: |
| 306 return kDefaultDisplayPropertyNTPTiling; | 325 return kDefaultDisplayPropertyNTPTiling; |
| 307 case NTP_LOGO_ALTERNATE: | 326 case ThemeProperties::NTP_LOGO_ALTERNATE: |
| 308 return kDefaultDisplayPropertyNTPAlternateLogo; | 327 return kDefaultDisplayPropertyNTPAlternateLogo; |
| 328 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING: |
| 329 return kToolbarViewLeftEdgeSpacing[mode]; |
| 330 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING: |
| 331 return kToolbarViewRightEdgeSpacing[mode]; |
| 332 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH: |
| 333 return kToolbarViewContentShadowHeightAsh[mode]; |
| 334 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT: |
| 335 return kToolbarViewContentShadowHeight[mode]; |
| 336 default: |
| 337 return -1; |
| 309 } | 338 } |
| 310 | |
| 311 return -1; | |
| 312 } | 339 } |
| OLD | NEW |