| 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/crashed_extension_infobar.h" | 5 #include "chrome/browser/extensions/crashed_extension_infobar.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 "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extensions_service.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| 11 #include "grit/browser_resources.h" | 11 #include "grit/browser_resources.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 | 14 |
| 15 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( | 15 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( |
| 16 TabContents* tab_contents, | 16 TabContents* tab_contents, |
| 17 ExtensionsService* extensions_service, | 17 ExtensionsService* extensions_service, |
| 18 const Extension* extension) | 18 const Extension* extension) |
| 19 : ConfirmInfoBarDelegate(tab_contents), | 19 : ConfirmInfoBarDelegate(tab_contents), |
| 20 extensions_service_(extensions_service), | 20 extensions_service_(extensions_service), |
| 21 extension_id_(extension->id()), | 21 extension_id_(extension->id()), |
| 22 extension_name_(extension->name()) { | 22 extension_name_(extension->name()) { |
| 23 DCHECK(extensions_service_); | 23 DCHECK(extensions_service_.get()); |
| 24 DCHECK(!extension_id_.empty()); | 24 DCHECK(!extension_id_.empty()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 CrashedExtensionInfoBarDelegate::~CrashedExtensionInfoBarDelegate() { |
| 28 } |
| 29 |
| 27 std::wstring CrashedExtensionInfoBarDelegate::GetMessageText() const { | 30 std::wstring CrashedExtensionInfoBarDelegate::GetMessageText() const { |
| 28 return l10n_util::GetStringF(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, | 31 return l10n_util::GetStringF(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, |
| 29 UTF8ToWide(extension_name_)); | 32 UTF8ToWide(extension_name_)); |
| 30 } | 33 } |
| 31 | 34 |
| 32 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { | 35 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { |
| 33 delete this; | 36 delete this; |
| 34 } | 37 } |
| 35 | 38 |
| 36 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { | 39 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 ConfirmInfoBarDelegate::InfoBarButton button) const { | 50 ConfirmInfoBarDelegate::InfoBarButton button) const { |
| 48 if (button == BUTTON_OK) | 51 if (button == BUTTON_OK) |
| 49 return l10n_util::GetString(IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); | 52 return l10n_util::GetString(IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); |
| 50 return ConfirmInfoBarDelegate::GetButtonLabel(button); | 53 return ConfirmInfoBarDelegate::GetButtonLabel(button); |
| 51 } | 54 } |
| 52 | 55 |
| 53 bool CrashedExtensionInfoBarDelegate::Accept() { | 56 bool CrashedExtensionInfoBarDelegate::Accept() { |
| 54 extensions_service_->ReloadExtension(extension_id_); | 57 extensions_service_->ReloadExtension(extension_id_); |
| 55 return true; | 58 return true; |
| 56 } | 59 } |
| OLD | NEW |