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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extensions_service.h" | 10 #include "chrome/browser/extensions/extensions_service.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "grit/browser_resources.h" | 12 #include "grit/browser_resources.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
15 | 15 |
16 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( | 16 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( |
17 TabContents* tab_contents, | 17 TabContents* tab_contents, |
18 ExtensionsService* extensions_service, | 18 ExtensionsService* extensions_service, |
19 const Extension* extension) | 19 const Extension* extension) |
20 : ConfirmInfoBarDelegate(tab_contents), | 20 : ConfirmInfoBarDelegate(tab_contents), |
21 extensions_service_(extensions_service), | 21 extensions_service_(extensions_service), |
22 extension_id_(extension->id()), | 22 extension_id_(extension->id()), |
23 extension_name_(extension->name()) { | 23 extension_name_(extension->name()) { |
24 DCHECK(extensions_service_); | 24 DCHECK(extensions_service_); |
25 DCHECK(!extension_id_.empty()); | 25 DCHECK(!extension_id_.empty()); |
26 } | 26 } |
27 | 27 |
| 28 CrashedExtensionInfoBarDelegate* CrashedExtensionInfoBarDelegate:: |
| 29 AsCrashedExtensionInfoBarDelegate() { |
| 30 return this; |
| 31 } |
| 32 |
28 string16 CrashedExtensionInfoBarDelegate::GetMessageText() const { | 33 string16 CrashedExtensionInfoBarDelegate::GetMessageText() const { |
29 return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, | 34 return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, |
30 UTF8ToUTF16(extension_name_)); | 35 UTF8ToUTF16(extension_name_)); |
31 } | 36 } |
32 | 37 |
33 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { | 38 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { |
34 delete this; | 39 delete this; |
35 } | 40 } |
36 | 41 |
37 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { | 42 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { |
(...skipping 12 matching lines...) Expand all Loading... |
50 return l10n_util::GetStringUTF16( | 55 return l10n_util::GetStringUTF16( |
51 IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); | 56 IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); |
52 } | 57 } |
53 return ConfirmInfoBarDelegate::GetButtonLabel(button); | 58 return ConfirmInfoBarDelegate::GetButtonLabel(button); |
54 } | 59 } |
55 | 60 |
56 bool CrashedExtensionInfoBarDelegate::Accept() { | 61 bool CrashedExtensionInfoBarDelegate::Accept() { |
57 extensions_service_->ReloadExtension(extension_id_); | 62 extensions_service_->ReloadExtension(extension_id_); |
58 return true; | 63 return true; |
59 } | 64 } |
OLD | NEW |