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

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

Issue 542833002: Fix themes on retina Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2c9530241ab8eb61d9e4765249908444cb478df6..7787fc0d290a4dd38c82e40f8c2a615a70613dd2 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -43,7 +43,7 @@ namespace {
// Version number of the current theme pack. We just throw out and rebuild
// theme packs that aren't int-equal to this. Increment this number if you
// change default theme assets.
-const int kThemePackVersion = 34;
+const int kThemePackVersion = 35;
// IDs that are in the DataPack won't clash with the positive integer
// uint16. kHeaderID should always have the maximum value because we want the
@@ -238,6 +238,24 @@ int GetPersistentIDByIDR(int idr) {
return (it == lookup_table->end()) ? -1 : it->second;
}
+// Returns the maximum persistent id.
+int GetMaxPersistentId() {
+ static int max_prs_id = -1;
+ if (max_prs_id == -1) {
+ for (size_t i = 0; i < kPersistingImagesLength; ++i) {
+ if (kPersistingImages[i].persistent_id > max_prs_id)
+ max_prs_id = kPersistingImages[i].persistent_id;
+ }
+#if defined(USE_ASH) && !defined(OS_CHROMEOS)
+ for (size_t i = 0; i < kPersistingImagesDesktopAuraLength; ++i) {
+ if (kPersistingImagesDesktopAura[i].persistent_id > max_prs_id)
+ max_prs_id = kPersistingImagesDesktopAura[i].persistent_id;
+ }
+#endif
+ }
+ return max_prs_id;
+}
+
// Returns true if the scales in |input| match those in |expected|.
// The order must match as the index is used in determining the raw id.
bool InputScalesValid(const base::StringPiece& input,
@@ -1526,7 +1544,7 @@ int BrowserThemePack::GetRawIDByPersistentID(
for (size_t i = 0; i < scale_factors_.size(); ++i) {
if (scale_factors_[i] == scale_factor)
- return static_cast<int>(kPersistingImagesLength * i) + prs_id;
+ return ((GetMaxPersistentId() + 1) * i) + prs_id;
}
return -1;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698