Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chrome/browser/extensions/crashed_extension_infobar.cc

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_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 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 15
16 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate( 16 CrashedExtensionInfoBarDelegate::CrashedExtensionInfoBarDelegate(
17 TabContents* tab_contents, 17 TabContents* tab_contents,
18 ExtensionService* extensions_service, 18 ExtensionService* 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:: 28 CrashedExtensionInfoBarDelegate::~CrashedExtensionInfoBarDelegate() {
29 AsCrashedExtensionInfoBarDelegate() {
30 return this;
31 } 29 }
32 30
33 bool CrashedExtensionInfoBarDelegate::ShouldExpire( 31 bool CrashedExtensionInfoBarDelegate::ShouldExpire(
34 const NavigationController::LoadCommittedDetails& details) const { 32 const NavigationController::LoadCommittedDetails& details) const {
35 return false; 33 return false;
36 } 34 }
37 35
38 string16 CrashedExtensionInfoBarDelegate::GetMessageText() const {
39 return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE,
40 UTF8ToUTF16(extension_name_));
41 }
42
43 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { 36 void CrashedExtensionInfoBarDelegate::InfoBarClosed() {
44 delete this; 37 delete this;
45 } 38 }
46 39
47 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { 40 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const {
48 // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591 41 // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591
49 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 42 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
50 IDR_INFOBAR_PLUGIN_CRASHED); 43 IDR_INFOBAR_PLUGIN_CRASHED);
51 } 44 }
52 45
46 CrashedExtensionInfoBarDelegate*
47 CrashedExtensionInfoBarDelegate::AsCrashedExtensionInfoBarDelegate() {
48 return this;
49 }
50
51 string16 CrashedExtensionInfoBarDelegate::GetMessageText() const {
52 return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE,
53 UTF8ToUTF16(extension_name_));
54 }
55
53 int CrashedExtensionInfoBarDelegate::GetButtons() const { 56 int CrashedExtensionInfoBarDelegate::GetButtons() const {
54 return BUTTON_OK; 57 return BUTTON_OK;
55 } 58 }
56 59
57 string16 CrashedExtensionInfoBarDelegate::GetButtonLabel( 60 string16 CrashedExtensionInfoBarDelegate::GetButtonLabel(
58 ConfirmInfoBarDelegate::InfoBarButton button) const { 61 InfoBarButton button) const {
59 if (button == BUTTON_OK) { 62 DCHECK_EQ(BUTTON_OK, button);
60 return l10n_util::GetStringUTF16( 63 return l10n_util::GetStringUTF16(
61 IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); 64 IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON);
62 }
63 return ConfirmInfoBarDelegate::GetButtonLabel(button);
64 } 65 }
65 66
66 bool CrashedExtensionInfoBarDelegate::Accept() { 67 bool CrashedExtensionInfoBarDelegate::Accept() {
67 extensions_service_->ReloadExtension(extension_id_); 68 extensions_service_->ReloadExtension(extension_id_);
68 return true; 69 return true;
69 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698