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

Unified Diff: chrome/browser/extensions/extension_install_ui.cc

Issue 164312: Make the theme install infobar have an 'undo' button instead of (Closed)
Patch Set: Created 11 years, 4 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/extensions/extension_install_ui.cc
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index cfc5e547ffa0b86c093d1f01291d06c4c6be59f4..a2c9258af096e854035b13594eb0ff42d76c5fd2 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -37,6 +37,11 @@ void ExtensionInstallUI::ConfirmInstall(CrxInstaller* installer,
// immediately installed, and then we show an infobar (see OnInstallSuccess)
// to allow the user to revert if they don't like it.
if (extension->IsTheme()) {
+ // Remember the current theme in case the user pressed undo.
+ Extension* previous_theme = profile_->GetTheme();
+ if (previous_theme)
+ previous_theme_id_ = previous_theme->id();
+
installer->ContinueInstall();
return;
}
@@ -100,8 +105,8 @@ void ExtensionInstallUI::OnOverinstallAttempted(Extension* extension) {
ShowThemeInfoBar(extension);
}
-void ExtensionInstallUI::ShowThemeInfoBar(Extension* extension) {
- if (!extension->IsTheme())
+void ExtensionInstallUI::ShowThemeInfoBar(Extension* new_theme) {
+ if (!new_theme->IsTheme())
return;
Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
@@ -124,7 +129,7 @@ void ExtensionInstallUI::ShowThemeInfoBar(Extension* extension) {
// Then either replace that old one or add a new one.
InfoBarDelegate* new_delegate = new ThemePreviewInfobarDelegate(tab_contents,
- extension->name());
+ new_theme->name(), previous_theme_id_);
if (old_delegate)
tab_contents->ReplaceInfoBar(old_delegate, new_delegate);

Powered by Google App Engine
This is Rietveld 408576698