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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_THEMES_THEME_PROPERTIES_H_
6 #define CHROME_BROWSER_THEMES_THEME_PROPERTIES_H_
11 #include "base/basictypes.h"
12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/gfx/color_utils.h"
15 // Static only class for querying which properties / images are themeable and
16 // the defaults of these properties.
17 // All methods are thread safe unless indicated otherwise.
18 class ThemeProperties
{
20 // ---------------------------------------------------------------------------
21 // The int values of OverwritableByUserThemeProperties, Alignment, and Tiling
22 // are used as a key to store the property in the browser theme pack. If you
23 // modify any of these enums, increment the version number in
24 // browser_theme_pack.h
26 enum OverwritableByUserThemeProperty
{
29 COLOR_FRAME_INCOGNITO
,
30 COLOR_FRAME_INCOGNITO_INACTIVE
,
33 COLOR_BACKGROUND_TAB_TEXT
,
38 COLOR_NTP_LINK_UNDERLINE
,
41 COLOR_NTP_SECTION_TEXT
,
42 COLOR_NTP_SECTION_LINK
,
43 COLOR_NTP_SECTION_LINK_UNDERLINE
,
44 COLOR_BUTTON_BACKGROUND
,
50 TINT_FRAME_INCOGNITO_INACTIVE
,
53 NTP_BACKGROUND_ALIGNMENT
,
54 NTP_BACKGROUND_TILING
,
58 // A bitfield mask for alignments.
64 ALIGN_BOTTOM
= 1 << 3,
67 // Background tiling choices.
75 // --------------------------------------------------------------------------
76 // The int value of the properties in NotOverwritableByUserThemeProperties
77 // has no special meaning. Modify the enum to your heart's content.
78 // The enum takes on values >= 1000 as not to overlap with
79 // OverwritableByUserThemeProperties.
80 enum NotOverwritableByUserThemeProperty
{
81 COLOR_CONTROL_BACKGROUND
= 1000,
82 COLOR_TOOLBAR_SEPARATOR
,
84 // These colors don't have constant default values. They are derived from
85 // the runtime value of other colors.
86 COLOR_NTP_SECTION_HEADER_TEXT
,
87 COLOR_NTP_SECTION_HEADER_TEXT_HOVER
,
88 COLOR_NTP_SECTION_HEADER_RULE
,
89 COLOR_NTP_SECTION_HEADER_RULE_LIGHT
,
91 // Color for any icon on the tabstrip (e.g. media indicator).
93 COLOR_THROBBER_SPINNING
,
94 COLOR_THROBBER_WAITING
,
95 #if defined(ENABLE_SUPERVISED_USERS)
96 COLOR_SUPERVISED_USER_LABEL
,
97 COLOR_SUPERVISED_USER_LABEL_BACKGROUND
,
98 COLOR_SUPERVISED_USER_LABEL_BORDER
,
101 COLOR_STATUS_BAR_TEXT
,
103 #if defined(OS_MACOSX)
105 COLOR_TOOLBAR_STROKE
,
106 COLOR_TOOLBAR_STROKE_INACTIVE
,
107 COLOR_TOOLBAR_BUTTON_STROKE
,
108 COLOR_TOOLBAR_BUTTON_STROKE_INACTIVE
,
109 GRADIENT_FRAME_INCOGNITO
,
110 GRADIENT_FRAME_INCOGNITO_INACTIVE
,
112 GRADIENT_TOOLBAR_INACTIVE
,
113 GRADIENT_TOOLBAR_BUTTON
,
114 GRADIENT_TOOLBAR_BUTTON_INACTIVE
,
115 GRADIENT_TOOLBAR_BUTTON_PRESSED
,
116 GRADIENT_TOOLBAR_BUTTON_PRESSED_INACTIVE
,
119 // TODO(jonross): Upon the completion of Material Design work, evaluate
120 // which of these properties can be moved out of ThemeProperties.
122 // Layout Properties for the Toolbar
123 PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING
,
124 PROPERTY_LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING
,
125 PROPERTY_LOCATION_BAR_BUBBLE_VERTICAL_PADDING
,
126 PROPERTY_LOCATION_BAR_HEIGHT
,
127 PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING
,
128 PROPERTY_LOCATION_BAR_VERTICAL_PADDING
,
129 PROPERTY_OMNIBOX_DROPDOWN_BORDER_INTERIOR
,
130 PROPERTY_OMNIBOX_DROPDOWN_MIN_ICON_VERTICAL_PADDING
,
131 PROPERTY_OMNIBOX_DROPDOWN_MIN_TEXT_VERTICAL_PADDING
,
132 PROPERTY_TOOLBAR_BUTTON_BORDER_INSET
,
133 PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT
,
134 PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH
,
135 PROPERTY_TOOLBAR_VIEW_ELEMENT_PADDING
,
136 PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING
,
137 PROPERTY_TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING
,
138 PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING
,
139 PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING
,
140 PROPERTY_TOOLBAR_VIEW_VERTICAL_PADDING
,
143 // Used by the browser theme pack to parse alignments from something like
144 // "top left" into a bitmask of Alignment.
145 static int StringToAlignment(const std::string
& alignment
);
147 // Used by the browser theme pack to parse alignments from something like
148 // "no-repeat" into a Tiling value.
149 static int StringToTiling(const std::string
& tiling
);
151 // Converts a bitmask of Alignment into a string like "top left". The result
152 // is used to generate a CSS value.
153 static std::string
AlignmentToString(int alignment
);
155 // Converts a Tiling into a string like "no-repeat". The result is used to
156 // generate a CSS value.
157 static std::string
TilingToString(int tiling
);
159 // Returns the set of IDR_* resources that should be tinted.
160 // This method is not thread safe.
161 static const std::set
<int>& GetTintableToolbarButtons();
163 // Returns the default tint for the given tint |id| TINT_* enum value.
164 // Returns an HSL value of {-1, -1, -1} if |id| is invalid.
165 static color_utils::HSL
GetDefaultTint(int id
);
167 // Returns the default color for the given color |id| COLOR_* enum value.
168 // Returns SK_ColorRED if |id| is invalid.
169 static SkColor
GetDefaultColor(int id
);
171 // Returns the default value for the given property |id|. Returns -1 if |id|
173 static int GetDefaultDisplayProperty(int id
);
176 DISALLOW_IMPLICIT_CONSTRUCTORS(ThemeProperties
);
179 #endif // CHROME_BROWSER_THEMES_THEME_PROPERTIES_H_