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" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 }; | 170 }; |
171 | 171 |
172 SkColor TintForUnderline(SkColor input) { | 172 SkColor TintForUnderline(SkColor input) { |
173 return SkColorSetA(input, SkColorGetA(input) / 3); | 173 return SkColorSetA(input, SkColorGetA(input) / 3); |
174 } | 174 } |
175 | 175 |
176 } // namespace | 176 } // namespace |
177 | 177 |
178 // static | 178 // static |
179 int ThemeProperties::StringToAlignment(const std::string& alignment) { | 179 int ThemeProperties::StringToAlignment(const std::string& alignment) { |
180 std::vector<std::string> split; | |
181 base::SplitStringAlongWhitespace(alignment, &split); | |
182 | |
183 int alignment_mask = 0; | 180 int alignment_mask = 0; |
184 for (std::vector<std::string>::iterator component(split.begin()); | 181 for (const std::string& component : base::SplitString( |
185 component != split.end(); ++component) { | 182 alignment, base::kWhitespaceASCII, |
186 if (base::LowerCaseEqualsASCII(*component, kAlignmentTop)) | 183 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) { |
| 184 if (base::LowerCaseEqualsASCII(component, kAlignmentTop)) |
187 alignment_mask |= ALIGN_TOP; | 185 alignment_mask |= ALIGN_TOP; |
188 else if (base::LowerCaseEqualsASCII(*component, kAlignmentBottom)) | 186 else if (base::LowerCaseEqualsASCII(component, kAlignmentBottom)) |
189 alignment_mask |= ALIGN_BOTTOM; | 187 alignment_mask |= ALIGN_BOTTOM; |
190 else if (base::LowerCaseEqualsASCII(*component, kAlignmentLeft)) | 188 else if (base::LowerCaseEqualsASCII(component, kAlignmentLeft)) |
191 alignment_mask |= ALIGN_LEFT; | 189 alignment_mask |= ALIGN_LEFT; |
192 else if (base::LowerCaseEqualsASCII(*component, kAlignmentRight)) | 190 else if (base::LowerCaseEqualsASCII(component, kAlignmentRight)) |
193 alignment_mask |= ALIGN_RIGHT; | 191 alignment_mask |= ALIGN_RIGHT; |
194 } | 192 } |
195 return alignment_mask; | 193 return alignment_mask; |
196 } | 194 } |
197 | 195 |
198 // static | 196 // static |
199 int ThemeProperties::StringToTiling(const std::string& tiling) { | 197 int ThemeProperties::StringToTiling(const std::string& tiling) { |
200 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatX)) | 198 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatX)) |
201 return REPEAT_X; | 199 return REPEAT_X; |
202 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatY)) | 200 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatY)) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING: | 360 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING: |
363 return kToolbarViewRightEdgeSpacing[mode]; | 361 return kToolbarViewRightEdgeSpacing[mode]; |
364 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING: | 362 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING: |
365 return kToolbarViewStandardSpacing[mode]; | 363 return kToolbarViewStandardSpacing[mode]; |
366 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_VERTICAL_PADDING: | 364 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_VERTICAL_PADDING: |
367 return kToolbarViewVerticalPadding[mode]; | 365 return kToolbarViewVerticalPadding[mode]; |
368 default: | 366 default: |
369 return -1; | 367 return -1; |
370 } | 368 } |
371 } | 369 } |
OLD | NEW |