Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 8008003: wstring: remove SplitStringAlongWhitespace for wchar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/string_split_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/string_split.h" 7 #include "base/string_split.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 if (vertical_string.empty()) 379 if (vertical_string.empty())
380 return horizontal_string; 380 return horizontal_string;
381 if (horizontal_string.empty()) 381 if (horizontal_string.empty())
382 return vertical_string; 382 return vertical_string;
383 return vertical_string + " " + horizontal_string; 383 return vertical_string + " " + horizontal_string;
384 } 384 }
385 385
386 // static 386 // static
387 int ThemeService::StringToAlignment(const std::string& alignment) { 387 int ThemeService::StringToAlignment(const std::string& alignment) {
388 std::vector<std::wstring> split; 388 std::vector<std::string> split;
389 base::SplitStringAlongWhitespace(UTF8ToWide(alignment), &split); 389 base::SplitStringAlongWhitespace(alignment, &split);
390 390
391 int alignment_mask = 0; 391 int alignment_mask = 0;
392 for (std::vector<std::wstring>::iterator alignments(split.begin()); 392 for (std::vector<std::string>::iterator component(split.begin());
393 alignments != split.end(); ++alignments) { 393 component != split.end(); ++component) {
394 std::string comp = WideToUTF8(*alignments); 394 if (LowerCaseEqualsASCII(*component, kAlignmentTop))
395 const char* component = comp.c_str();
396
397 if (base::strcasecmp(component, kAlignmentTop) == 0)
398 alignment_mask |= ThemeService::ALIGN_TOP; 395 alignment_mask |= ThemeService::ALIGN_TOP;
399 else if (base::strcasecmp(component, kAlignmentBottom) == 0) 396 else if (LowerCaseEqualsASCII(*component, kAlignmentBottom))
400 alignment_mask |= ThemeService::ALIGN_BOTTOM; 397 alignment_mask |= ThemeService::ALIGN_BOTTOM;
401 398 else if (LowerCaseEqualsASCII(*component, kAlignmentLeft) == 0)
402 if (base::strcasecmp(component, kAlignmentLeft) == 0)
403 alignment_mask |= ThemeService::ALIGN_LEFT; 399 alignment_mask |= ThemeService::ALIGN_LEFT;
404 else if (base::strcasecmp(component, kAlignmentRight) == 0) 400 else if (LowerCaseEqualsASCII(*component, kAlignmentRight) == 0)
405 alignment_mask |= ThemeService::ALIGN_RIGHT; 401 alignment_mask |= ThemeService::ALIGN_RIGHT;
406 } 402 }
407 return alignment_mask; 403 return alignment_mask;
408 } 404 }
409 405
410 // static 406 // static
411 std::string ThemeService::TilingToString(int tiling) { 407 std::string ThemeService::TilingToString(int tiling) {
412 // Convert from a TilingProperty back into a string. 408 // Convert from a TilingProperty back into a string.
413 if (tiling == ThemeService::REPEAT_X) 409 if (tiling == ThemeService::REPEAT_X)
414 return kTilingRepeatX; 410 return kTilingRepeatX;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 void ThemeService::OnInfobarDisplayed() { 654 void ThemeService::OnInfobarDisplayed() {
659 number_of_infobars_++; 655 number_of_infobars_++;
660 } 656 }
661 657
662 void ThemeService::OnInfobarDestroyed() { 658 void ThemeService::OnInfobarDestroyed() {
663 number_of_infobars_--; 659 number_of_infobars_--;
664 660
665 if (number_of_infobars_ == 0) 661 if (number_of_infobars_ == 0)
666 RemoveUnusedThemes(); 662 RemoveUnusedThemes();
667 } 663 }
OLDNEW
« no previous file with comments | « base/string_split_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698