OLD | NEW |
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_installed_infobar_delegate.h" | 5 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/extensions/extensions_service.h" | 10 #include "chrome/browser/extensions/extensions_service.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return BUTTON_CANCEL; | 62 return BUTTON_CANCEL; |
63 } | 63 } |
64 | 64 |
65 std::wstring ThemeInstalledInfoBarDelegate::GetButtonLabel( | 65 std::wstring ThemeInstalledInfoBarDelegate::GetButtonLabel( |
66 ConfirmInfoBarDelegate::InfoBarButton button) const { | 66 ConfirmInfoBarDelegate::InfoBarButton button) const { |
67 switch (button) { | 67 switch (button) { |
68 case BUTTON_CANCEL: { | 68 case BUTTON_CANCEL: { |
69 return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); | 69 return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); |
70 } | 70 } |
71 default: | 71 default: |
72 NOTREACHED(); | 72 // The InfoBar will create a default OK button and make it invisible. |
| 73 // TODO(mirandac): remove the default OK button from ConfirmInfoBar. |
73 return L""; | 74 return L""; |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 bool ThemeInstalledInfoBarDelegate::Cancel() { | 78 bool ThemeInstalledInfoBarDelegate::Cancel() { |
78 was_canceled_ = true; | 79 was_canceled_ = true; |
79 if (!previous_theme_id_.empty()) { | 80 if (!previous_theme_id_.empty()) { |
80 ExtensionsService* service = profile_->GetExtensionsService(); | 81 ExtensionsService* service = profile_->GetExtensionsService(); |
81 if (service) { | 82 if (service) { |
82 Extension* previous_theme = service->GetExtensionById(previous_theme_id_); | 83 Extension* previous_theme = service->GetExtensionById(previous_theme_id_); |
83 if (previous_theme) { | 84 if (previous_theme) { |
84 profile_->SetTheme(previous_theme); | 85 profile_->SetTheme(previous_theme); |
85 return true; | 86 return true; |
86 } | 87 } |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 profile_->ClearTheme(); | 91 profile_->ClearTheme(); |
91 return true; | 92 return true; |
92 } | 93 } |
OLD | NEW |