Chromium Code Reviews

Side by Side Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.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.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/autofill/autofill_cc_infobar_delegate.h" 5 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.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/histogram.h" 9 #include "base/histogram.h"
10 #include "chrome/browser/autofill/autofill_cc_infobar.h" 10 #include "chrome/browser/autofill/autofill_cc_infobar.h"
(...skipping 37 matching lines...)
48 void AutoFillCCInfoBarDelegate::InfoBarClosed() { 48 void AutoFillCCInfoBarDelegate::InfoBarClosed() {
49 if (host_) { 49 if (host_) {
50 host_->OnInfoBarClosed(false); 50 host_->OnInfoBarClosed(false);
51 host_ = NULL; 51 host_ = NULL;
52 } 52 }
53 53
54 // This will delete us. 54 // This will delete us.
55 ConfirmInfoBarDelegate::InfoBarClosed(); 55 ConfirmInfoBarDelegate::InfoBarClosed();
56 } 56 }
57 57
58 std::wstring AutoFillCCInfoBarDelegate::GetMessageText() const { 58 string16 AutoFillCCInfoBarDelegate::GetMessageText() const {
59 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_TEXT); 59 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
60 } 60 }
61 61
62 SkBitmap* AutoFillCCInfoBarDelegate::GetIcon() const { 62 SkBitmap* AutoFillCCInfoBarDelegate::GetIcon() const {
63 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 63 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
64 IDR_INFOBAR_AUTOFILL); 64 IDR_INFOBAR_AUTOFILL);
65 } 65 }
66 66
67 int AutoFillCCInfoBarDelegate::GetButtons() const { 67 int AutoFillCCInfoBarDelegate::GetButtons() const {
68 return BUTTON_OK | BUTTON_CANCEL; 68 return BUTTON_OK | BUTTON_CANCEL;
69 } 69 }
70 70
71 std::wstring AutoFillCCInfoBarDelegate::GetButtonLabel( 71 string16 AutoFillCCInfoBarDelegate::GetButtonLabel(
72 ConfirmInfoBarDelegate::InfoBarButton button) const { 72 ConfirmInfoBarDelegate::InfoBarButton button) const {
73 if (button == BUTTON_OK) 73 if (button == BUTTON_OK)
74 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_ACCEPT); 74 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_ACCEPT);
75 else if (button == BUTTON_CANCEL) 75 else if (button == BUTTON_CANCEL)
76 return l10n_util::GetString(IDS_AUTOFILL_CC_INFOBAR_DENY); 76 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_DENY);
77 else 77 else
78 NOTREACHED(); 78 NOTREACHED();
79 79
80 return std::wstring(); 80 return string16();
81 } 81 }
82 82
83 bool AutoFillCCInfoBarDelegate::Accept() { 83 bool AutoFillCCInfoBarDelegate::Accept() {
84 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarAccepted", 1); 84 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarAccepted", 1);
85 if (host_) { 85 if (host_) {
86 host_->OnInfoBarClosed(true); 86 host_->OnInfoBarClosed(true);
87 host_ = NULL; 87 host_ = NULL;
88 } 88 }
89 return true; 89 return true;
90 } 90 }
91 91
92 bool AutoFillCCInfoBarDelegate::Cancel() { 92 bool AutoFillCCInfoBarDelegate::Cancel() {
93 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarDenied", 1); 93 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarDenied", 1);
94 if (host_) { 94 if (host_) {
95 host_->OnInfoBarClosed(false); 95 host_->OnInfoBarClosed(false);
96 host_ = NULL; 96 host_ = NULL;
97 } 97 }
98 return true; 98 return true;
99 } 99 }
100 100
101 std::wstring AutoFillCCInfoBarDelegate::GetLinkText() { 101 string16 AutoFillCCInfoBarDelegate::GetLinkText() {
102 return l10n_util::GetString(IDS_AUTOFILL_CC_LEARN_MORE); 102 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_LEARN_MORE);
103 } 103 }
104 104
105 bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 105 bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
106 browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB, 106 browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB,
107 PageTransition::TYPED); 107 PageTransition::TYPED);
108 return false; 108 return false;
109 } 109 }
110 110
111 #if defined(OS_WIN) 111 #if defined(OS_WIN)
112 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() { 112 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() {
113 return CreateAutofillCcInfoBar(this); 113 return CreateAutofillCcInfoBar(this);
114 } 114 }
115 #endif // defined(OS_WIN) 115 #endif // defined(OS_WIN)
116 116
OLDNEW

Powered by Google App Engine