diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 23:07:27 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 23:07:27 +0000 |
commit | f9bcd26a1e7bbe4d4f4bbbc72ba40e59d3be1fbb (patch) | |
tree | fe11fc468f46bd093b0f40eb8db3f396cb468f74 | |
parent | 447baadf9dd279ae3dfb226ba34c75c48f3da930 (diff) | |
download | chromium_src-f9bcd26a1e7bbe4d4f4bbbc72ba40e59d3be1fbb.zip chromium_src-f9bcd26a1e7bbe4d4f4bbbc72ba40e59d3be1fbb.tar.gz chromium_src-f9bcd26a1e7bbe4d4f4bbbc72ba40e59d3be1fbb.tar.bz2 |
If a preferences file references a theme which is from an old version, or whose images have failed to process correctly, drop back to the default theme.
BUG= http://crbug.com/20263
TEST= Use a preferences file from an older version of Chrome that has a theme installed, and open Chrome. Observe that Chrome opens using the default theme.
Review URL: http://codereview.chromium.org/175013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24830 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index ec4054b..8ff934f 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -1130,9 +1130,7 @@ void BrowserThemeProvider::NotifyThemeChanged() { } void BrowserThemeProvider::LoadThemePrefs() { - // Images were already processed when theme was set. process_images_ = false; - PrefService* prefs = profile_->GetPrefs(); // TODO(glen): Figure out if any custom prefs were loaded, and if so @@ -1148,9 +1146,27 @@ void BrowserThemeProvider::LoadThemePrefs() { SetTintData(prefs->GetMutableDictionary(prefs::kCurrentThemeTints)); SetDisplayPropertyData( prefs->GetMutableDictionary(prefs::kCurrentThemeDisplayProperties)); + + // If we're not loading the frame from the cached image dir, we are using + // an old preferences file, or the processed images were not saved + // correctly. Force image reprocessing and caching. + if (images_.count(IDR_THEME_FRAME) > 0) { +#if defined(OS_WIN) + FilePath cache_path = FilePath(UTF8ToWide(images_[IDR_THEME_FRAME])); +#else + FilePath cache_path = FilePath(images_[IDR_THEME_FRAME]); +#endif + process_images_ = !file_util::ContainsPath(image_dir_, cache_path); + } + GenerateFrameColors(); GenerateFrameImages(); GenerateTabImages(); + if (process_images_) { + WriteImagesToDisk(); + UserMetrics::RecordAction(L"Migrated noncached to cached theme.", + profile_); + } UserMetrics::RecordAction(L"Themes_loaded", profile_); } } |