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

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

Issue 165373: Merge 23055 - Make the theme install infobar have an 'undo' button instead... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
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
« no previous file with comments | « chrome/browser/extensions/theme_preview_infobar_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/theme_preview_infobar_delegate.cc
===================================================================
--- chrome/browser/extensions/theme_preview_infobar_delegate.cc (revision 23160)
+++ chrome/browser/extensions/theme_preview_infobar_delegate.cc (working copy)
@@ -6,14 +6,18 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
+#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/extensions/extension.h"
#include "grit/generated_resources.h"
ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate(
- TabContents* tab_contents, const std::string& name)
+ TabContents* tab_contents, const std::string& name,
+ const std::string& previous_theme_id)
: ConfirmInfoBarDelegate(tab_contents),
- profile_(tab_contents->profile()), name_(name) {
+ profile_(tab_contents->profile()), name_(name),
+ previous_theme_id_(previous_theme_id) {
}
void ThemePreviewInfobarDelegate::InfoBarClosed() {
@@ -44,20 +48,27 @@
ConfirmInfoBarDelegate::InfoBarButton button) const {
switch (button) {
case BUTTON_CANCEL:
- return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON);
+ // TODO(aa): Reusing IDS_UNDO is hack to get around string freeze. This
+ // should be changed back to IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON at some
+ // point.
+ return l10n_util::GetString(IDS_UNDO);
default:
return L"";
}
}
bool ThemePreviewInfobarDelegate::Cancel() {
- // Blech, this is a total hack.
- //
- // a) We should be uninstalling via ExtensionsService, not
- // Profile::ClearTheme().
- // b) We should be able to view the theme without installing it. This would
- // help in edge cases like the user closing the window or tab before making
- // a decision.
+ if (!previous_theme_id_.empty()) {
+ ExtensionsService* service = profile_->GetExtensionsService();
+ if (service) {
+ Extension* previous_theme = service->GetExtensionById(previous_theme_id_);
+ if (previous_theme) {
+ profile_->SetTheme(previous_theme);
+ return true;
+ }
+ }
+ }
+
profile_->ClearTheme();
return true;
}
Property changes on: chrome\browser\extensions\theme_preview_infobar_delegate.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/extensions/theme_preview_infobar_delegate.cc:r23055
« no previous file with comments | « chrome/browser/extensions/theme_preview_infobar_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698