| Index: chrome/browser/extensions/theme_installed_infobar_delegate.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/theme_installed_infobar_delegate.cc (revision 71863)
|
| +++ chrome/browser/extensions/theme_installed_infobar_delegate.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -33,6 +33,10 @@
|
| NotificationService::AllSources());
|
| }
|
|
|
| +bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) {
|
| + return theme && (theme->id() == theme_id_);
|
| +}
|
| +
|
| ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() {
|
| // We don't want any notifications while we're running our destructor.
|
| registrar_.RemoveAll();
|
| @@ -40,15 +44,27 @@
|
| profile_->GetThemeProvider()->OnInfobarDestroyed();
|
| }
|
|
|
| +bool ThemeInstalledInfoBarDelegate::Cancel() {
|
| + if (!previous_theme_id_.empty()) {
|
| + ExtensionService* service = profile_->GetExtensionService();
|
| + if (service) {
|
| + const Extension* previous_theme =
|
| + service->GetExtensionById(previous_theme_id_, true);
|
| + if (previous_theme) {
|
| + profile_->SetTheme(previous_theme);
|
| + return true;
|
| + }
|
| + }
|
| + }
|
| +
|
| + profile_->ClearTheme();
|
| + return true;
|
| +}
|
| +
|
| void ThemeInstalledInfoBarDelegate::InfoBarClosed() {
|
| delete this;
|
| }
|
|
|
| -string16 ThemeInstalledInfoBarDelegate::GetMessageText() const {
|
| - return l10n_util::GetStringFUTF16(IDS_THEME_INSTALL_INFOBAR_LABEL,
|
| - UTF8ToUTF16(name_));
|
| -}
|
| -
|
| SkBitmap* ThemeInstalledInfoBarDelegate::GetIcon() const {
|
| // TODO(aa): Reply with the theme's icon, but this requires reading it
|
| // asynchronously from disk.
|
| @@ -60,36 +76,21 @@
|
| return this;
|
| }
|
|
|
| +string16 ThemeInstalledInfoBarDelegate::GetMessageText() const {
|
| + return l10n_util::GetStringFUTF16(IDS_THEME_INSTALL_INFOBAR_LABEL,
|
| + UTF8ToUTF16(name_));
|
| +}
|
| +
|
| int ThemeInstalledInfoBarDelegate::GetButtons() const {
|
| return BUTTON_CANCEL;
|
| }
|
|
|
| string16 ThemeInstalledInfoBarDelegate::GetButtonLabel(
|
| - ConfirmInfoBarDelegate::InfoBarButton button) const {
|
| - // The InfoBar will create a default OK button and make it invisible.
|
| - // TODO(mirandac): remove the default OK button from ConfirmInfoBar.
|
| - return (button == BUTTON_CANCEL) ?
|
| - l10n_util::GetStringUTF16(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON) :
|
| - string16();
|
| + InfoBarButton button) const {
|
| + DCHECK_EQ(BUTTON_CANCEL, button);
|
| + return l10n_util::GetStringUTF16(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON);
|
| }
|
|
|
| -bool ThemeInstalledInfoBarDelegate::Cancel() {
|
| - if (!previous_theme_id_.empty()) {
|
| - ExtensionService* service = profile_->GetExtensionService();
|
| - if (service) {
|
| - const Extension* previous_theme =
|
| - service->GetExtensionById(previous_theme_id_, true);
|
| - if (previous_theme) {
|
| - profile_->SetTheme(previous_theme);
|
| - return true;
|
| - }
|
| - }
|
| - }
|
| -
|
| - profile_->ClearTheme();
|
| - return true;
|
| -}
|
| -
|
| void ThemeInstalledInfoBarDelegate::Observe(
|
| NotificationType type,
|
| const NotificationSource& source,
|
| @@ -115,7 +116,3 @@
|
| }
|
| }
|
| }
|
| -
|
| -bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) {
|
| - return (theme && theme->id() == theme_id_);
|
| -}
|
|
|