summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_theme_provider.h
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 22:52:05 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 22:52:05 +0000
commitd410efc3d8d188b6999222d68fff4f63444219e1 (patch)
treeae7292168ea356547748cb047072749bc614b956 /chrome/browser/browser_theme_provider.h
parente52bc1e0d760a3a4829ab1cf8adfcb5a634c3914 (diff)
downloadchromium_src-d410efc3d8d188b6999222d68fff4f63444219e1.zip
chromium_src-d410efc3d8d188b6999222d68fff4f63444219e1.tar.gz
chromium_src-d410efc3d8d188b6999222d68fff4f63444219e1.tar.bz2
Uninstall themes when all theme infobars are gone; not on each infobar's destruction.
There are multiple problems with the current implementation: - It handles multiple tabs with theme install infobars badly. - It has a subtle race condition where installing a second theme, and then installing the original theme (note: not clicking undo) uninstalled both themes. Instead, only uninstall unused themes when all infobars are closed down. BUG=none TEST=Install theme A. Install theme B. Install theme A. Restart chrome. Theme A should show. TEST=Install theme A in window 1. Install theme B in window 2. Install theme C in window 3. Clicking undo in any of those windows in any order should work. Review URL: http://codereview.chromium.org/504052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.h')
-rw-r--r--chrome/browser/browser_theme_provider.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h
index e6275d6..756e2bc 100644
--- a/chrome/browser/browser_theme_provider.h
+++ b/chrome/browser/browser_theme_provider.h
@@ -129,6 +129,14 @@ class BrowserThemeProvider : public NonThreadSafe,
// locally customized.)
std::string GetThemeID() const;
+ // This class needs to keep track of the number of theme infobars so that we
+ // clean up unused themes.
+ void OnInfobarDisplayed();
+
+ // Decrements the number of theme infobars. If the last infobar has been
+ // destroyed, uninstalls all themes that aren't the currently selected.
+ void OnInfobarDestroyed();
+
// Convert a bitfield alignment into a string like "top left". Public so that
// it can be used to generate CSS values. Takes a bitfield of AlignmentMasks.
static std::string AlignmentToString(int alignment);
@@ -215,6 +223,9 @@ class BrowserThemeProvider : public NonThreadSafe,
scoped_refptr<BrowserThemePack> theme_pack_;
+ // The number of infobars currently displayed.
+ int number_of_infobars_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider);
};