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

Unified Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 2667753004: Themes: Remove unused IDs from ThemeProperties (Closed)
Patch Set: Remove COLOR_NTP_SECTION Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/themes/browser_theme_pack.cc
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 1c7d6491dab79b4b76c233057dcecfba89ef83e3..bd97621bb8b85343f3893e9529538768c5417ad5 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -48,7 +48,7 @@ namespace {
// theme packs that aren't int-equal to this. Increment this number if you
// change default theme assets or if you need themes to recreate their generated
// images (which are cached).
-const int kThemePackVersion = 45;
+const int kThemePackVersion = 46;
// IDs that are in the DataPack won't clash with the positive integer
// uint16_t. kHeaderID should always have the maximum value because we want the
@@ -235,13 +235,7 @@ const StringToIntTable kColorTable[] = {
{ "ntp_background", ThemeProperties::COLOR_NTP_BACKGROUND },
{ "ntp_text", ThemeProperties::COLOR_NTP_TEXT },
{ "ntp_link", ThemeProperties::COLOR_NTP_LINK },
- { "ntp_link_underline", ThemeProperties::COLOR_NTP_LINK_UNDERLINE },
{ "ntp_header", ThemeProperties::COLOR_NTP_HEADER },
- { "ntp_section", ThemeProperties::COLOR_NTP_SECTION },
- { "ntp_section_text", ThemeProperties::COLOR_NTP_SECTION_TEXT },
- { "ntp_section_link", ThemeProperties::COLOR_NTP_SECTION_LINK },
- { "ntp_section_link_underline",
- ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE },
{ "button_background", ThemeProperties::COLOR_BUTTON_BACKGROUND },
};
const size_t kColorTableLength = arraysize(kColorTable);
@@ -969,9 +963,15 @@ void BrowserThemePack::ReadColorsFromJSON(
color = SkColorSetRGB(r, g, b);
}
- int id = GetIntForString(iter.key(), kColorTable, kColorTableLength);
- if (id != -1) {
- (*temp_colors)[id] = color;
+ if (iter.key() == "ntp_section") {
+ // Allow ntp_section to provide a fallback value for ntp_header.
Evan Stade 2017/02/01 21:47:23 nit: We no longer use ntp_section, but to support
Tom (Use chromium acct) 2017/02/01 23:09:30 Done.
+ if (!temp_colors->count(ThemeProperties::COLOR_NTP_HEADER))
+ (*temp_colors)[ThemeProperties::COLOR_NTP_HEADER] = color;
+ } else {
+ int id = GetIntForString(iter.key(), kColorTable, kColorTableLength);
+ if (id != -1) {
Evan Stade 2017/02/01 21:47:23 nit: no curlies
Tom (Use chromium acct) 2017/02/01 23:09:30 Done.
+ (*temp_colors)[id] = color;
+ }
}
}
}
@@ -980,28 +980,6 @@ void BrowserThemePack::ReadColorsFromJSON(
void BrowserThemePack::GenerateMissingColors(
std::map<int, SkColor>* colors) {
- // Generate link colors, if missing. (See GetColor()).
- if (!colors->count(ThemeProperties::COLOR_NTP_HEADER) &&
- colors->count(ThemeProperties::COLOR_NTP_SECTION)) {
- (*colors)[ThemeProperties::COLOR_NTP_HEADER] =
- (*colors)[ThemeProperties::COLOR_NTP_SECTION];
- }
-
- if (!colors->count(ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE) &&
- colors->count(ThemeProperties::COLOR_NTP_SECTION_LINK)) {
- SkColor color_section_link =
- (*colors)[ThemeProperties::COLOR_NTP_SECTION_LINK];
- (*colors)[ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE] =
- SkColorSetA(color_section_link, SkColorGetA(color_section_link) / 3);
- }
-
- if (!colors->count(ThemeProperties::COLOR_NTP_LINK_UNDERLINE) &&
- colors->count(ThemeProperties::COLOR_NTP_LINK)) {
- SkColor color_link = (*colors)[ThemeProperties::COLOR_NTP_LINK];
- (*colors)[ThemeProperties::COLOR_NTP_LINK_UNDERLINE] =
- SkColorSetA(color_link, SkColorGetA(color_link) / 3);
- }
-
// Generate frame colors, if missing. (See GenerateFrameColors()).
SkColor frame;
std::map<int, SkColor>::const_iterator it =

Powered by Google App Engine
This is Rietveld 408576698