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

Unified Diff: chrome/browser/ui/views/about_chrome_view.cc

Issue 8142026: Revert 104076 - Change std::wstring to string16 for views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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/ui/views/about_chrome_view.cc
===================================================================
--- chrome/browser/ui/views/about_chrome_view.cc (revision 104083)
+++ chrome/browser/ui/views/about_chrome_view.cc (working copy)
@@ -52,19 +52,20 @@
namespace {
// These are used as placeholder text around the links in the text in the about
// dialog.
-const string16 kBeginLink(ASCIIToUTF16("BEGIN_LINK"));
-const string16 kEndLink(ASCIIToUTF16("END_LINK"));
-const string16 kBeginLinkChr(ASCIIToUTF16("BEGIN_LINK_CHR"));
-const string16 kBeginLinkOss(ASCIIToUTF16("BEGIN_LINK_OSS"));
-const string16 kEndLinkChr(ASCIIToUTF16("END_LINK_CHR"));
-const string16 kEndLinkOss(ASCIIToUTF16("END_LINK_OSS"));
+const wchar_t* kBeginLink = L"BEGIN_LINK";
+const wchar_t* kEndLink = L"END_LINK";
+const wchar_t* kBeginLinkChr = L"BEGIN_LINK_CHR";
+const wchar_t* kBeginLinkOss = L"BEGIN_LINK_OSS";
+const wchar_t* kEndLinkChr = L"END_LINK_CHR";
+const wchar_t* kEndLinkOss = L"END_LINK_OSS";
// The background bitmap used to draw the background color for the About box
// and the separator line (this is the image we will draw the logo on top of).
static const SkBitmap* kBackgroundBmp = NULL;
// Returns a substring from |text| between start and end.
-string16 StringSubRange(const string16& text, size_t start, size_t end) {
+std::wstring StringSubRange(const std::wstring& text, size_t start,
+ size_t end) {
DCHECK(end > start);
return text.substr(start, end - start);
}
@@ -163,7 +164,7 @@
// Add the dialog labels.
about_title_label_ = new views::Label(
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::BaseFont).DeriveFont(18));
about_title_label_->SetColor(SK_ColorBLACK);
@@ -183,14 +184,15 @@
// The copyright URL portion of the main label.
copyright_label_ = new views::Label(
- l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT)));
copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(copyright_label_);
- main_text_label_ = new views::Label(string16());
+ main_text_label_ = new views::Label(L"");
// Figure out what to write in the main label of the About box.
- string16 text = l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE);
+ std::wstring text =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE));
chromium_url_appears_first_ =
text.find(kBeginLinkChr) < text.find(kBeginLinkOss);
@@ -205,20 +207,20 @@
DCHECK(link1_end != std::wstring::npos);
main_label_chunk1_ = text.substr(0, link1);
- main_label_chunk2_ = StringSubRange(text, link1_end + kEndLinkOss.size(),
+ main_label_chunk2_ = StringSubRange(text, link1_end + wcslen(kEndLinkOss),
link2);
- main_label_chunk3_ = text.substr(link2_end + kEndLinkOss.size());
+ main_label_chunk3_ = text.substr(link2_end + wcslen(kEndLinkOss));
// The Chromium link within the main text of the dialog.
chromium_url_ = new views::Link(
- StringSubRange(text, text.find(kBeginLinkChr) + kBeginLinkChr.size(),
+ StringSubRange(text, text.find(kBeginLinkChr) + wcslen(kBeginLinkChr),
text.find(kEndLinkChr)));
AddChildView(chromium_url_);
chromium_url_->set_listener(this);
// The Open Source link within the main text of the dialog.
open_source_url_ = new views::Link(
- StringSubRange(text, text.find(kBeginLinkOss) + kBeginLinkOss.size(),
+ StringSubRange(text, text.find(kBeginLinkOss) + wcslen(kBeginLinkOss),
text.find(kEndLinkOss)));
AddChildView(open_source_url_);
open_source_url_->set_listener(this);
@@ -226,9 +228,9 @@
// Add together all the strings in the dialog for the purpose of calculating
// the height of the dialog. The space for the Terms of Service string is not
// included (it is added later, if needed).
- string16 full_text = main_label_chunk1_ + chromium_url_->GetText() +
- main_label_chunk2_ + open_source_url_->GetText() +
- main_label_chunk3_;
+ std::wstring full_text = main_label_chunk1_ + chromium_url_->GetText() +
+ main_label_chunk2_ + open_source_url_->GetText() +
+ main_label_chunk3_;
dialog_dimensions_ = views::Widget::GetLocalizedContentsSize(
IDS_ABOUT_DIALOG_WIDTH_CHARS,
@@ -404,16 +406,16 @@
gfx::Size position;
// Draw the first text chunk and position the Chromium url.
view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_,
- UTF16ToWideHack(main_label_chunk1_), link1, rect1, &position,
- text_direction_is_rtl_, label_bounds, font);
+ main_label_chunk1_, link1, rect1, &position, text_direction_is_rtl_,
+ label_bounds, font);
// Draw the second text chunk and position the Open Source url.
view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_,
- UTF16ToWideHack(main_label_chunk2_), link2, rect2, &position,
- text_direction_is_rtl_, label_bounds, font);
+ main_label_chunk2_, link2, rect2, &position, text_direction_is_rtl_,
+ label_bounds, font);
// Draw the third text chunk (which has no URL associated with it).
view_text_utils::DrawTextAndPositionUrl(canvas, main_text_label_,
- UTF16ToWideHack(main_label_chunk3_), NULL, NULL, &position,
- text_direction_is_rtl_, label_bounds, font);
+ main_label_chunk3_, NULL, NULL, &position, text_direction_is_rtl_,
+ label_bounds, font);
#if defined(GOOGLE_CHROME_BUILD)
// Insert a line break and some whitespace.
@@ -697,11 +699,11 @@
UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error"));
restart_button_visible_ = false;
if (error_code != GOOGLE_UPDATE_DISABLED_BY_POLICY) {
- update_label_.SetText(
- l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code));
+ update_label_.SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code)));
} else {
- update_label_.SetText(
- l10n_util::GetStringUTF16(IDS_UPGRADE_DISABLED_BY_POLICY));
+ update_label_.SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_UPGRADE_DISABLED_BY_POLICY)));
}
show_timeout_indicator = true;
break;
« no previous file with comments | « chrome/browser/ui/views/about_chrome_view.h ('k') | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698