summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 14:37:16 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 14:37:16 +0000
commit3f891cf79f72f4768a15bfae051e08b9211ed8c3 (patch)
tree3cf8d59e7186889184f575fcbe3284e6400fb505
parente0c7405b8f24e6c0096285446f94f729e63107df (diff)
downloadchromium_src-3f891cf79f72f4768a15bfae051e08b9211ed8c3.zip
chromium_src-3f891cf79f72f4768a15bfae051e08b9211ed8c3.tar.gz
chromium_src-3f891cf79f72f4768a15bfae051e08b9211ed8c3.tar.bz2
Remove wstring from gfx.
BUG=68882 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6121004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71167 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm2
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm2
-rw-r--r--chrome/browser/chromeos/dom_ui/menu_ui.cc26
-rw-r--r--chrome/browser/chromeos/drop_shadow_label.cc9
-rw-r--r--chrome/browser/chromeos/login/oobe_progress_bar.cc2
-rw-r--r--chrome/browser/chromeos/login/username_view.cc8
-rw-r--r--chrome/browser/chromeos/panels/panel_scroller_header.cc8
-rw-r--r--chrome/browser/gtk/bookmark_utils_gtk.cc3
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.cc6
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.cc2
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc4
-rw-r--r--chrome/browser/remoting/setup_flow.cc2
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc2
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm2
-rw-r--r--chrome/browser/ui/cocoa/download/download_item_cell.mm4
-rw-r--r--chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm2
-rw-r--r--chrome/browser/ui/cocoa/status_bubble_mac.mm4
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc4
-rw-r--r--chrome/browser/ui/views/download_item_view.cc7
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.cc2
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc10
-rw-r--r--chrome/browser/ui/views/status_bubble_views.cc2
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.cc2
-rw-r--r--chrome/browser/ui/views/theme_install_bubble_view.cc2
-rw-r--r--chrome/common/badge_util.cc2
-rw-r--r--gfx/canvas.h7
-rw-r--r--gfx/canvas_direct2d.cc6
-rw-r--r--gfx/canvas_direct2d.h6
-rw-r--r--gfx/canvas_skia.cc4
-rw-r--r--gfx/canvas_skia.h10
-rw-r--r--gfx/canvas_skia_linux.cc11
-rw-r--r--gfx/canvas_skia_mac.mm6
-rw-r--r--gfx/canvas_skia_win.cc18
-rw-r--r--gfx/font.cc4
-rw-r--r--gfx/font.h4
-rw-r--r--gfx/font_unittest.cc14
-rw-r--r--gfx/platform_font.h4
-rw-r--r--gfx/platform_font_gtk.cc31
-rw-r--r--gfx/platform_font_gtk.h12
-rw-r--r--gfx/platform_font_mac.h10
-rw-r--r--gfx/platform_font_mac.mm14
-rw-r--r--gfx/platform_font_win.cc10
-rw-r--r--gfx/platform_font_win.h10
-rw-r--r--views/controls/button/text_button.cc6
-rw-r--r--views/controls/label.cc2
-rw-r--r--views/controls/label_unittest.cc18
-rw-r--r--views/controls/menu/menu_item_view.cc2
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc2
-rw-r--r--views/controls/textfield/gtk_views_entry.cc2
-rw-r--r--views/controls/textfield/gtk_views_textview.cc2
-rw-r--r--views/controls/textfield/native_textfield_views.cc10
-rw-r--r--views/drag_utils.cc2
-rw-r--r--views/view_text_utils.cc14
-rw-r--r--views/window/custom_frame_view.cc7
55 files changed, 184 insertions, 185 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index d0b84e7..20a979e 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -449,7 +449,7 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
// The popup's font is a slightly smaller version of the field's.
NSFont* fieldFont = AutocompleteEditViewMac::GetFieldFont();
const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust;
- gfx::Font resultFont(base::SysNSStringToWide([fieldFont fontName]),
+ gfx::Font resultFont(base::SysNSStringToUTF16([fieldFont fontName]),
static_cast<int>(resultFontSize));
AutocompleteMatrix* matrix = GetAutocompleteMatrix();
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
index 82d30e8..0e1bab7 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
@@ -27,7 +27,7 @@ class AutocompletePopupViewMacTest : public PlatformTest {
color_ = [NSColor blackColor];
dimColor_ = [NSColor darkGrayColor];
font_ = gfx::Font(
- base::SysNSStringToWide([[NSFont userFontOfSize:12] fontName]), 12);
+ base::SysNSStringToUTF16([[NSFont userFontOfSize:12] fontName]), 12);
}
// Returns the length of the run starting at |location| for which
diff --git a/chrome/browser/chromeos/dom_ui/menu_ui.cc b/chrome/browser/chromeos/dom_ui/menu_ui.cc
index 65536d9..70f49b9 100644
--- a/chrome/browser/chromeos/dom_ui/menu_ui.cc
+++ b/chrome/browser/chromeos/dom_ui/menu_ui.cc
@@ -43,30 +43,30 @@ namespace {
const int kNoExtraResource = -1;
// A utility function that generates css font property from gfx::Font.
-std::wstring GetFontShorthand(const gfx::Font* font) {
- std::wstring out;
+// NOTE: Returns UTF-8.
+std::string GetFontShorthand(const gfx::Font* font) {
+ std::string out;
if (font == NULL) {
font = &(views::MenuConfig::instance().font);
}
if (font->GetStyle() & gfx::Font::BOLD) {
- out.append(L"bold ");
+ out.append("bold ");
}
if (font->GetStyle() & gfx::Font::ITALIC) {
- out.append(L"italic ");
+ out.append("italic ");
}
if (font->GetStyle() & gfx::Font::UNDERLINED) {
- out.append(L"underline ");
+ out.append("underline ");
}
// TODO(oshima): The font size from gfx::Font is too small when
// used in webkit. Figure out the reason.
- out.append(ASCIIToWide(base::IntToString(font->GetFontSize() + 4)));
- out.append(L"px/");
- out.append(ASCIIToWide(base::IntToString(
- std::max(kFavIconSize, font->GetHeight()))));
- out.append(L"px \"");
- out.append(font->GetFontName());
- out.append(L"\",sans-serif");
+ out.append(base::IntToString(font->GetFontSize() + 4));
+ out.append("px/");
+ out.append(base::IntToString(std::max(kFavIconSize, font->GetHeight())));
+ out.append("px \"");
+ out.append(UTF16ToUTF8(font->GetFontName()));
+ out.append("\",sans-serif");
return out;
}
@@ -619,7 +619,7 @@ DictionaryValue* MenuUI::CreateMenuItem(const menus::MenuModel* model,
item->SetBoolean("checked", model->IsItemCheckedAt(index));
item->SetInteger("command_id", model->GetCommandIdAt(index));
item->SetString(
- "font", WideToUTF16(GetFontShorthand(model->GetLabelFontAt(index))));
+ "font", GetFontShorthand(model->GetLabelFontAt(index)));
SkBitmap icon;
if (model->GetIconAt(index, &icon) && !icon.isNull() && !icon.empty()) {
item->SetString("icon", dom_ui_util::GetImageDataUrl(icon));
diff --git a/chrome/browser/chromeos/drop_shadow_label.cc b/chrome/browser/chromeos/drop_shadow_label.cc
index 5c5fa30..4876643 100644
--- a/chrome/browser/chromeos/drop_shadow_label.cc
+++ b/chrome/browser/chromeos/drop_shadow_label.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/drop_shadow_label.h"
+#include "base/utf_string_conversions.h"
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
@@ -44,19 +45,19 @@ void DropShadowLabel::PaintText(gfx::Canvas* canvas,
SkColorGetG(kDefaultColor),
SkColorGetB(kDefaultColor));
for (int i = 0; i < drop_shadow_size_; i++) {
- canvas->DrawStringInt(text, font(), color,
+ canvas->DrawStringInt(WideToUTF16Hack(text), font(), color,
text_bounds.x() + i, text_bounds.y(),
text_bounds.width(), text_bounds.height(), flags);
- canvas->DrawStringInt(text, font(), color,
+ canvas->DrawStringInt(WideToUTF16Hack(text), font(), color,
text_bounds.x() + i, text_bounds.y() + i,
text_bounds.width(), text_bounds.height(), flags);
- canvas->DrawStringInt(text, font(), color,
+ canvas->DrawStringInt(WideToUTF16Hack(text), font(), color,
text_bounds.x(), text_bounds.y() + i,
text_bounds.width(), text_bounds.height(), flags);
}
}
- canvas->DrawStringInt(text, font(), GetColor(),
+ canvas->DrawStringInt(WideToUTF16Hack(text), font(), GetColor(),
text_bounds.x(), text_bounds.y(),
text_bounds.width(), text_bounds.height(), flags);
diff --git a/chrome/browser/chromeos/login/oobe_progress_bar.cc b/chrome/browser/chromeos/login/oobe_progress_bar.cc
index 82b50de..5eafe52 100644
--- a/chrome/browser/chromeos/login/oobe_progress_bar.cc
+++ b/chrome/browser/chromeos/login/oobe_progress_bar.cc
@@ -111,7 +111,7 @@ void OobeProgressBar::Paint(gfx::Canvas* canvas) {
next_x - ix, line_->height());
}
- std::wstring str = UTF16ToWide(l10n_util::GetStringUTF16(steps_[i]));
+ string16 str = l10n_util::GetStringUTF16(steps_[i]);
canvas->DrawStringInt(str, font_, color,
x + kTextPadding, y + dot->height() + kTextPadding,
(next_x - x - 2 * kTextPadding),
diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc
index 5206901..b454b2f 100644
--- a/chrome/browser/chromeos/login/username_view.cc
+++ b/chrome/browser/chromeos/login/username_view.cc
@@ -155,10 +155,10 @@ void UsernameView::PaintUsername(const gfx::Rect& bounds) {
// Note, direct call of the DrawStringInt method produces the green dots
// along the text perimeter (when the label is place on the white background).
SkColor kInvisibleHaloColor = 0x00000000;
- canvas.DrawStringWithHalo(GetText(), font(), GetColor(), kInvisibleHaloColor,
- bounds.x() + margin_width_, bounds.y(),
- bounds.width() - 2 * margin_width_, bounds.height(),
- flags);
+ canvas.DrawStringWithHalo(WideToUTF16Hack(GetText()), font(), GetColor(),
+ kInvisibleHaloColor, bounds.x() + margin_width_,
+ bounds.y(), bounds.width() - 2 * margin_width_,
+ bounds.height(), flags);
text_image_.reset(new SkBitmap(canvas.ExtractBitmap()));
diff --git a/chrome/browser/chromeos/panels/panel_scroller_header.cc b/chrome/browser/chromeos/panels/panel_scroller_header.cc
index f6dceea..d4ef8fb 100644
--- a/chrome/browser/chromeos/panels/panel_scroller_header.cc
+++ b/chrome/browser/chromeos/panels/panel_scroller_header.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#include "chrome/browser/chromeos/panels/panel_scroller_header.h"
@@ -45,6 +45,6 @@ void PanelScrollerHeader::Paint(gfx::Canvas* canvas) {
gfx::Font font =
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
int font_top = 1;
- canvas->DrawStringInt(UTF16ToWideHack(title_), font, 0xFF000000, 3, font_top,
+ canvas->DrawStringInt(title_, font, 0xFF000000, 3, font_top,
size().width(), size().height() - font_top);
}
diff --git a/chrome/browser/gtk/bookmark_utils_gtk.cc b/chrome/browser/gtk/bookmark_utils_gtk.cc
index 62acc14..e6d164a 100644
--- a/chrome/browser/gtk/bookmark_utils_gtk.cc
+++ b/chrome/browser/gtk/bookmark_utils_gtk.cc
@@ -139,8 +139,7 @@ gboolean OnDragIconExpose(GtkWidget* sender,
int text_width = sender->allocation.width - text_x;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
- canvas.DrawStringInt(UTF16ToWide(data->text),
- base_font, data->text_color,
+ canvas.DrawStringInt(data->text, base_font, data->text_color,
text_x, 0, text_width, sender->allocation.height);
return TRUE;
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc
index a3c2d4e..cbe39c3 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.cc
+++ b/chrome/browser/gtk/options/fonts_page_gtk.cc
@@ -24,14 +24,14 @@ std::string MakeFontName(std::string family_name, int pixel_size) {
// The given font might not be available (the default fonts we use are not
// installed by default on some distros). So figure out which font we are
// actually falling back to and display that. (See crbug.com/31381.)
- std::wstring actual_family_name = gfx::Font(
- UTF8ToWide(family_name), pixel_size).GetFontName();
+ string16 actual_family_name = gfx::Font(
+ UTF8ToUTF16(family_name), pixel_size).GetFontName();
std::string fontname;
// TODO(mattm): We can pass in the size in pixels (px), and the font button
// actually honors it, but when you open the selector it interprets it as
// points. See crbug.com/17857
base::SStringPrintf(&fontname, "%s, %dpx",
- WideToUTF8(actual_family_name).c_str(), pixel_size);
+ UTF16ToUTF8(actual_family_name).c_str(), pixel_size);
return fontname;
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index b3f1c91..3b5cb50 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -813,7 +813,7 @@ void TabRendererGtk::PaintTitle(gfx::Canvas* canvas) {
SkColor title_color = IsSelected() ? selected_title_color_
: unselected_title_color_;
- canvas->DrawStringInt(UTF16ToWideHack(title), *title_font_, title_color,
+ canvas->DrawStringInt(title, *title_font_, title_color,
title_bounds_.x(), title_bounds_.y(),
title_bounds_.width(), title_bounds_.height());
}
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index da8d670..d49bbbd 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -133,7 +133,7 @@ void CloudPrintSetupFlow::GetDOMMessageHandlers(
void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const {
PrefService* prefs = profile_->GetPrefs();
gfx::Font approximate_web_font(
- UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
+ UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
prefs->GetInteger(prefs::kWebKitDefaultFontSize));
if (setup_done_) {
@@ -282,7 +282,7 @@ void CloudPrintSetupFlow::ShowSetupDone() {
if (dom_ui_) {
PrefService* prefs = profile_->GetPrefs();
gfx::Font approximate_web_font(
- UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
+ UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
prefs->GetInteger(prefs::kWebKitDefaultFontSize));
gfx::Size done_size = gfx::GetLocalizedContentsSizeForFont(
IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS,
diff --git a/chrome/browser/remoting/setup_flow.cc b/chrome/browser/remoting/setup_flow.cc
index 6070f1f..4727cee 100644
--- a/chrome/browser/remoting/setup_flow.cc
+++ b/chrome/browser/remoting/setup_flow.cc
@@ -165,7 +165,7 @@ void SetupFlow::GetDOMMessageHandlers(
void SetupFlow::GetDialogSize(gfx::Size* size) const {
PrefService* prefs = profile_->GetPrefs();
gfx::Font approximate_web_font(
- UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
+ UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
prefs->GetInteger(prefs::kWebKitDefaultFontSize));
// TODO(pranavk) Replace the following SYNC resources with REMOTING Resources.
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index adb06ea..083b8d8 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -373,7 +373,7 @@ SyncSetupFlow::~SyncSetupFlow() {
void SyncSetupFlow::GetDialogSize(gfx::Size* size) const {
PrefService* prefs = service_->profile()->GetPrefs();
gfx::Font approximate_web_font = gfx::Font(
- UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
+ UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
prefs->GetInteger(prefs::kWebKitDefaultFontSize));
*size = gfx::GetLocalizedContentsSizeForFont(
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
index 1d2fb2d..c797992 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm
@@ -27,7 +27,7 @@ const NSUInteger kMaximumMenuPixelsWide = 300;
+ (NSString*)menuTitleForNode:(const BookmarkNode*)node {
NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default"
- gfx::Font font(base::SysNSStringToWide([nsfont fontName]),
+ gfx::Font font(base::SysNSStringToUTF16([nsfont fontName]),
static_cast<int>([nsfont pointSize]));
string16 title = gfx::ElideText(node->GetTitle(),
font,
diff --git a/chrome/browser/ui/cocoa/download/download_item_cell.mm b/chrome/browser/ui/cocoa/download/download_item_cell.mm
index db5d5fa..586252d 100644
--- a/chrome/browser/ui/cocoa/download/download_item_cell.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_cell.mm
@@ -394,7 +394,7 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const {
- (NSString*)elideTitle:(int)availableWidth {
NSFont* font = [self font];
- gfx::Font font_chr(base::SysNSStringToWide([font fontName]),
+ gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]),
[font pointSize]);
return base::SysUTF16ToNSString(
@@ -403,7 +403,7 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const {
- (NSString*)elideStatus:(int)availableWidth {
NSFont* font = [self secondaryFont];
- gfx::Font font_chr(base::SysNSStringToWide([font fontName]),
+ gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]),
[font pointSize]);
return base::SysUTF16ToNSString(ElideText(
diff --git a/chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm
index ad384f9..79d794b 100644
--- a/chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm
@@ -89,7 +89,7 @@ CGFloat EVBubbleDecoration::GetWidthForSpace(CGFloat width) {
// Middle-elide the label to fit |width_left|. This leaves the
// prefix and the trailing country code in place.
- gfx::Font font(base::SysNSStringToWide([font_ fontName]),
+ gfx::Font font(base::SysNSStringToUTF16([font_ fontName]),
[font_ pointSize]);
NSString* elided_label = base::SysUTF16ToNSString(
ElideText(base::SysNSStringToUTF16(full_label_), font, width_left, true));
diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm
index 685096d..ffc0cb9 100644
--- a/chrome/browser/ui/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm
@@ -148,7 +148,7 @@ void StatusBubbleMac::SetURL(const GURL& url, const string16& languages) {
scaled_width = [[parent_ contentView] convertSize:scaled_width fromView:nil];
text_width = static_cast<int>(scaled_width.width);
NSFont* font = [[window_ contentView] font];
- gfx::Font font_chr(base::SysNSStringToWide([font fontName]),
+ gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]),
[font pointSize]);
string16 original_url_text = net::FormatUrl(url, UTF16ToUTF8(languages));
@@ -606,7 +606,7 @@ void StatusBubbleMac::ExpandBubble() {
// Generate the URL string that fits in the expanded bubble.
NSFont* font = [[window_ contentView] font];
- gfx::Font font_chr(base::SysNSStringToWide([font fontName]),
+ gfx::Font font_chr(base::SysNSStringToUTF16([font fontName]),
[font pointSize]);
string16 expanded_url = gfx::ElideUrl(url_, font_chr,
max_bubble_width, UTF16ToWideHack(languages_));
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index d381029..6e4360e 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -671,8 +671,8 @@ int AutocompleteResultView::DrawString(
for (Classifications::const_iterator j(i->classifications.begin());
j != i->classifications.end(); ++j) {
int left = mirroring_context_->mirrored_left_coord(x, x + j->pixel_width);
- canvas->DrawStringInt(j->text, *j->font, j->color, left, y,
- j->pixel_width, j->font->GetHeight(), flags);
+ canvas->DrawStringInt(WideToUTF16Hack(j->text), *j->font, j->color, left,
+ y, j->pixel_width, j->font->GetHeight(), flags);
x += j->pixel_width;
}
}
diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc
index 9f190f9..d35725b 100644
--- a/chrome/browser/ui/views/download_item_view.cc
+++ b/chrome/browser/ui/views/download_item_view.cc
@@ -515,8 +515,9 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
SkColorGetG(file_name_color)),
static_cast<int>(kDownloadItemLuminanceMod *
SkColorGetB(file_name_color)));
- canvas->DrawStringInt(status_text_, font_, file_name_color,
- mirrored_x, y, kTextWidth, font_.GetHeight());
+ canvas->DrawStringInt(WideToUTF16Hack(status_text_), font_,
+ file_name_color, mirrored_x, y, kTextWidth,
+ font_.GetHeight());
}
}
@@ -633,7 +634,7 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) {
(box_height_ - font_.GetHeight()) / 2);
// Draw the file's name.
- canvas->DrawStringInt(UTF16ToWide(filename), font_,
+ canvas->DrawStringInt(filename, font_,
IsEnabled() ? file_name_color :
kFileNameDisabledColor,
mirrored_x, y, kTextWidth, font_.GetHeight());
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 8d331cf..0a9cb38 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -712,7 +712,7 @@ void OpaqueBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) {
return;
}
if (delegate->ShouldShowWindowTitle()) {
- canvas->DrawStringInt(delegate->GetWindowTitle(),
+ canvas->DrawStringInt(WideToUTF16Hack(delegate->GetWindowTitle()),
BrowserFrame::GetTitleFont(),
SK_ColorWHITE, MirroredLeftPointForRect(title_bounds_),
title_bounds_.y(), title_bounds_.width(), title_bounds_.height());
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
index 92f1cb8..40bfff8 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -183,7 +183,7 @@ void ContentSettingImageView::Paint(gfx::Canvas* canvas) {
if (animation_in_progress_) {
// Paint text to the right of the icon.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- canvas->DrawStringInt(UTF16ToWideHack(animated_text_),
+ canvas->DrawStringInt(animated_text_,
rb.GetFont(ResourceBundle::MediumFont), SK_ColorBLACK,
GetImageBounds().right() + kTextMarginPixels, y(),
width() - GetImageBounds().width(), height(),
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 3c3abb6..62bbfd0 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -76,13 +76,13 @@ void SadTabView::Paint(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y());
- canvas->DrawStringInt(title_, *title_font_, kTitleColor, title_bounds_.x(),
- title_bounds_.y(), title_bounds_.width(),
- title_bounds_.height(),
+ canvas->DrawStringInt(WideToUTF16Hack(title_), *title_font_, kTitleColor,
+ title_bounds_.x(), title_bounds_.y(),
+ title_bounds_.width(), title_bounds_.height(),
gfx::Canvas::TEXT_ALIGN_CENTER);
- canvas->DrawStringInt(message_, *message_font_, kMessageColor,
- message_bounds_.x(), message_bounds_.y(),
+ canvas->DrawStringInt(WideToUTF16Hack(message_), *message_font_,
+ kMessageColor, message_bounds_.x(), message_bounds_.y(),
message_bounds_.width(), message_bounds_.height(),
gfx::Canvas::MULTI_LINE);
diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc
index 6bf4d2f..0e77b8d 100644
--- a/chrome/browser/ui/views/status_bubble_views.cc
+++ b/chrome/browser/ui/views/status_bubble_views.cc
@@ -447,7 +447,7 @@ void StatusBubbleViews::StatusView::Paint(gfx::Canvas* canvas) {
(SkColorGetR(text_color) + SkColorGetR(toolbar_color)) / 2,
(SkColorGetG(text_color) + SkColorGetR(toolbar_color)) / 2,
(SkColorGetB(text_color) + SkColorGetR(toolbar_color)) / 2);
- canvas->DrawStringInt(UTF16ToWide(text_),
+ canvas->DrawStringInt(text_,
views::Label::font(),
text_color,
body_bounds.x(),
diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc
index 61ccc35..9e1207c 100644
--- a/chrome/browser/ui/views/tabs/base_tab.cc
+++ b/chrome/browser/ui/views/tabs/base_tab.cc
@@ -406,7 +406,7 @@ void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) {
Browser::FormatTitleForDisplay(&title);
}
- canvas->DrawStringInt(UTF16ToWideHack(title), *font_, title_color,
+ canvas->DrawStringInt(title, *font_, title_color,
title_bounds().x(), title_bounds().y(),
title_bounds().width(), title_bounds().height());
}
diff --git a/chrome/browser/ui/views/theme_install_bubble_view.cc b/chrome/browser/ui/views/theme_install_bubble_view.cc
index 71e4171..8b7b30a 100644
--- a/chrome/browser/ui/views/theme_install_bubble_view.cc
+++ b/chrome/browser/ui/views/theme_install_bubble_view.cc
@@ -135,7 +135,7 @@ void ThemeInstallBubbleView::Paint(gfx::Canvas* canvas) {
body_bounds.set_x(MirroredLeftPointForRect(body_bounds));
SkColor text_color = SK_ColorWHITE;
- canvas->DrawStringInt(UTF16ToWideHack(text_),
+ canvas->DrawStringInt(text_,
views::Label::font(),
text_color,
body_bounds.x(),
diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc
index bd2067c..d57a26e 100644
--- a/chrome/common/badge_util.cc
+++ b/chrome/common/badge_util.cc
@@ -40,7 +40,7 @@ SkPaint* GetBadgeTextPaintSingleton() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
typeface = SkTypeface::CreateFromName(
- WideToUTF8(base_font.GetFontName()).c_str(), SkTypeface::kNormal);
+ UTF16ToUTF8(base_font.GetFontName()).c_str(), SkTypeface::kNormal);
}
text_paint->setTypeface(typeface);
diff --git a/gfx/canvas.h b/gfx/canvas.h
index b64c926..17a9586 100644
--- a/gfx/canvas.h
+++ b/gfx/canvas.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/string16.h"
#include "gfx/native_widget_types.h"
// TODO(beng): remove this include when we no longer depend on SkTypes.
#include "skia/ext/platform_canvas.h"
@@ -171,11 +172,11 @@ class Canvas {
// Draws text with the specified color, font and location. The text is
// aligned to the left, vertically centered, clipped to the region. If the
// text is too big, it is truncated and '...' is added to the end.
- virtual void DrawStringInt(const std::wstring& text, const
+ virtual void DrawStringInt(const string16& text, const
gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h) = 0;
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
const gfx::Rect& display_rect) = 0;
@@ -183,7 +184,7 @@ class Canvas {
// Draws text with the specified color, font and location. The last argument
// specifies flags for how the text should be rendered. It can be one of
// TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT.
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
diff --git a/gfx/canvas_direct2d.cc b/gfx/canvas_direct2d.cc
index 585659d..cba7b64 100644
--- a/gfx/canvas_direct2d.cc
+++ b/gfx/canvas_direct2d.cc
@@ -286,21 +286,21 @@ void CanvasDirect2D::DrawBitmapInt(const SkBitmap& bitmap,
NOTIMPLEMENTED();
}
-void CanvasDirect2D::DrawStringInt(const std::wstring& text,
+void CanvasDirect2D::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h) {
NOTIMPLEMENTED();
}
-void CanvasDirect2D::DrawStringInt(const std::wstring& text,
+void CanvasDirect2D::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
const gfx::Rect& display_rect) {
NOTIMPLEMENTED();
}
-void CanvasDirect2D::DrawStringInt(const std::wstring& text,
+void CanvasDirect2D::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
diff --git a/gfx/canvas_direct2d.h b/gfx/canvas_direct2d.h
index 89ea448..740a24d 100644
--- a/gfx/canvas_direct2d.h
+++ b/gfx/canvas_direct2d.h
@@ -57,15 +57,15 @@ class CanvasDirect2D : public Canvas {
int dest_x, int dest_y, int dest_w, int dest_h,
bool filter,
const SkPaint& paint);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
const gfx::Rect& display_rect);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
diff --git a/gfx/canvas_skia.cc b/gfx/canvas_skia.cc
index 017fd5f..aa0cb9d 100644
--- a/gfx/canvas_skia.cc
+++ b/gfx/canvas_skia.cc
@@ -277,7 +277,7 @@ void CanvasSkia::DrawBitmapInt(const SkBitmap& bitmap,
drawRect(dest_rect, p);
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h) {
@@ -285,7 +285,7 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
gfx::CanvasSkia::DefaultCanvasTextAlignment());
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
const gfx::Rect& display_rect) {
diff --git a/gfx/canvas_skia.h b/gfx/canvas_skia.h
index 7db41a0..b8b0aa9 100644
--- a/gfx/canvas_skia.h
+++ b/gfx/canvas_skia.h
@@ -75,7 +75,7 @@ class CanvasSkia : public skia::PlatformCanvas,
// we don't do any fancy blurring.
// On Linux, text with halo is created by stroking it with 2px |halo_color|
// then filling it with |text_color|.
- void DrawStringWithHalo(const std::wstring& text,
+ void DrawStringWithHalo(const string16& text,
const gfx::Font& font,
const SkColor& text_color,
const SkColor& halo_color,
@@ -119,15 +119,15 @@ class CanvasSkia : public skia::PlatformCanvas,
int dest_x, int dest_y, int dest_w, int dest_h,
bool filter,
const SkPaint& paint);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
const gfx::Rect& display_rect);
- virtual void DrawStringInt(const std::wstring& text,
+ virtual void DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
@@ -150,7 +150,7 @@ class CanvasSkia : public skia::PlatformCanvas,
// Draws text with the specified color, font and location. The text is
// aligned to the left, vertically centered, clipped to the region. If the
// text is too big, it is truncated and '...' is added to the end.
- void DrawStringInt(const std::wstring& text,
+ void DrawStringInt(const string16& text,
HFONT font,
const SkColor& color,
int x, int y, int w, int h,
diff --git a/gfx/canvas_skia_linux.cc b/gfx/canvas_skia_linux.cc
index 903c99f..ce2ae01 100644
--- a/gfx/canvas_skia_linux.cc
+++ b/gfx/canvas_skia_linux.cc
@@ -162,7 +162,7 @@ static void SetupPangoLayout(PangoLayout* layout,
class DrawStringContext {
public:
DrawStringContext(gfx::CanvasSkia* canvas,
- const std::wstring& text,
+ const string16& text,
const gfx::Font& font,
const gfx::Rect& bounds,
const gfx::Rect& clip,
@@ -191,7 +191,7 @@ class DrawStringContext {
};
DrawStringContext::DrawStringContext(gfx::CanvasSkia* canvas,
- const std::wstring& text,
+ const string16& text,
const gfx::Font& font,
const gfx::Rect& bounds,
const gfx::Rect& clip,
@@ -211,8 +211,7 @@ DrawStringContext::DrawStringContext(gfx::CanvasSkia* canvas,
cr_ = canvas_->beginPlatformPaint();
layout_ = pango_cairo_create_layout(cr_);
- SetupPangoLayout(layout_, WideToUTF16Hack(text), font, bounds_.width(),
- flags_);
+ SetupPangoLayout(layout_, text, font, bounds_.width(), flags_);
pango_layout_set_height(layout_, bounds_.height() * PANGO_SCALE);
@@ -346,7 +345,7 @@ void CanvasSkia::SizeStringInt(const string16& text,
cairo_surface_destroy(surface);
}
-void CanvasSkia::DrawStringWithHalo(const std::wstring& text,
+void CanvasSkia::DrawStringWithHalo(const string16& text,
const gfx::Font& font,
const SkColor& text_color,
const SkColor& halo_color,
@@ -361,7 +360,7 @@ void CanvasSkia::DrawStringWithHalo(const std::wstring& text,
context.DrawWithHalo(text_color, halo_color);
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
diff --git a/gfx/canvas_skia_mac.mm b/gfx/canvas_skia_mac.mm
index 1c3dcca..fb30055 100644
--- a/gfx/canvas_skia_mac.mm
+++ b/gfx/canvas_skia_mac.mm
@@ -39,7 +39,7 @@ void CanvasSkia::SizeStringInt(const string16& text,
*height = font.GetHeight();
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
@@ -68,8 +68,8 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
nil];
NSAttributedString* ns_string =
- [[[NSAttributedString alloc] initWithString:base::SysWideToNSString(text)
- attributes:attributes] autorelease];
+ [[[NSAttributedString alloc] initWithString:base::SysUTF16ToNSString(text)
+ attributes:attributes] autorelease];
base::mac::ScopedCFTypeRef<CTFramesetterRef> framesetter(
CTFramesetterCreateWithAttributedString(
reinterpret_cast<CFAttributedStringRef>(ns_string)));
diff --git a/gfx/canvas_skia_win.cc b/gfx/canvas_skia_win.cc
index dd8c96a..03186fa 100644
--- a/gfx/canvas_skia_win.cc
+++ b/gfx/canvas_skia_win.cc
@@ -16,7 +16,7 @@ namespace {
// We make sure that LTR text we draw in an RTL context is modified
// appropriately to make sure it maintains it LTR orientation.
void DoDrawText(HDC hdc,
- const std::wstring& text,
+ const string16& text,
RECT* text_bounds,
int flags) {
// Only adjust string directionality if both of the following are true:
@@ -25,7 +25,7 @@ void DoDrawText(HDC hdc,
const wchar_t* string_ptr = text.c_str();
int string_size = static_cast<int>(text.length());
- std::wstring localized_text;
+ string16 localized_text;
if (flags & DT_RTLREADING) {
localized_text = text;
base::i18n::AdjustStringForLocaleDirection(&localized_text);
@@ -38,7 +38,7 @@ void DoDrawText(HDC hdc,
// Compute the windows flags necessary to implement the provided text Canvas
// flags.
-int ComputeFormatFlags(int flags, const std::wstring& text) {
+int ComputeFormatFlags(int flags, const string16& text) {
// Setting the text alignment explicitly in case it hasn't already been set.
// This will make sure that we don't align text to the left on RTL locales
// just because no alignment flag was passed to DrawStringInt().
@@ -139,7 +139,7 @@ CanvasSkia::~CanvasSkia() {
}
// static
-void CanvasSkia::SizeStringInt(const std::wstring& text,
+void CanvasSkia::SizeStringInt(const string16& text,
const gfx::Font& font,
int* width, int* height,
int flags) {
@@ -147,7 +147,7 @@ void CanvasSkia::SizeStringInt(const std::wstring& text,
// actually drawn, it will be clipped to whatever size box is provided, and
// the time to do that doesn't depend on the length being clipped off.
const int kMaxStringLength = 2048 - 1; // So the trailing \0 fits in 2K.
- std::wstring clamped_string(text.substr(0, kMaxStringLength));
+ string16 clamped_string(text.substr(0, kMaxStringLength));
if (*width == 0) {
// If multi-line + character break are on, the computed width will be one
@@ -177,7 +177,7 @@ void CanvasSkia::SizeStringInt(const std::wstring& text,
*height = r.bottom;
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
HFONT font,
const SkColor& color,
int x, int y, int w, int h,
@@ -190,7 +190,7 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
// length > 43680 (for which it draws nothing), and since we clamped to 2K in
// SizeStringInt() we're unlikely to be able to display this much anyway.
const int kMaxStringLength = 32768 - 1; // So the trailing \0 fits in 32K.
- std::wstring clamped_string(text.substr(0, kMaxStringLength));
+ string16 clamped_string(text.substr(0, kMaxStringLength));
RECT text_bounds = { x, y, x + w, y + h };
HDC dc = beginPlatformPaint();
@@ -214,7 +214,7 @@ void CanvasSkia::DrawStringInt(const std::wstring& text,
getTopPlatformDevice().makeOpaque(x, y, w, h);
}
-void CanvasSkia::DrawStringInt(const std::wstring& text,
+void CanvasSkia::DrawStringInt(const string16& text,
const gfx::Font& font,
const SkColor& color,
int x, int y, int w, int h,
@@ -250,7 +250,7 @@ static bool pixelShouldGetHalo(const SkBitmap& bitmap,
return false;
}
-void CanvasSkia::DrawStringWithHalo(const std::wstring& text,
+void CanvasSkia::DrawStringWithHalo(const string16& text,
const gfx::Font& font,
const SkColor& text_color,
const SkColor& halo_color_in,
diff --git a/gfx/font.cc b/gfx/font.cc
index 6897022..8b8241d 100644
--- a/gfx/font.cc
+++ b/gfx/font.cc
@@ -30,7 +30,7 @@ Font::Font(NativeFont native_font)
Font::Font(PlatformFont* platform_font) : platform_font_(platform_font) {
}
-Font::Font(const std::wstring& font_name, int font_size)
+Font::Font(const string16& font_name, int font_size)
: platform_font_(PlatformFont::CreateFromNameAndSize(font_name,
font_size)) {
}
@@ -70,7 +70,7 @@ int Font::GetStyle() const {
return platform_font_->GetStyle();
}
-const std::wstring& Font::GetFontName() const {
+string16 Font::GetFontName() const {
return platform_font_->GetFontName();
}
diff --git a/gfx/font.h b/gfx/font.h
index d0b16a4..eb6e4d5 100644
--- a/gfx/font.h
+++ b/gfx/font.h
@@ -43,7 +43,7 @@ class Font {
explicit Font(PlatformFont* platform_font);
// Creates a font with the specified name and size.
- Font(const std::wstring& font_name, int font_size);
+ Font(const string16& font_name, int font_size);
~Font();
@@ -85,7 +85,7 @@ class Font {
int GetStyle() const;
// Returns the font name.
- const std::wstring& GetFontName() const;
+ string16 GetFontName() const;
// Returns the font size in pixels.
int GetFontSize() const;
diff --git a/gfx/font_unittest.cc b/gfx/font_unittest.cc
index 3f26507..43eaa7c 100644
--- a/gfx/font_unittest.cc
+++ b/gfx/font_unittest.cc
@@ -46,35 +46,35 @@ int ScopedMinimumFontSizeCallback::minimum_size_ = 0;
TEST_F(FontTest, LoadArial) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
ASSERT_TRUE(cf.GetNativeFont());
ASSERT_EQ(cf.GetStyle(), Font::NORMAL);
ASSERT_EQ(cf.GetFontSize(), 16);
- ASSERT_EQ(cf.GetFontName(), L"Arial");
+ ASSERT_EQ(cf.GetFontName(), ASCIIToUTF16("Arial"));
}
TEST_F(FontTest, LoadArialBold) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
Font bold(cf.DeriveFont(0, Font::BOLD));
ASSERT_TRUE(bold.GetNativeFont());
ASSERT_EQ(bold.GetStyle(), Font::BOLD);
}
TEST_F(FontTest, Ascent) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
ASSERT_GT(cf.GetBaseline(), 2);
ASSERT_LE(cf.GetBaseline(), 22);
}
TEST_F(FontTest, Height) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
ASSERT_GE(cf.GetHeight(), 16);
// TODO(akalin): Figure out why height is so large on Linux.
ASSERT_LE(cf.GetHeight(), 26);
}
TEST_F(FontTest, AvgWidths) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
ASSERT_EQ(cf.GetExpectedTextWidth(0), 0);
ASSERT_GT(cf.GetExpectedTextWidth(1), cf.GetExpectedTextWidth(0));
ASSERT_GT(cf.GetExpectedTextWidth(2), cf.GetExpectedTextWidth(1));
@@ -82,7 +82,7 @@ TEST_F(FontTest, AvgWidths) {
}
TEST_F(FontTest, Widths) {
- Font cf(L"Arial", 16);
+ Font cf(ASCIIToUTF16("Arial"), 16);
ASSERT_EQ(cf.GetStringWidth(ASCIIToUTF16("")), 0);
ASSERT_GT(cf.GetStringWidth(ASCIIToUTF16("a")),
cf.GetStringWidth(ASCIIToUTF16("")));
diff --git a/gfx/platform_font.h b/gfx/platform_font.h
index 87900f3..412e260 100644
--- a/gfx/platform_font.h
+++ b/gfx/platform_font.h
@@ -22,7 +22,7 @@ class PlatformFont : public base::RefCounted<PlatformFont> {
static PlatformFont* CreateDefault();
static PlatformFont* CreateFromFont(const Font& other);
static PlatformFont* CreateFromNativeFont(NativeFont native_font);
- static PlatformFont* CreateFromNameAndSize(const std::wstring& font_name,
+ static PlatformFont* CreateFromNameAndSize(const string16& font_name,
int font_size);
// Returns a new Font derived from the existing font.
@@ -58,7 +58,7 @@ class PlatformFont : public base::RefCounted<PlatformFont> {
virtual int GetStyle() const = 0;
// Returns the font name.
- virtual const std::wstring& GetFontName() const = 0;
+ virtual string16 GetFontName() const = 0;
// Returns the font size in pixels.
virtual int GetFontSize() const = 0;
diff --git a/gfx/platform_font_gtk.cc b/gfx/platform_font_gtk.cc
index 3e038d7..61a0933 100644
--- a/gfx/platform_font_gtk.cc
+++ b/gfx/platform_font_gtk.cc
@@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/string_piece.h"
-#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "gfx/font.h"
@@ -67,7 +66,7 @@ PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc) {
// PGothic". In this case, SkTypeface for "Sans" returns NULL even if
// the system has a font for "Sans" font family. See FontMatch() in
// skia/ports/SkFontHost_fontconfig.cpp for more detail.
-std::wstring FindBestMatchFontFamilyName(const char* family_name) {
+string16 FindBestMatchFontFamilyName(const char* family_name) {
FcPattern* pattern = FcPatternCreate();
FcValue fcvalue;
fcvalue.type = FcTypeString;
@@ -82,7 +81,7 @@ std::wstring FindBestMatchFontFamilyName(const char* family_name) {
FcChar8* match_family;
FcPatternGetString(match, FC_FAMILY, 0, &match_family);
- std::wstring font_family = UTF8ToWide(reinterpret_cast<char*>(match_family));
+ string16 font_family = UTF8ToUTF16(reinterpret_cast<char*>(match_family));
FcPatternDestroy(match);
FcPatternDestroy(pattern);
free(family_name_copy);
@@ -141,7 +140,7 @@ PlatformFontGtk::PlatformFontGtk(NativeFont native_font) {
// Find best match font for |family_name| to make sure we can get
// a SkTypeface for the default font.
// TODO(agl): remove this.
- std::wstring font_family = FindBestMatchFontFamilyName(family_name);
+ string16 font_family = FindBestMatchFontFamilyName(family_name);
InitWithNameAndSize(font_family, size / PANGO_SCALE);
int style = 0;
@@ -158,7 +157,7 @@ PlatformFontGtk::PlatformFontGtk(NativeFont native_font) {
style_ = style;
}
-PlatformFontGtk::PlatformFontGtk(const std::wstring& font_name,
+PlatformFontGtk::PlatformFontGtk(const string16& font_name,
int font_size) {
InitWithNameAndSize(font_name, font_size);
}
@@ -197,7 +196,7 @@ Font PlatformFontGtk::DeriveFont(int size_delta, int style) const {
skstyle |= SkTypeface::kItalic;
SkTypeface* typeface = SkTypeface::CreateFromName(
- base::SysWideToUTF8(font_family_).c_str(),
+ UTF16ToUTF8(font_family_).c_str(),
static_cast<SkTypeface::Style>(skstyle));
SkAutoUnref tf_helper(typeface);
@@ -235,7 +234,7 @@ int PlatformFontGtk::GetStyle() const {
return style_;
}
-const std::wstring& PlatformFontGtk::GetFontName() const {
+string16 PlatformFontGtk::GetFontName() const {
return font_family_;
}
@@ -245,7 +244,7 @@ int PlatformFontGtk::GetFontSize() const {
NativeFont PlatformFontGtk::GetNativeFont() const {
PangoFontDescription* pfd = pango_font_description_new();
- pango_font_description_set_family(pfd, WideToUTF8(GetFontName()).c_str());
+ pango_font_description_set_family(pfd, UTF16ToUTF8(GetFontName()).c_str());
// Set the absolute size to avoid overflowing UI elements.
pango_font_description_set_absolute_size(pfd,
GetFontSize() * PANGO_SCALE * GetPangoScaleFactor());
@@ -273,7 +272,7 @@ NativeFont PlatformFontGtk::GetNativeFont() const {
// PlatformFontGtk, private:
PlatformFontGtk::PlatformFontGtk(SkTypeface* typeface,
- const std::wstring& name,
+ const string16& name,
int size,
int style) {
InitWithTypefaceNameSizeAndStyle(typeface, name, size, style);
@@ -281,22 +280,22 @@ PlatformFontGtk::PlatformFontGtk(SkTypeface* typeface,
PlatformFontGtk::~PlatformFontGtk() {}
-void PlatformFontGtk::InitWithNameAndSize(const std::wstring& font_name,
+void PlatformFontGtk::InitWithNameAndSize(const string16& font_name,
int font_size) {
DCHECK_GT(font_size, 0);
- std::wstring fallback;
+ string16 fallback;
SkTypeface* typeface = SkTypeface::CreateFromName(
- base::SysWideToUTF8(font_name).c_str(), SkTypeface::kNormal);
+ UTF16ToUTF8(font_name).c_str(), SkTypeface::kNormal);
if (!typeface) {
// A non-scalable font such as .pcf is specified. Falls back to a default
// scalable font.
typeface = SkTypeface::CreateFromName(
kFallbackFontFamilyName, SkTypeface::kNormal);
CHECK(typeface) << "Could not find any font: "
- << base::SysWideToUTF8(font_name)
+ << UTF16ToUTF8(font_name)
<< ", " << kFallbackFontFamilyName;
- fallback = base::SysUTF8ToWide(kFallbackFontFamilyName);
+ fallback = UTF8ToUTF16(kFallbackFontFamilyName);
}
SkAutoUnref typeface_helper(typeface);
@@ -308,7 +307,7 @@ void PlatformFontGtk::InitWithNameAndSize(const std::wstring& font_name,
void PlatformFontGtk::InitWithTypefaceNameSizeAndStyle(
SkTypeface* typeface,
- const std::wstring& font_family,
+ const string16& font_family,
int font_size,
int style) {
typeface_helper_.reset(new SkAutoUnref(typeface));
@@ -435,7 +434,7 @@ PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) {
}
// static
-PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name,
+PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name,
int font_size) {
return new PlatformFontGtk(font_name, font_size);
}
diff --git a/gfx/platform_font_gtk.h b/gfx/platform_font_gtk.h
index a7f3c21..fedbfc1 100644
--- a/gfx/platform_font_gtk.h
+++ b/gfx/platform_font_gtk.h
@@ -20,7 +20,7 @@ class PlatformFontGtk : public PlatformFont {
PlatformFontGtk();
explicit PlatformFontGtk(const Font& other);
explicit PlatformFontGtk(NativeFont native_font);
- PlatformFontGtk(const std::wstring& font_name,
+ PlatformFontGtk(const string16& font_name,
int font_size);
// Converts |gfx_font| to a new pango font. Free the returned font with
@@ -45,7 +45,7 @@ class PlatformFontGtk : public PlatformFont {
virtual int GetStringWidth(const string16& text) const;
virtual int GetExpectedTextWidth(int length) const;
virtual int GetStyle() const;
- virtual const std::wstring& GetFontName() const;
+ virtual string16 GetFontName() const;
virtual int GetFontSize() const;
virtual NativeFont GetNativeFont() const;
@@ -53,15 +53,15 @@ class PlatformFontGtk : public PlatformFont {
// Create a new instance of this object with the specified properties. Called
// from DeriveFont.
PlatformFontGtk(SkTypeface* typeface,
- const std::wstring& name,
+ const string16& name,
int size,
int style);
virtual ~PlatformFontGtk();
// Initialize this object.
- void InitWithNameAndSize(const std::wstring& font_name, int font_size);
+ void InitWithNameAndSize(const string16& font_name, int font_size);
void InitWithTypefaceNameSizeAndStyle(SkTypeface* typeface,
- const std::wstring& name,
+ const string16& name,
int size,
int style);
void InitFromPlatformFont(const PlatformFontGtk* other);
@@ -86,7 +86,7 @@ class PlatformFontGtk : public PlatformFont {
// Additional information about the face
// Skia actually expects a family name and not a font name.
- std::wstring font_family_;
+ string16 font_family_;
int font_size_;
int style_;
diff --git a/gfx/platform_font_mac.h b/gfx/platform_font_mac.h
index 11440ebb..62f44b6 100644
--- a/gfx/platform_font_mac.h
+++ b/gfx/platform_font_mac.h
@@ -15,7 +15,7 @@ class PlatformFontMac : public PlatformFont {
PlatformFontMac();
explicit PlatformFontMac(const Font& other);
explicit PlatformFontMac(NativeFont native_font);
- PlatformFontMac(const std::wstring& font_name,
+ PlatformFontMac(const string16& font_name,
int font_size);
// Overridden from PlatformFont:
@@ -26,23 +26,23 @@ class PlatformFontMac : public PlatformFont {
virtual int GetStringWidth(const string16& text) const;
virtual int GetExpectedTextWidth(int length) const;
virtual int GetStyle() const;
- virtual const std::wstring& GetFontName() const;
+ virtual string16 GetFontName() const;
virtual int GetFontSize() const;
virtual NativeFont GetNativeFont() const;
private:
- PlatformFontMac(const std::wstring& font_name, int font_size, int style);
+ PlatformFontMac(const string16& font_name, int font_size, int style);
virtual ~PlatformFontMac() {}
// Initialize the object with the specified parameters.
- void InitWithNameSizeAndStyle(const std::wstring& font_name,
+ void InitWithNameSizeAndStyle(const string16& font_name,
int font_size,
int style);
// Calculate and cache the font metrics.
void CalculateMetrics();
- std::wstring font_name_;
+ string16 font_name_;
int font_size_;
int style_;
diff --git a/gfx/platform_font_mac.mm b/gfx/platform_font_mac.mm
index 15d08f8..4aa9b88 100644
--- a/gfx/platform_font_mac.mm
+++ b/gfx/platform_font_mac.mm
@@ -22,7 +22,7 @@ PlatformFontMac::PlatformFontMac() {
font_size_ = [NSFont systemFontSize];
style_ = gfx::Font::NORMAL;
NSFont* system_font = [NSFont systemFontOfSize:font_size_];
- font_name_ = base::SysNSStringToWide([system_font fontName]);
+ font_name_ = base::SysNSStringToUTF16([system_font fontName]);
CalculateMetrics();
}
@@ -32,7 +32,7 @@ PlatformFontMac::PlatformFontMac(const Font& other) {
PlatformFontMac::PlatformFontMac(NativeFont native_font) {
}
-PlatformFontMac::PlatformFontMac(const std::wstring& font_name,
+PlatformFontMac::PlatformFontMac(const string16& font_name,
int font_size) {
InitWithNameSizeAndStyle(font_name, font_size, gfx::Font::NORMAL);
}
@@ -71,7 +71,7 @@ int PlatformFontMac::GetStyle() const {
return style_;
}
-const std::wstring& PlatformFontMac::GetFontName() const {
+string16 PlatformFontMac::GetFontName() const {
return font_name_;
}
@@ -83,20 +83,20 @@ NativeFont PlatformFontMac::GetNativeFont() const {
// TODO(pinkerton): apply |style_| to font. http://crbug.com/34667
// We could cache this, but then we'd have to conditionally change the
// dtor just for MacOS. Not sure if we want to/need to do that.
- return [NSFont fontWithName:base::SysWideToNSString(font_name_)
+ return [NSFont fontWithName:base::SysUTF16ToNSString(font_name_)
size:font_size_];
}
////////////////////////////////////////////////////////////////////////////////
// PlatformFontMac, private:
-PlatformFontMac::PlatformFontMac(const std::wstring& font_name,
+PlatformFontMac::PlatformFontMac(const string16& font_name,
int font_size,
int style) {
InitWithNameSizeAndStyle(font_name, font_size, style);
}
-void PlatformFontMac::InitWithNameSizeAndStyle(const std::wstring& font_name,
+void PlatformFontMac::InitWithNameSizeAndStyle(const string16& font_name,
int font_size,
int style) {
font_name_ = font_name;
@@ -134,7 +134,7 @@ PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) {
}
// static
-PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name,
+PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name,
int font_size) {
return new PlatformFontMac(font_name, font_size);
}
diff --git a/gfx/platform_font_win.cc b/gfx/platform_font_win.cc
index 34761c6..8071640 100644
--- a/gfx/platform_font_win.cc
+++ b/gfx/platform_font_win.cc
@@ -69,7 +69,7 @@ PlatformFontWin::PlatformFontWin(NativeFont native_font) {
InitWithCopyOfHFONT(native_font);
}
-PlatformFontWin::PlatformFontWin(const std::wstring& font_name,
+PlatformFontWin::PlatformFontWin(const string16& font_name,
int font_size) {
InitWithFontNameAndSize(font_name, font_size);
}
@@ -117,7 +117,7 @@ int PlatformFontWin::GetStyle() const {
return font_ref_->style();
}
-const std::wstring& PlatformFontWin::GetFontName() const {
+string16 PlatformFontWin::GetFontName() const {
return font_ref_->font_name();
}
@@ -150,7 +150,7 @@ void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) {
font_ref_ = CreateHFontRef(CreateFontIndirect(&font_info));
}
-void PlatformFontWin::InitWithFontNameAndSize(const std::wstring& font_name,
+void PlatformFontWin::InitWithFontNameAndSize(const string16& font_name,
int font_size) {
HDC hdc = GetDC(NULL);
long lf_height = -MulDiv(font_size, GetDeviceCaps(hdc, LOGPIXELSY), 72);
@@ -235,7 +235,7 @@ PlatformFontWin::HFontRef::HFontRef(HFONT hfont,
LOGFONT font_info;
GetObject(hfont_, sizeof(LOGFONT), &font_info);
- font_name_ = std::wstring(font_info.lfFaceName);
+ font_name_ = string16(font_info.lfFaceName);
}
PlatformFontWin::HFontRef::~HFontRef() {
@@ -261,7 +261,7 @@ PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) {
}
// static
-PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name,
+PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name,
int font_size) {
return new PlatformFontWin(font_name, font_size);
}
diff --git a/gfx/platform_font_win.h b/gfx/platform_font_win.h
index 0c310db..4adaa38 100644
--- a/gfx/platform_font_win.h
+++ b/gfx/platform_font_win.h
@@ -16,7 +16,7 @@ class PlatformFontWin : public PlatformFont {
PlatformFontWin();
explicit PlatformFontWin(const Font& other);
explicit PlatformFontWin(NativeFont native_font);
- PlatformFontWin(const std::wstring& font_name,
+ PlatformFontWin(const string16& font_name,
int font_size);
// Dialog units to pixels conversion.
@@ -48,7 +48,7 @@ class PlatformFontWin : public PlatformFont {
virtual int GetStringWidth(const string16& text) const;
virtual int GetExpectedTextWidth(int length) const;
virtual int GetStyle() const;
- virtual const std::wstring& GetFontName() const;
+ virtual string16 GetFontName() const;
virtual int GetFontSize() const;
virtual NativeFont GetNativeFont() const;
@@ -81,7 +81,7 @@ class PlatformFontWin : public PlatformFont {
int ave_char_width() const { return ave_char_width_; }
int style() const { return style_; }
int dlu_base_x() const { return dlu_base_x_; }
- const std::wstring& font_name() const { return font_name_; }
+ const string16& font_name() const { return font_name_; }
private:
friend class base::RefCounted<HFontRef>;
@@ -95,7 +95,7 @@ class PlatformFontWin : public PlatformFont {
const int style_;
// Constants used in converting dialog units to pixels.
const int dlu_base_x_;
- std::wstring font_name_;
+ string16 font_name_;
DISALLOW_COPY_AND_ASSIGN(HFontRef);
};
@@ -104,7 +104,7 @@ class PlatformFontWin : public PlatformFont {
void InitWithCopyOfHFONT(HFONT hfont);
// Initializes this object with the specified font name and size.
- void InitWithFontNameAndSize(const std::wstring& font_name,
+ void InitWithFontNameAndSize(const string16& font_name,
int font_size);
// Returns the base font ref. This should ONLY be invoked on the
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 63eeb0e..470d97c 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -360,7 +360,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
text_bounds.y(), text_bounds.width(), text_bounds.height(),
draw_string_flags);
#else
- canvas->DrawStringInt(UTF16ToWideHack(text_),
+ canvas->DrawStringInt(text_,
font_,
text_color,
text_bounds.x(),
@@ -371,11 +371,11 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
#endif
} else if (has_text_halo_) {
canvas->AsCanvasSkia()->DrawStringWithHalo(
- UTF16ToWideHack(text_), font_, text_color, text_halo_color_,
+ text_, font_, text_color, text_halo_color_,
text_bounds.x(), text_bounds.y(), text_bounds.width(),
text_bounds.height(), draw_string_flags);
} else {
- canvas->DrawStringInt(UTF16ToWideHack(text_),
+ canvas->DrawStringInt(text_,
font_,
text_color,
text_bounds.x(),
diff --git a/views/controls/label.cc b/views/controls/label.cc
index d4bf9f7..8692622 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -271,7 +271,7 @@ void Label::PaintText(gfx::Canvas* canvas,
const std::wstring& text,
const gfx::Rect& text_bounds,
int flags) {
- canvas->DrawStringInt(text, font_, color_,
+ canvas->DrawStringInt(WideToUTF16Hack(text), font_, color_,
text_bounds.x(), text_bounds.y(),
text_bounds.width(), text_bounds.height(), flags);
diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc
index 267d260..504861e 100644
--- a/views/controls/label_unittest.cc
+++ b/views/controls/label_unittest.cc
@@ -15,22 +15,22 @@ namespace views {
// All text sizing measurements (width and height) should be greater than this.
const int kMinTextDimension = 4;
-#if defined(WIN_OS)
+#if defined(OS_WIN)
// Courier is failing on linux because it's non scalable.
TEST(LabelTest, FontPropertyCourier) {
Label label;
- std::wstring font_name(L"courier");
- gfx::Font font = gfx::Font::CreateFont(font_name, 30);
+ string16 font_name(ASCIIToUTF16("courier"));
+ gfx::Font font(font_name, 30);
label.SetFont(font);
gfx::Font font_used = label.font();
- EXPECT_EQ(font_name, font_used.FontName());
- EXPECT_EQ(30, font_used.FontSize());
+ EXPECT_EQ(font_name, font_used.GetFontName());
+ EXPECT_EQ(30, font_used.GetFontSize());
}
#endif
TEST(LabelTest, FontPropertyArial) {
Label label;
- std::wstring font_name(L"arial");
+ string16 font_name(ASCIIToUTF16("arial"));
gfx::Font font(font_name, 30);
label.SetFont(font);
gfx::Font font_used = label.font();
@@ -214,7 +214,7 @@ TEST(LabelTest, MultiLineSizing) {
// SizeToFit with limited width.
label.SizeToFit(required_width - 1);
int constrained_width = label.GetLocalBounds(true).width();
-#if defined(WIN_OS)
+#if defined(OS_WIN)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_LT(constrained_width, required_width);
@@ -229,7 +229,7 @@ TEST(LabelTest, MultiLineSizing) {
int required_height = label.GetHeightForWidth(required_width);
EXPECT_GT(required_height, kMinTextDimension);
int height_for_constrained_width = label.GetHeightForWidth(constrained_width);
-#if defined(WIN_OS)
+#if defined(OS_WIN)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_GT(height_for_constrained_width, required_height);
@@ -261,7 +261,7 @@ TEST(LabelTest, MultiLineSizing) {
// calculation. If it is, then the height will grow when width
// is shrunk.
int height1 = label.GetHeightForWidth(required_width_with_border - 1);
-#if defined(WIN_OS)
+#if defined(OS_WIN)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_GT(height1, required_height_with_border);
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index e2359d7..8d2b84d 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -613,7 +613,7 @@ void MenuItemView::PaintAccelerator(gfx::Canvas* canvas) {
else
flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
canvas->DrawStringInt(
- UTF16ToWideHack(accel_text), font, TextButton::kDisabledColor,
+ accel_text, font, TextButton::kDisabledColor,
accel_bounds.x(), accel_bounds.y(), accel_bounds.width(),
accel_bounds.height(), flags);
}
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index ab4c5315..8c1d1ee 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -91,7 +91,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
(available_height - font.GetHeight()) / 2, width,
font.GetHeight());
text_bounds.set_x(MirroredLeftPointForRect(text_bounds));
- canvas->DrawStringInt(GetTitle(), font, fg_color,
+ canvas->DrawStringInt(WideToUTF16Hack(GetTitle()), font, fg_color,
text_bounds.x(), text_bounds.y(), text_bounds.width(),
text_bounds.height(),
GetRootMenuItem()->GetDrawStringFlags());
diff --git a/views/controls/textfield/gtk_views_entry.cc b/views/controls/textfield/gtk_views_entry.cc
index c8e03ce..9a2628b 100644
--- a/views/controls/textfield/gtk_views_entry.cc
+++ b/views/controls/textfield/gtk_views_entry.cc
@@ -45,7 +45,7 @@ static gint gtk_views_entry_expose_event(GtkWidget *widget,
gfx::Font font = host->textfield()->font();
const string16 text = host->textfield()->text_to_display_when_empty();
canvas.DrawStringInt(
- UTF16ToWide(text), font,
+ text, font,
gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
insets.left(), insets.top(),
widget->allocation.width - insets.width(), font.GetHeight());
diff --git a/views/controls/textfield/gtk_views_textview.cc b/views/controls/textfield/gtk_views_textview.cc
index b7ec107..a2cc19f 100644
--- a/views/controls/textfield/gtk_views_textview.cc
+++ b/views/controls/textfield/gtk_views_textview.cc
@@ -50,7 +50,7 @@ static gint gtk_views_textview_expose_event(GtkWidget *widget,
gfx::Font font = host->textfield()->font();
const string16 text = host->textfield()->text_to_display_when_empty();
canvas.DrawStringInt(
- UTF16ToWide(text), font,
+ text, font,
gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
insets.left(), insets.top(),
widget->allocation.width - insets.width(), font.GetHeight());
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index 923de0c..ceb5325 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -404,13 +404,11 @@ void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
if ((*iter).selected) {
canvas->FillRectInt(selection_color, x_offset, y, width, text_height);
- canvas->DrawStringInt(
- UTF16ToWide(text), GetFont(), kSelectedTextColor,
- x_offset, y, width, text_height);
+ canvas->DrawStringInt(text, GetFont(), kSelectedTextColor,
+ x_offset, y, width, text_height);
} else {
- canvas->DrawStringInt(
- UTF16ToWide(text), GetFont(), text_color,
- x_offset, y, width, text_height);
+ canvas->DrawStringInt(text, GetFont(), text_color,
+ x_offset, y, width, text_height);
}
x_offset += width;
}
diff --git a/views/drag_utils.cc b/views/drag_utils.cc
index 8c00edf..d249196 100644
--- a/views/drag_utils.cc
+++ b/views/drag_utils.cc
@@ -80,7 +80,7 @@ void CreateDragImageForFile(const FilePath& file_name,
width - 2, font.GetHeight(),
gfx::Canvas::TEXT_ALIGN_CENTER);
#else
- canvas.DrawStringInt(name, font, kFileDragImageTextColor,
+ canvas.DrawStringInt(WideToUTF16Hack(name), font, kFileDragImageTextColor,
0, icon->height() + kLinkDragImageVPadding,
width, font.GetHeight(), gfx::Canvas::TEXT_ALIGN_CENTER);
#endif
diff --git a/views/view_text_utils.cc b/views/view_text_utils.cc
index 8f13617..70cb8b9 100644
--- a/views/view_text_utils.cc
+++ b/views/view_text_utils.cc
@@ -110,14 +110,14 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
// iterate to the next line breaking opportunity.
while (iter.Advance()) {
// Get the word and figure out the dimensions.
- std::wstring word;
+ string16 word;
if (!ltr_within_rtl)
- word = UTF16ToWide(iter.GetString()); // Get the next word.
+ word = iter.GetString(); // Get the next word.
else
- word = text; // Draw the whole text at once.
+ word = text16; // Draw the whole text at once.
- int w = font.GetStringWidth(WideToUTF16Hack(word)), h = font.GetHeight();
- gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(word), font, &w, &h, flags);
+ int w = font.GetStringWidth(word), h = font.GetHeight();
+ gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags);
// If we exceed the boundaries, we need to wrap.
WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds);
@@ -129,7 +129,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
// When drawing LTR strings inside RTL text we need to make sure we
// draw the trailing space (if one exists after the LTR text) to the
// left of the LTR string.
- if (ltr_within_rtl && word[word.size() - 1] == L' ') {
+ if (ltr_within_rtl && word[word.size() - 1] == ' ') {
int space_w = font.GetStringWidth(ASCIIToUTF16(" "));
int space_h = font.GetHeight();
gfx::CanvasSkia::SizeStringInt(ASCIIToUTF16(" "), font, &space_w,
@@ -143,7 +143,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
canvas->DrawStringInt(word, font, text_color, x, y, w, font.GetHeight(),
flags);
- if (word.size() > 0 && word[word.size() - 1] == L'\x0a') {
+ if (word.size() > 0 && word[word.size() - 1] == '\x0a') {
// When we come across '\n', we move to the beginning of the next line.
position->set_width(0);
position->Enlarge(0, font.GetHeight());
diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc
index b43b678..c2d8599 100644
--- a/views/window/custom_frame_view.cc
+++ b/views/window/custom_frame_view.cc
@@ -413,9 +413,10 @@ void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) {
if (!d)
return;
- canvas->DrawStringInt(d->GetWindowTitle(), *title_font_, SK_ColorWHITE,
- MirroredLeftPointForRect(title_bounds_), title_bounds_.y(),
- title_bounds_.width(), title_bounds_.height());
+ canvas->DrawStringInt(WideToUTF16Hack(d->GetWindowTitle()), *title_font_,
+ SK_ColorWHITE, MirroredLeftPointForRect(title_bounds_),
+ title_bounds_.y(), title_bounds_.width(),
+ title_bounds_.height());
}
void CustomFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {