| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #include "chrome/browser/extensions/crashed_extension_infobar.h" | 
|  | 6 | 
|  | 7 #include "app/l10n_util.h" | 
|  | 8 #include "app/resource_bundle.h" | 
|  | 9 #include "chrome/browser/extensions/extensions_service.h" | 
|  | 10 #include "chrome/common/extensions/extension.h" | 
|  | 11 #include "grit/browser_resources.h" | 
|  | 12 #include "grit/generated_resources.h" | 
|  | 13 #include "grit/theme_resources.h" | 
|  | 14 | 
|  | 15 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( | 
|  | 16     TabContents* tab_contents, | 
|  | 17     ExtensionsService* extensions_service, | 
|  | 18     const Extension* extension) | 
|  | 19     : ConfirmInfoBarDelegate(tab_contents), | 
|  | 20       extensions_service_(extensions_service), | 
|  | 21       extension_id_(extension->id()), | 
|  | 22       extension_name_(extension->name()) { | 
|  | 23   DCHECK(extensions_service_); | 
|  | 24   DCHECK(!extension_id_.empty()); | 
|  | 25 } | 
|  | 26 | 
|  | 27 std::wstring CrashedExtensionInfoBarDelegate::GetMessageText() const { | 
|  | 28   return l10n_util::GetStringF(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, | 
|  | 29       UTF8ToWide(extension_name_)); | 
|  | 30 } | 
|  | 31 | 
|  | 32 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { | 
|  | 33   delete this; | 
|  | 34 } | 
|  | 35 | 
|  | 36 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { | 
|  | 37   // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591 | 
|  | 38   return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 
|  | 39       IDR_INFOBAR_PLUGIN_CRASHED); | 
|  | 40 } | 
|  | 41 | 
|  | 42 int CrashedExtensionInfoBarDelegate::GetButtons() const { | 
|  | 43   return BUTTON_OK; | 
|  | 44 } | 
|  | 45 | 
|  | 46 std::wstring CrashedExtensionInfoBarDelegate::GetButtonLabel( | 
|  | 47     ConfirmInfoBarDelegate::InfoBarButton button) const { | 
|  | 48   if (button == BUTTON_OK) | 
|  | 49     return l10n_util::GetString(IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); | 
|  | 50   return ConfirmInfoBarDelegate::GetButtonLabel(button); | 
|  | 51 } | 
|  | 52 | 
|  | 53 bool CrashedExtensionInfoBarDelegate::Accept() { | 
|  | 54   extensions_service_->ReloadExtension(extension_id_); | 
|  | 55   return true; | 
|  | 56 } | 
| OLD | NEW | 
|---|