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

Unified Diff: chrome/browser/views/infobars/translate_infobars.cc

Issue 597042: Translate: Move label parsing logic into common code. (Closed)
Patch Set: Fix indentation. Created 10 years, 10 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
« no previous file with comments | « chrome/browser/translate/translate_infobars_delegates.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/infobars/translate_infobars.cc
diff --git a/chrome/browser/views/infobars/translate_infobars.cc b/chrome/browser/views/infobars/translate_infobars.cc
index 9c2c17566e0e3fea4bd0c9682602a1c46472b81f..d9660d2d220f5a6bc11997d8e5a14a53e504ddf1 100644
--- a/chrome/browser/views/infobars/translate_infobars.cc
+++ b/chrome/browser/views/infobars/translate_infobars.cc
@@ -623,24 +623,11 @@ void TranslateInfoBar::Observe(NotificationType type,
void TranslateInfoBar::CreateLabels() {
// Determine text for labels.
std::vector<size_t> offsets;
- std::wstring message_text = l10n_util::GetStringF(
- (GetDelegate()->state() == TranslateInfoBarDelegate::kAfterTranslate ?
- IDS_TRANSLATE_INFOBAR_AFTER_MESSAGE :
- IDS_TRANSLATE_INFOBAR_BEFORE_MESSAGE),
- std::wstring(), std::wstring(), &offsets);
- if (!offsets.empty() && offsets.size() <= 2) {
- // Sort the offsets if necessary.
- if (offsets.size() == 2 && offsets[0] > offsets[1]) {
- size_t offset0 = offsets[0];
- offsets[0] = offsets[1];
- offsets[1] = offset0;
- swapped_language_placeholders_ = true;
- }
- if (offsets[offsets.size() - 1] != message_text.length())
- offsets.push_back(message_text.length());
- } else {
- NOTREACHED() << "Invalid no. of placeholders in label.";
- }
+ string16 message_text_utf16;
+ GetDelegate()->GetMessageText(&message_text_utf16, &offsets,
+ &swapped_language_placeholders_);
+
+ std::wstring message_text = UTF16ToWideHack(message_text_utf16);
// Create label controls.
const gfx::Font& font = ResourceBundle::GetSharedInstance().GetFont(
« no previous file with comments | « chrome/browser/translate/translate_infobars_delegates.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698