summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 00:33:29 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 00:33:29 +0000
commitdda5dfa3324361971ab5acd8b9924dce57449505 (patch)
treef1dd1d1c58912b0ca9ff14aba23547d95ad3f5ec /chrome
parentf33556067626eb640336f13bbd166e28a5f2fb10 (diff)
downloadchromium_src-dda5dfa3324361971ab5acd8b9924dce57449505.zip
chromium_src-dda5dfa3324361971ab5acd8b9924dce57449505.tar.gz
chromium_src-dda5dfa3324361971ab5acd8b9924dce57449505.tar.bz2
Convert some stuff to string16 so the toolkit_views build can build again
Review URL: http://codereview.chromium.org/155334 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20342 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc14
-rw-r--r--chrome/browser/browser.h4
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc4
-rwxr-xr-xchrome/browser/gtk/tabs/tab_renderer_gtk.cc16
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.h3
-rw-r--r--chrome/browser/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/views/tabs/tab_2.cc10
-rw-r--r--chrome/browser/views/tabs/tab_renderer.cc16
-rw-r--r--chrome/browser/views/tabs/tab_renderer.h3
9 files changed, 37 insertions, 35 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 157fa09..3a294e5 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -431,18 +431,18 @@ SkBitmap Browser::GetCurrentPageIcon() const {
return contents ? contents->GetFavIcon() : SkBitmap();
}
-std::wstring Browser::GetCurrentPageTitle() const {
+string16 Browser::GetCurrentPageTitle() const {
TabContents* contents = tabstrip_model_.GetSelectedTabContents();
- std::wstring title;
+ string16 title;
// |contents| can be NULL because GetCurrentPageTitle is called by the window
// during the window's creation (before tabs have been added).
if (contents) {
- title = UTF16ToWideHack(contents->GetTitle());
+ title = contents->GetTitle();
FormatTitleForDisplay(&title);
}
if (title.empty())
- title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
// On Mac, we don't want to suffix the page title with the application name.
@@ -453,17 +453,17 @@ std::wstring Browser::GetCurrentPageTitle() const {
// distributor logo for the frame.
if (!ShouldShowDistributorLogo())
string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO;
- return l10n_util::GetStringF(string_id, title);
+ return l10n_util::GetStringFUTF16(string_id, title);
#endif
}
// static
-void Browser::FormatTitleForDisplay(std::wstring* title) {
+void Browser::FormatTitleForDisplay(string16* title) {
size_t current_index = 0;
size_t match_index;
while ((match_index = title->find(L'\n', current_index)) !=
std::wstring::npos) {
- title->replace(match_index, 1, L"");
+ title->replace(match_index, 1, EmptyString16());
current_index = match_index;
}
}
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index d570804..4d84df7 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -163,10 +163,10 @@ class Browser : public TabStripModelDelegate,
SkBitmap GetCurrentPageIcon() const;
// Gets the title of the page in the selected tab.
- std::wstring GetCurrentPageTitle() const;
+ string16 GetCurrentPageTitle() const;
// Prepares a title string for display (removes embedded newlines, etc).
- static void FormatTitleForDisplay(std::wstring* title);
+ static void FormatTitleForDisplay(string16* title);
// Returns true if the frame should show a distributor logo for this Browser.
bool ShouldShowDistributorLogo() const;
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index a7d3e01..b32db90 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -578,8 +578,8 @@ void BrowserWindowGtk::UpdateTitleBar() {
panel_controller_->UpdateTitleBar();
#endif
- std::wstring title = browser_->GetCurrentPageTitle();
- gtk_window_set_title(window_, WideToUTF8(title).c_str());
+ string16 title = browser_->GetCurrentPageTitle();
+ gtk_window_set_title(window_, UTF16ToUTF8(title).c_str());
if (ShouldShowWindowIcon()) {
// TODO(tc): If we're showing a title bar, we should update the app icon.
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index e42f7a3..78ddcc4 100755
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -196,7 +196,7 @@ TabRendererGtk::~TabRendererGtk() {
void TabRendererGtk::UpdateData(TabContents* contents, bool loading_only) {
DCHECK(contents);
if (!loading_only) {
- data_.title = UTF16ToWideHack(contents->GetTitle());
+ data_.title = contents->GetTitle();
data_.off_the_record = contents->profile()->IsOffTheRecord();
data_.crashed = contents->is_crashed();
data_.favicon = contents->GetFavIcon();
@@ -322,7 +322,7 @@ void TabRendererGtk::SetBounds(const gfx::Rect& bounds) {
// TabRendererGtk, protected:
std::wstring TabRendererGtk::GetTitle() const {
- return data_.title;
+ return UTF16ToWideHack(data_.title);
}
///////////////////////////////////////////////////////////////////////////////
@@ -420,12 +420,12 @@ void TabRendererGtk::Paint(gfx::Canvas* canvas) {
}
// Paint the Title.
- std::wstring title = data_.title;
+ string16 title = data_.title;
if (title.empty()) {
if (data_.loading) {
- title = l10n_util::GetString(IDS_TAB_LOADING_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE);
} else {
- title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
}
} else {
Browser::FormatTitleForDisplay(&title);
@@ -433,9 +433,9 @@ void TabRendererGtk::Paint(gfx::Canvas* canvas) {
SkColor title_color = IsSelected() ? selected_title_color_
: unselected_title_color_;
- canvas->DrawStringInt(title, *title_font_, title_color, title_bounds_.x(),
- title_bounds_.y(), title_bounds_.width(),
- title_bounds_.height());
+ canvas->DrawStringInt(UTF16ToWideHack(title), *title_font_, title_color,
+ title_bounds_.x(), title_bounds_.y(),
+ title_bounds_.width(), title_bounds_.height());
}
SkBitmap TabRendererGtk::PaintBitmap() {
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index 4b38df0..ac6a5ce 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -13,6 +13,7 @@
#include "app/slide_animation.h"
#include "base/basictypes.h"
#include "base/gfx/rect.h"
+#include "base/string16.h"
#include "chrome/common/owned_widget_gtk.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -160,7 +161,7 @@ class TabRendererGtk : public AnimationDelegate {
// corresponding objects in the underlying model.
struct TabData {
SkBitmap favicon;
- std::wstring title;
+ string16 title;
bool loading;
bool crashed;
bool off_the_record;
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 6f6391c..937a79a5 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1112,7 +1112,7 @@ bool BrowserView::IsModal() const {
}
std::wstring BrowserView::GetWindowTitle() const {
- return browser_->GetCurrentPageTitle();
+ return UTF16ToWideHack(browser_->GetCurrentPageTitle());
}
views::View* BrowserView::GetInitiallyFocusedView() {
diff --git a/chrome/browser/views/tabs/tab_2.cc b/chrome/browser/views/tabs/tab_2.cc
index 0047cae..14a8188 100644
--- a/chrome/browser/views/tabs/tab_2.cc
+++ b/chrome/browser/views/tabs/tab_2.cc
@@ -460,9 +460,9 @@ void Tab2::PaintTitle(gfx::Canvas* canvas) {
string16 title = model_->GetTitle(this);
if (title.empty()) {
if (model_->IsLoading(this))
- title = l10n_util::GetString(IDS_TAB_LOADING_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE);
else
- title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
} else {
Browser::FormatTitleForDisplay(&title);
}
@@ -472,9 +472,9 @@ void Tab2::PaintTitle(gfx::Canvas* canvas) {
BrowserThemeProvider::COLOR_TAB_TEXT :
BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT);
- canvas->DrawStringInt(title, *title_font, title_color, title_bounds_.x(),
- title_bounds_.y(), title_bounds_.width(),
- title_bounds_.height());
+ canvas->DrawStringInt(UTF16ToWideHack(title), *title_font, title_color,
+ title_bounds_.x(), title_bounds_.y(),
+ title_bounds_.width(), title_bounds_.height());
}
void Tab2::PaintTabBackground(gfx::Canvas* canvas) {
diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc
index 5481387..47d139b 100644
--- a/chrome/browser/views/tabs/tab_renderer.cc
+++ b/chrome/browser/views/tabs/tab_renderer.cc
@@ -276,7 +276,7 @@ ThemeProvider* TabRenderer::GetThemeProvider() {
void TabRenderer::UpdateData(TabContents* contents, bool loading_only) {
DCHECK(contents);
if (!loading_only) {
- data_.title = UTF16ToWideHack(contents->GetTitle());
+ data_.title = contents->GetTitle();
data_.off_the_record = contents->profile()->IsOffTheRecord();
data_.crashed = contents->is_crashed();
data_.favicon = contents->GetFavIcon();
@@ -377,7 +377,7 @@ gfx::Size TabRenderer::GetStandardSize() {
// TabRenderer, protected:
std::wstring TabRenderer::GetTitle() const {
- return data_.title;
+ return UTF16ToWideHack(data_.title);
}
////////////////////////////////////////////////////////////////////////////////
@@ -432,12 +432,12 @@ void TabRenderer::Paint(gfx::Canvas* canvas) {
}
// Paint the Title.
- std::wstring title = data_.title;
+ string16 title = data_.title;
if (title.empty()) {
if (data_.loading) {
- title = l10n_util::GetString(IDS_TAB_LOADING_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE);
} else {
- title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
+ title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
}
} else {
Browser::FormatTitleForDisplay(&title);
@@ -448,9 +448,9 @@ void TabRenderer::Paint(gfx::Canvas* canvas) {
BrowserThemeProvider::COLOR_TAB_TEXT :
BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT);
- canvas->DrawStringInt(title, *title_font, title_color, title_bounds_.x(),
- title_bounds_.y(), title_bounds_.width(),
- title_bounds_.height());
+ canvas->DrawStringInt(UTF16ToWideHack(title), *title_font, title_color,
+ title_bounds_.x(), title_bounds_.y(),
+ title_bounds_.width(), title_bounds_.height());
}
void TabRenderer::Layout() {
diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h
index d265b53..8042acc 100644
--- a/chrome/browser/views/tabs/tab_renderer.h
+++ b/chrome/browser/views/tabs/tab_renderer.h
@@ -9,6 +9,7 @@
#include "app/slide_animation.h"
#include "app/throb_animation.h"
#include "base/gfx/point.h"
+#include "base/string16.h"
#include "views/controls/button/image_button.h"
#include "views/view.h"
@@ -165,7 +166,7 @@ class TabRenderer : public views::View,
// corresponding objects in the underlying model.
struct TabData {
SkBitmap favicon;
- std::wstring title;
+ string16 title;
bool loading;
bool crashed;
bool off_the_record;