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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } // namespace | 138 } // namespace |
139 | 139 |
140 // static | 140 // static |
141 int ThemeProperties::StringToAlignment(const std::string& alignment) { | 141 int ThemeProperties::StringToAlignment(const std::string& alignment) { |
142 std::vector<std::string> split; | 142 std::vector<std::string> split; |
143 base::SplitStringAlongWhitespace(alignment, &split); | 143 base::SplitStringAlongWhitespace(alignment, &split); |
144 | 144 |
145 int alignment_mask = 0; | 145 int alignment_mask = 0; |
146 for (std::vector<std::string>::iterator component(split.begin()); | 146 for (std::vector<std::string>::iterator component(split.begin()); |
147 component != split.end(); ++component) { | 147 component != split.end(); ++component) { |
148 if (LowerCaseEqualsASCII(*component, kAlignmentTop)) | 148 if (base::LowerCaseEqualsASCII(*component, kAlignmentTop)) |
149 alignment_mask |= ALIGN_TOP; | 149 alignment_mask |= ALIGN_TOP; |
150 else if (LowerCaseEqualsASCII(*component, kAlignmentBottom)) | 150 else if (base::LowerCaseEqualsASCII(*component, kAlignmentBottom)) |
151 alignment_mask |= ALIGN_BOTTOM; | 151 alignment_mask |= ALIGN_BOTTOM; |
152 else if (LowerCaseEqualsASCII(*component, kAlignmentLeft)) | 152 else if (base::LowerCaseEqualsASCII(*component, kAlignmentLeft)) |
153 alignment_mask |= ALIGN_LEFT; | 153 alignment_mask |= ALIGN_LEFT; |
154 else if (LowerCaseEqualsASCII(*component, kAlignmentRight)) | 154 else if (base::LowerCaseEqualsASCII(*component, kAlignmentRight)) |
155 alignment_mask |= ALIGN_RIGHT; | 155 alignment_mask |= ALIGN_RIGHT; |
156 } | 156 } |
157 return alignment_mask; | 157 return alignment_mask; |
158 } | 158 } |
159 | 159 |
160 // static | 160 // static |
161 int ThemeProperties::StringToTiling(const std::string& tiling) { | 161 int ThemeProperties::StringToTiling(const std::string& tiling) { |
162 if (LowerCaseEqualsASCII(tiling, kTilingRepeatX)) | 162 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatX)) |
163 return REPEAT_X; | 163 return REPEAT_X; |
164 if (LowerCaseEqualsASCII(tiling, kTilingRepeatY)) | 164 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeatY)) |
165 return REPEAT_Y; | 165 return REPEAT_Y; |
166 if (LowerCaseEqualsASCII(tiling, kTilingRepeat)) | 166 if (base::LowerCaseEqualsASCII(tiling, kTilingRepeat)) |
167 return REPEAT; | 167 return REPEAT; |
168 // NO_REPEAT is the default choice. | 168 // NO_REPEAT is the default choice. |
169 return NO_REPEAT; | 169 return NO_REPEAT; |
170 } | 170 } |
171 | 171 |
172 // static | 172 // static |
173 std::string ThemeProperties::AlignmentToString(int alignment) { | 173 std::string ThemeProperties::AlignmentToString(int alignment) { |
174 // Convert from an AlignmentProperty back into a string. | 174 // Convert from an AlignmentProperty back into a string. |
175 std::string vertical_string(kAlignmentCenter); | 175 std::string vertical_string(kAlignmentCenter); |
176 std::string horizontal_string(kAlignmentCenter); | 176 std::string horizontal_string(kAlignmentCenter); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 case NTP_BACKGROUND_ALIGNMENT: | 303 case NTP_BACKGROUND_ALIGNMENT: |
304 return kDefaultDisplayPropertyNTPAlignment; | 304 return kDefaultDisplayPropertyNTPAlignment; |
305 case NTP_BACKGROUND_TILING: | 305 case NTP_BACKGROUND_TILING: |
306 return kDefaultDisplayPropertyNTPTiling; | 306 return kDefaultDisplayPropertyNTPTiling; |
307 case NTP_LOGO_ALTERNATE: | 307 case NTP_LOGO_ALTERNATE: |
308 return kDefaultDisplayPropertyNTPAlternateLogo; | 308 return kDefaultDisplayPropertyNTPAlternateLogo; |
309 } | 309 } |
310 | 310 |
311 return -1; | 311 return -1; |
312 } | 312 } |
OLD | NEW |