| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // We don't want any notifications while we're running our destructor. | 36 // We don't want any notifications while we're running our destructor. |
| 37 registrar_.RemoveAll(); | 37 registrar_.RemoveAll(); |
| 38 | 38 |
| 39 profile_->GetThemeProvider()->OnInfobarDestroyed(); | 39 profile_->GetThemeProvider()->OnInfobarDestroyed(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void ThemeInstalledInfoBarDelegate::InfoBarClosed() { | 42 void ThemeInstalledInfoBarDelegate::InfoBarClosed() { |
| 43 delete this; | 43 delete this; |
| 44 } | 44 } |
| 45 | 45 |
| 46 std::wstring ThemeInstalledInfoBarDelegate::GetMessageText() const { | 46 string16 ThemeInstalledInfoBarDelegate::GetMessageText() const { |
| 47 return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, | 47 return l10n_util::GetStringFUTF16(IDS_THEME_INSTALL_INFOBAR_LABEL, |
| 48 UTF8ToWide(name_)); | 48 UTF8ToUTF16(name_)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SkBitmap* ThemeInstalledInfoBarDelegate::GetIcon() const { | 51 SkBitmap* ThemeInstalledInfoBarDelegate::GetIcon() const { |
| 52 // TODO(aa): Reply with the theme's icon, but this requires reading it | 52 // TODO(aa): Reply with the theme's icon, but this requires reading it |
| 53 // asynchronously from disk. | 53 // asynchronously from disk. |
| 54 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 54 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 55 IDR_INFOBAR_THEME); | 55 IDR_INFOBAR_THEME); |
| 56 } | 56 } |
| 57 | 57 |
| 58 ThemeInstalledInfoBarDelegate* | 58 ThemeInstalledInfoBarDelegate* |
| 59 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { | 59 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { |
| 60 return this; | 60 return this; |
| 61 } | 61 } |
| 62 | 62 |
| 63 int ThemeInstalledInfoBarDelegate::GetButtons() const { | 63 int ThemeInstalledInfoBarDelegate::GetButtons() const { |
| 64 return BUTTON_CANCEL; | 64 return BUTTON_CANCEL; |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::wstring ThemeInstalledInfoBarDelegate::GetButtonLabel( | 67 string16 ThemeInstalledInfoBarDelegate::GetButtonLabel( |
| 68 ConfirmInfoBarDelegate::InfoBarButton button) const { | 68 ConfirmInfoBarDelegate::InfoBarButton button) const { |
| 69 switch (button) { | 69 switch (button) { |
| 70 case BUTTON_CANCEL: { | 70 case BUTTON_CANCEL: { |
| 71 return l10n_util::GetString(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); | 71 return l10n_util::GetStringUTF16(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON); |
| 72 } | 72 } |
| 73 default: | 73 default: |
| 74 // The InfoBar will create a default OK button and make it invisible. | 74 // The InfoBar will create a default OK button and make it invisible. |
| 75 // TODO(mirandac): remove the default OK button from ConfirmInfoBar. | 75 // TODO(mirandac): remove the default OK button from ConfirmInfoBar. |
| 76 return L""; | 76 return string16(); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool ThemeInstalledInfoBarDelegate::Cancel() { | 80 bool ThemeInstalledInfoBarDelegate::Cancel() { |
| 81 if (!previous_theme_id_.empty()) { | 81 if (!previous_theme_id_.empty()) { |
| 82 ExtensionsService* service = profile_->GetExtensionsService(); | 82 ExtensionsService* service = profile_->GetExtensionsService(); |
| 83 if (service) { | 83 if (service) { |
| 84 Extension* previous_theme = | 84 Extension* previous_theme = |
| 85 service->GetExtensionById(previous_theme_id_, true); | 85 service->GetExtensionById(previous_theme_id_, true); |
| 86 if (previous_theme) { | 86 if (previous_theme) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 default: | 111 default: |
| 112 NOTREACHED(); | 112 NOTREACHED(); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool ThemeInstalledInfoBarDelegate::MatchesTheme(Extension* theme) { | 116 bool ThemeInstalledInfoBarDelegate::MatchesTheme(Extension* theme) { |
| 117 return (theme && theme->id() == theme_id_); | 117 return (theme && theme->id() == theme_id_); |
| 118 } | 118 } |
| OLD | NEW |