summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 23:00:42 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 23:00:42 +0000
commit84a761ee5394832fe52e3bba7e158d94254d3709 (patch)
tree2adb2981f3c8899c34c81b773a92e165321e623a /chrome/browser/gtk
parent05f0f9d02bf3c8124f68abd3446c9a981ec51913 (diff)
downloadchromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.zip
chromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.tar.gz
chromium_src-84a761ee5394832fe52e3bba7e158d94254d3709.tar.bz2
Convert ElideFilename from using wstring to string16.
Some small cleanups of wstring::npos usage. BUG=23581 Review URL: http://codereview.chromium.org/3390035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc20
-rw-r--r--chrome/browser/gtk/edit_search_engine_dialog.cc6
-rw-r--r--chrome/browser/gtk/infobar_gtk.cc4
3 files changed, 16 insertions, 14 deletions
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 02edbad..536d2b4 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -503,10 +503,11 @@ void DownloadItemGtk::LoadIcon() {
}
void DownloadItemGtk::UpdateTooltip() {
- std::wstring elided_filename = gfx::ElideFilename(
+ string16 elided_filename = gfx::ElideFilename(
get_download()->GetFileName(),
gfx::Font(), kTooltipMaxWidth);
- gtk_widget_set_tooltip_text(body_.get(), WideToUTF8(elided_filename).c_str());
+ gtk_widget_set_tooltip_text(body_.get(),
+ UTF16ToUTF8(elided_filename).c_str());
}
void DownloadItemGtk::UpdateNameLabel() {
@@ -514,7 +515,7 @@ void DownloadItemGtk::UpdateNameLabel() {
// use gfx::Font() to draw the text. This is why we need to add so
// much padding when we set the size request. We need to either use gfx::Font
// or somehow extend TextElider.
- std::wstring elided_filename = gfx::ElideFilename(
+ string16 elided_filename = gfx::ElideFilename(
get_download()->GetFileName(),
gfx::Font(), kTextWidth);
@@ -523,7 +524,7 @@ void DownloadItemGtk::UpdateNameLabel() {
gtk_util::SetLabelColor(name_label_, theme_provider_->UseGtkTheme() ?
NULL : &color);
gtk_label_set_text(GTK_LABEL(name_label_),
- WideToUTF8(elided_filename).c_str());
+ UTF16ToUTF8(elided_filename).c_str());
}
void DownloadItemGtk::UpdateStatusLabel(const std::string& status_text) {
@@ -560,16 +561,17 @@ void DownloadItemGtk::UpdateDangerWarning() {
if (dangerous_prompt_) {
// We create |dangerous_warning| as a wide string so we can more easily
// calculate its length in characters.
- std::wstring dangerous_warning;
+ string16 dangerous_warning;
if (get_download()->is_extension_install()) {
dangerous_warning =
- l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
+ l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
} else {
- std::wstring elided_filename = gfx::ElideFilename(
+ string16 elided_filename = gfx::ElideFilename(
get_download()->original_name(), gfx::Font(), kTextWidth);
dangerous_warning =
- l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, elided_filename);
+ l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD,
+ elided_filename);
}
if (theme_provider_->UseGtkTheme()) {
@@ -589,7 +591,7 @@ void DownloadItemGtk::UpdateDangerWarning() {
}
gtk_label_set_text(GTK_LABEL(dangerous_label_),
- WideToUTF8(dangerous_warning).c_str());
+ UTF16ToUTF8(dangerous_warning).c_str());
// Until we switch to vector graphics, force the font size.
gtk_util::ForceFontSizePixels(dangerous_label_, kTextSize);
diff --git a/chrome/browser/gtk/edit_search_engine_dialog.cc b/chrome/browser/gtk/edit_search_engine_dialog.cc
index 52c3346..3c4c58a 100644
--- a/chrome/browser/gtk/edit_search_engine_dialog.cc
+++ b/chrome/browser/gtk/edit_search_engine_dialog.cc
@@ -206,12 +206,12 @@ void EditSearchEngineDialog::Init(GtkWindow* parent_window, Profile* profile) {
l10n_util::GetStringUTF8(IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL);
if (base::i18n::IsRTL()) {
const std::string reversed_percent("s%");
- std::wstring::size_type percent_index =
- description.find("%s", static_cast<std::string::size_type>(0));
- if (percent_index != std::string::npos)
+ std::string::size_type percent_index = description.find("%s");
+ if (percent_index != std::string::npos) {
description.replace(percent_index,
reversed_percent.length(),
reversed_percent);
+ }
}
GtkWidget* description_label = gtk_label_new(description.c_str());
diff --git a/chrome/browser/gtk/infobar_gtk.cc b/chrome/browser/gtk/infobar_gtk.cc
index cef8157..b14b00d 100644
--- a/chrome/browser/gtk/infobar_gtk.cc
+++ b/chrome/browser/gtk/infobar_gtk.cc
@@ -151,7 +151,7 @@ void InfoBar::AddLabelAndLink(const string16& display_text,
GtkWidget* link_button = NULL;
if (link_text.empty()) {
// No link text, so skip creating the link and splitting display_text.
- link_offset = std::wstring::npos;
+ link_offset = string16::npos;
} else {
// If we have some link text, create the link button.
link_button = gtk_chrome_link_button_new(UTF16ToUTF8(link_text).c_str());
@@ -170,7 +170,7 @@ void InfoBar::AddLabelAndLink(const string16& display_text,
// If link_offset is npos, we right-align the link instead of embedding it
// in the text.
- if (link_offset == std::wstring::npos) {
+ if (link_offset == string16::npos) {
if (link_button)
gtk_box_pack_end(GTK_BOX(hbox), link_button, FALSE, FALSE, 0);
GtkWidget* label = gtk_label_new(UTF16ToUTF8(display_text).c_str());