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

Unified Diff: chrome/browser/views/infobars/infobars.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/infobars/infobars.cc
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 1d780580620e772f3d82997fd566e89100126d53..a9e1688f5e95a40d2c000f0e1d908d0efbdab808 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -11,6 +11,7 @@
#include "app/win_util.h"
#endif // defined(OS_WIN)
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/infobars/infobar_container.h"
#include "gfx/canvas.h"
@@ -33,9 +34,6 @@ const int InfoBar::kEndOfLabelSpacing = 16;
const int InfoBar::kCloseButtonSpacing = 12;
const int InfoBar::kButtonInLabelSpacing = 5;
-static const SkColor kInfoBackgroundColorTop = SkColorSetRGB(170, 214, 112);
-static const SkColor kInfoBackgroundColorBottom = SkColorSetRGB(146, 205, 114);
-
static const SkColor kWarningBackgroundColorTop = SkColorSetRGB(255, 242, 183);
static const SkColor kWarningBackgroundColorBottom =
SkColorSetRGB(250, 230, 145);
@@ -295,7 +293,7 @@ void InfoBar::DeleteSelf() {
AlertInfoBar::AlertInfoBar(AlertInfoBarDelegate* delegate)
: InfoBar(delegate) {
label_ = new views::Label(
- delegate->GetMessageText(),
+ UTF16ToWideHack(delegate->GetMessageText()),
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
label_->SetColor(SK_ColorBLACK);
label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -350,12 +348,12 @@ LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate)
// Set up the labels.
size_t offset;
- std::wstring message_text = delegate->GetMessageTextWithOffset(&offset);
- if (offset != std::wstring::npos) {
- label_1_->SetText(message_text.substr(0, offset));
- label_2_->SetText(message_text.substr(offset));
+ string16 message_text = delegate->GetMessageTextWithOffset(&offset);
+ if (offset != string16::npos) {
+ label_1_->SetText(UTF16ToWideHack(message_text.substr(0, offset)));
+ label_2_->SetText(UTF16ToWideHack(message_text.substr(offset)));
} else {
- label_1_->SetText(message_text);
+ label_1_->SetText(UTF16ToWideHack(message_text));
}
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
label_1_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
@@ -368,7 +366,7 @@ LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate)
AddChildView(label_2_);
// Set up the link.
- link_->SetText(delegate->GetLinkText());
+ link_->SetText(UTF16ToWideHack(delegate->GetLinkText()));
link_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
link_->SetController(this);
@@ -446,20 +444,22 @@ ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate)
cancel_button_(NULL),
link_(NULL),
initialized_(false) {
- ok_button_ = new views::NativeButton(
- this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ ok_button_ = new views::NativeButton(this,
+ UTF16ToWideHack(delegate->GetButtonLabel(
+ ConfirmInfoBarDelegate::BUTTON_OK)));
ok_button_->SetAccessibleName(ok_button_->label());
if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK_DEFAULT)
ok_button_->SetAppearsAsDefault(true);
if (delegate->NeedElevation(ConfirmInfoBarDelegate::BUTTON_OK))
ok_button_->SetNeedElevation(true);
cancel_button_ = new views::NativeButton(
- this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ this, UTF16ToWideHack(
+ delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL)));
cancel_button_->SetAccessibleName(cancel_button_->label());
// Set up the link.
link_ = new views::Link;
- link_->SetText(delegate->GetLinkText());
+ link_->SetText(UTF16ToWideHack(delegate->GetLinkText()));
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
link_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);

Powered by Google App Engine
This is Rietveld 408576698