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

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

Issue 3127009: Convert infobar APIs to UTF-16. (Closed)
Patch Set: works Created 10 years, 4 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
OLDNEW
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 std::wstring CrashedExtensionInfoBarDelegate::GetMessageText() const { 28 string16 CrashedExtensionInfoBarDelegate::GetMessageText() const {
29 return l10n_util::GetStringF(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE, 29 return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE,
30 UTF8ToWide(extension_name_)); 30 UTF8ToUTF16(extension_name_));
31 } 31 }
32 32
33 void CrashedExtensionInfoBarDelegate::InfoBarClosed() { 33 void CrashedExtensionInfoBarDelegate::InfoBarClosed() {
34 delete this; 34 delete this;
35 } 35 }
36 36
37 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const { 37 SkBitmap* CrashedExtensionInfoBarDelegate::GetIcon() const {
38 // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591 38 // TODO(erikkay): Create extension-specific icon. http://crbug.com/14591
39 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 39 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
40 IDR_INFOBAR_PLUGIN_CRASHED); 40 IDR_INFOBAR_PLUGIN_CRASHED);
41 } 41 }
42 42
43 int CrashedExtensionInfoBarDelegate::GetButtons() const { 43 int CrashedExtensionInfoBarDelegate::GetButtons() const {
44 return BUTTON_OK; 44 return BUTTON_OK;
45 } 45 }
46 46
47 std::wstring CrashedExtensionInfoBarDelegate::GetButtonLabel( 47 string16 CrashedExtensionInfoBarDelegate::GetButtonLabel(
48 ConfirmInfoBarDelegate::InfoBarButton button) const { 48 ConfirmInfoBarDelegate::InfoBarButton button) const {
49 if (button == BUTTON_OK) 49 if (button == BUTTON_OK) {
50 return l10n_util::GetString(IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON); 50 return l10n_util::GetStringUTF16(
51 IDS_EXTENSION_CRASHED_INFOBAR_RESTART_BUTTON);
52 }
51 return ConfirmInfoBarDelegate::GetButtonLabel(button); 53 return ConfirmInfoBarDelegate::GetButtonLabel(button);
52 } 54 }
53 55
54 bool CrashedExtensionInfoBarDelegate::Accept() { 56 bool CrashedExtensionInfoBarDelegate::Accept() {
55 extensions_service_->ReloadExtension(extension_id_); 57 extensions_service_->ReloadExtension(extension_id_);
56 return true; 58 return true;
57 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698