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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/theme_preview_infobar_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/extensions/theme_preview_infobar_delegate.cc:r23055
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/theme_preview_infobar_delegate.h" 5 #include "chrome/browser/extensions/theme_preview_infobar_delegate.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/extensions/extensions_service.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 11 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/common/extensions/extension.h"
11 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
12 14
13 ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate( 15 ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate(
14 TabContents* tab_contents, const std::string& name) 16 TabContents* tab_contents, const std::string& name,
17 const std::string& previous_theme_id)
15 : ConfirmInfoBarDelegate(tab_contents), 18 : ConfirmInfoBarDelegate(tab_contents),
16 profile_(tab_contents->profile()), name_(name) { 19 profile_(tab_contents->profile()), name_(name),
20 previous_theme_id_(previous_theme_id) {
17 } 21 }
18 22
19 void ThemePreviewInfobarDelegate::InfoBarClosed() { 23 void ThemePreviewInfobarDelegate::InfoBarClosed() {
20 delete this; 24 delete this;
21 } 25 }
22 26
23 std::wstring ThemePreviewInfobarDelegate::GetMessageText() const { 27 std::wstring ThemePreviewInfobarDelegate::GetMessageText() const {
24 return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, 28 return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL,
25 UTF8ToWide(name_)); 29 UTF8ToWide(name_));
26 } 30 }
(...skipping 10 matching lines...) Expand all
37 } 41 }
38 42
39 int ThemePreviewInfobarDelegate::GetButtons() const { 43 int ThemePreviewInfobarDelegate::GetButtons() const {
40 return BUTTON_CANCEL; 44 return BUTTON_CANCEL;
41 } 45 }
42 46
43 std::wstring ThemePreviewInfobarDelegate::GetButtonLabel( 47 std::wstring ThemePreviewInfobarDelegate::GetButtonLabel(
44 ConfirmInfoBarDelegate::InfoBarButton button) const { 48 ConfirmInfoBarDelegate::InfoBarButton button) const {
45 switch (button) { 49 switch (button) {
46 case BUTTON_CANCEL: 50 case BUTTON_CANCEL:
47 return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); 51 // TODO(aa): Reusing IDS_UNDO is hack to get around string freeze. This
52 // should be changed back to IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON at some
53 // point.
54 return l10n_util::GetString(IDS_UNDO);
48 default: 55 default:
49 return L""; 56 return L"";
50 } 57 }
51 } 58 }
52 59
53 bool ThemePreviewInfobarDelegate::Cancel() { 60 bool ThemePreviewInfobarDelegate::Cancel() {
54 // Blech, this is a total hack. 61 if (!previous_theme_id_.empty()) {
55 // 62 ExtensionsService* service = profile_->GetExtensionsService();
56 // a) We should be uninstalling via ExtensionsService, not 63 if (service) {
57 // Profile::ClearTheme(). 64 Extension* previous_theme = service->GetExtensionById(previous_theme_id_);
58 // b) We should be able to view the theme without installing it. This would 65 if (previous_theme) {
59 // help in edge cases like the user closing the window or tab before making 66 profile_->SetTheme(previous_theme);
60 // a decision. 67 return true;
68 }
69 }
70 }
71
61 profile_->ClearTheme(); 72 profile_->ClearTheme();
62 return true; 73 return true;
63 } 74 }
OLDNEW
« 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