summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-22 16:49:37 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-22 16:49:37 +0000
commita88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2 (patch)
treee05c5e6959584c84cef55647d9bf1e4bbb2217d9 /chrome/browser/chromeos/options
parente7afe2458ed03e907601cd3c05dc5f253f824d88 (diff)
downloadchromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.zip
chromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.tar.gz
chromium_src-a88fe62cc7255cccd97dc4f13cb6f6f0b5b77fe2.tar.bz2
Remove wstrings from bookmarks, part 12.
- This changes RecentlyUsedFoldersComboModel::GetItemAt() to return a string16 instead of a wstring. - This entailed changing the base class, ComboboxModel, and shaving a herd of yaks. BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3159031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/options')
-rw-r--r--chrome/browser/chromeos/options/language_config_model.cc6
-rw-r--r--chrome/browser/chromeos/options/language_config_model.h3
-rw-r--r--chrome/browser/chromeos/options/language_config_model_unittest.cc8
-rw-r--r--chrome/browser/chromeos/options/language_config_util.h7
-rw-r--r--chrome/browser/chromeos/options/language_hangul_config_view.cc7
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc8
6 files changed, 22 insertions, 17 deletions
diff --git a/chrome/browser/chromeos/options/language_config_model.cc b/chrome/browser/chromeos/options/language_config_model.cc
index c6247a0..3e4ac6f 100644
--- a/chrome/browser/chromeos/options/language_config_model.cc
+++ b/chrome/browser/chromeos/options/language_config_model.cc
@@ -31,13 +31,13 @@ int AddLanguageComboboxModel::GetItemCount() {
return get_languages_count() + 1 - ignore_set_.size();
}
-std::wstring AddLanguageComboboxModel::GetItemAt(int index) {
+string16 AddLanguageComboboxModel::GetItemAt(int index) {
// Show "Add language" as the first item.
if (index == 0) {
- return l10n_util::GetString(
+ return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX);
}
- return GetLanguageNameAt(GetLanguageIndex(index));
+ return WideToUTF16Hack(GetLanguageNameAt(GetLanguageIndex(index)));
}
int AddLanguageComboboxModel::GetLanguageIndex(int index) const {
diff --git a/chrome/browser/chromeos/options/language_config_model.h b/chrome/browser/chromeos/options/language_config_model.h
index 4310f77..031e90e 100644
--- a/chrome/browser/chromeos/options/language_config_model.h
+++ b/chrome/browser/chromeos/options/language_config_model.h
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/string16.h"
#include "chrome/browser/language_combobox_model.h"
#include "chrome/browser/pref_member.h"
#include "chrome/browser/pref_service.h"
@@ -27,7 +28,7 @@ class AddLanguageComboboxModel : public ::LanguageComboboxModel {
const std::vector<std::string>& locale_codes);
// LanguageComboboxModel overrides.
virtual int GetItemCount();
- virtual std::wstring GetItemAt(int index);
+ virtual string16 GetItemAt(int index);
// Converts the given index (index of the items in the combobox) to the
// index of the internal language list. The returned index can be used
diff --git a/chrome/browser/chromeos/options/language_config_model_unittest.cc b/chrome/browser/chromeos/options/language_config_model_unittest.cc
index e9b593d..0d7e12f 100644
--- a/chrome/browser/chromeos/options/language_config_model_unittest.cc
+++ b/chrome/browser/chromeos/options/language_config_model_unittest.cc
@@ -26,18 +26,18 @@ TEST(AddLanguageComboboxModelTest, AddLanguageComboboxModel) {
ASSERT_EQ(4, model.GetItemCount());
// The first item should be "Add language" labe.
- EXPECT_EQ(l10n_util::GetString(
+ EXPECT_EQ(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX),
model.GetItemAt(0));
// Other items should be sorted language display names for UI (hence
// French comes before German). Note that the returned display names
// are followed by their native representations. To simplify matching,
// use StartsWith() here.
- EXPECT_TRUE(StartsWith(model.GetItemAt(1), L"French", true))
+ EXPECT_TRUE(StartsWith(model.GetItemAt(1), ASCIIToUTF16("French"), true))
<< model.GetItemAt(1);
- EXPECT_TRUE(StartsWith(model.GetItemAt(2), L"German", true))
+ EXPECT_TRUE(StartsWith(model.GetItemAt(2), ASCIIToUTF16("German"), true))
<< model.GetItemAt(2);
- EXPECT_TRUE(StartsWith(model.GetItemAt(3), L"Korean", true))
+ EXPECT_TRUE(StartsWith(model.GetItemAt(3), ASCIIToUTF16("Korean"), true))
<< model.GetItemAt(3);
// GetLanguageIndex() returns the given index -1 to offset "Add language".
diff --git a/chrome/browser/chromeos/options/language_config_util.h b/chrome/browser/chromeos/options/language_config_util.h
index 21a5705..6f262cf 100644
--- a/chrome/browser/chromeos/options/language_config_util.h
+++ b/chrome/browser/chromeos/options/language_config_util.h
@@ -7,6 +7,7 @@
#pragma once
#include "app/combobox_model.h"
+#include "base/string16.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "views/controls/combobox/combobox.h"
@@ -38,13 +39,13 @@ class LanguageComboboxModel : public ComboboxModel {
}
// Implements ComboboxModel interface.
- virtual std::wstring GetItemAt(int index) {
+ virtual string16 GetItemAt(int index) {
if (index < 0 || index >= num_items_) {
LOG(ERROR) << "Index is out of bounds: " << index;
- return L"";
+ return string16();
}
const int message_id = (pref_data_->values_and_ids)[index].item_message_id;
- return l10n_util::GetString(message_id);
+ return l10n_util::GetStringUTF16(message_id);
}
// Gets a label for the combobox like "Input mode". This function is NOT part
diff --git a/chrome/browser/chromeos/options/language_hangul_config_view.cc b/chrome/browser/chromeos/options/language_hangul_config_view.cc
index 29991c6..14677f6 100644
--- a/chrome/browser/chromeos/options/language_hangul_config_view.cc
+++ b/chrome/browser/chromeos/options/language_hangul_config_view.cc
@@ -6,6 +6,7 @@
#include "app/combobox_model.h"
#include "app/l10n_util.h"
+#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
@@ -43,12 +44,12 @@ class HangulKeyboardComboboxModel : public ComboboxModel {
}
// Implements ComboboxModel interface.
- virtual std::wstring GetItemAt(int index) {
+ virtual string16 GetItemAt(int index) {
if (index < 0 || index > GetItemCount()) {
LOG(ERROR) << "Index is out of bounds: " << index;
- return L"";
+ return string16();
}
- return UTF8ToWide(layouts_.at(index).first);
+ return UTF8ToUTF16(layouts_.at(index).first);
}
// Gets a keyboard layout ID (e.g. "2", "3f", ..) for an item at zero-origin
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index c6fb721..ef7be1c 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -10,6 +10,7 @@
#include "app/l10n_util.h"
#include "app/combobox_model.h"
#include "base/stl_util-inl.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
@@ -126,14 +127,15 @@ class DateTimeSection : public SettingsPageSection,
return static_cast<int>(timezones_.size());
}
- virtual std::wstring GetItemAt(int index) {
+ virtual string16 GetItemAt(int index) {
icu::UnicodeString name;
timezones_[index]->getDisplayName(name);
std::wstring output;
UTF16ToWide(name.getBuffer(), name.length(), &output);
int hour_offset = timezones_[index]->getRawOffset() / 3600000;
- return StringPrintf(hour_offset == 0 ? L"(GMT) " : (hour_offset > 0 ?
- L"(GMT+%d) " : L"(GMT%d) "), hour_offset) + output;
+ return WideToUTF16Hack(
+ StringPrintf(hour_offset == 0 ? L"(GMT) " : (hour_offset > 0 ?
+ L"(GMT+%d) " : L"(GMT%d) "), hour_offset) + output);
}
virtual icu::TimeZone* GetTimeZoneAt(int index) {