Skip to content

Commit

Permalink
Cleanup: Replace some base::strcasecmp calls with LowerCaseEqualsASCII.
Browse files Browse the repository at this point in the history
Review URL: https://codereview.chromium.org/841773007

Cr-Commit-Position: refs/heads/master@{#310609}
  • Loading branch information
leizleiz authored and Commit bot committed Jan 8, 2015
1 parent 47be1d7 commit 02f1dba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
9 changes: 4 additions & 5 deletions chrome/browser/themes/browser_theme_pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct PersistingImagesTable {

// String to check for when parsing theme manifests or NULL if this isn't
// supposed to be changeable by the user.
const char* key;
const char* const key;
};

// IDR_* resource names change whenever new resources are added; use persistent
Expand Down Expand Up @@ -204,8 +204,7 @@ int GetPersistentIDByNameHelper(const std::string& key,
const PersistingImagesTable* image_table,
size_t image_table_size) {
for (size_t i = 0; i < image_table_size; ++i) {
if (image_table[i].key != NULL &&
base::strcasecmp(key.c_str(), image_table[i].key) == 0) {
if (image_table[i].key && LowerCaseEqualsASCII(key, image_table[i].key)) {
return image_table[i].persistent_id;
}
}
Expand Down Expand Up @@ -286,7 +285,7 @@ std::string GetScaleFactorsAsString(
}

struct StringToIntTable {
const char* key;
const char* const key;
ThemeProperties::OverwritableByUserThemeProperty id;
};

Expand Down Expand Up @@ -340,7 +339,7 @@ int GetIntForString(const std::string& key,
StringToIntTable* table,
size_t table_length) {
for (size_t i = 0; i < table_length; ++i) {
if (base::strcasecmp(key.c_str(), table[i].key) == 0) {
if (LowerCaseEqualsASCII(key, table[i].key)) {
return table[i].id;
}
}
Expand Down
26 changes: 12 additions & 14 deletions chrome/browser/themes/theme_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163);
// ----------------------------------------------------------------------------

// Strings used in alignment properties.
const char* kAlignmentCenter = "center";
const char* kAlignmentTop = "top";
const char* kAlignmentBottom = "bottom";
const char* kAlignmentLeft = "left";
const char* kAlignmentRight = "right";
const char kAlignmentCenter[] = "center";
const char kAlignmentTop[] = "top";
const char kAlignmentBottom[] = "bottom";
const char kAlignmentLeft[] = "left";
const char kAlignmentRight[] = "right";

// Strings used in background tiling repetition properties.
const char* kTilingNoRepeat = "no-repeat";
const char* kTilingRepeatX = "repeat-x";
const char* kTilingRepeatY = "repeat-y";
const char* kTilingRepeat = "repeat";
const char kTilingNoRepeat[] = "no-repeat";
const char kTilingRepeatX[] = "repeat-x";
const char kTilingRepeatY[] = "repeat-y";
const char kTilingRepeat[] = "repeat";

// The image resources that will be tinted by the 'button' tint value.
// If you change this list, you must increment the version number in
Expand Down Expand Up @@ -157,13 +157,11 @@ int ThemeProperties::StringToAlignment(const std::string& alignment) {

// static
int ThemeProperties::StringToTiling(const std::string& tiling) {
const char* component = tiling.c_str();

if (base::strcasecmp(component, kTilingRepeatX) == 0)
if (LowerCaseEqualsASCII(tiling, kTilingRepeatX))
return REPEAT_X;
if (base::strcasecmp(component, kTilingRepeatY) == 0)
if (LowerCaseEqualsASCII(tiling, kTilingRepeatY))
return REPEAT_Y;
if (base::strcasecmp(component, kTilingRepeat) == 0)
if (LowerCaseEqualsASCII(tiling, kTilingRepeat))
return REPEAT;
// NO_REPEAT is the default choice.
return NO_REPEAT;
Expand Down

0 comments on commit 02f1dba

Please sign in to comment.