summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 20:35:19 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-29 20:35:19 +0000
commitddd231eaa03153f6d04894cceb0b4480755e1277 (patch)
treefaafed02945c1f8934e6e393ac0c6b094c303cdf /chrome/browser/chromeos/options
parentc5e30d8572ffae1e0d4fbb2fff765f9a8cbace77 (diff)
downloadchromium_src-ddd231eaa03153f6d04894cceb0b4480755e1277.zip
chromium_src-ddd231eaa03153f6d04894cceb0b4480755e1277.tar.gz
chromium_src-ddd231eaa03153f6d04894cceb0b4480755e1277.tar.bz2
Change a bunch of string types.
Started out just trying to change PrefService::GetString and ::SetString. This snowballed a little bit. Had to change a bunch of url strings in search_engines/ from wstring to string (some of them may be better off as GURLs, but UTF-8 is a step in the right direction, since that's what GURL uses internally, as well as externally via its setters/getters). TODO (later patch): things that ask for accepted languages should use std::string, not std::wstring. BUG=none TEST=try bots Review URL: http://codereview.chromium.org/2854015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/options')
-rw-r--r--chrome/browser/chromeos/options/language_chewing_config_view.cc8
-rw-r--r--chrome/browser/chromeos/options/language_config_model.cc9
-rw-r--r--chrome/browser/chromeos/options/language_config_view.cc3
-rw-r--r--chrome/browser/chromeos/options/language_hangul_config_view.cc25
-rw-r--r--chrome/browser/chromeos/options/language_mozc_config_view.cc10
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc12
6 files changed, 32 insertions, 35 deletions
diff --git a/chrome/browser/chromeos/options/language_chewing_config_view.cc b/chrome/browser/chromeos/options/language_chewing_config_view.cc
index 1e52f22..39c245f 100644
--- a/chrome/browser/chromeos/options/language_chewing_config_view.cc
+++ b/chrome/browser/chromeos/options/language_chewing_config_view.cc
@@ -69,8 +69,8 @@ void LanguageChewingConfigView::ItemChanged(
for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
if (current.combobox == sender) {
- const std::wstring config_value =
- UTF8ToWide(current.combobox_model->GetConfigValueAt(new_index));
+ const std::string config_value =
+ current.combobox_model->GetConfigValueAt(new_index);
LOG(INFO) << "Changing Chewing pref to " << config_value;
// Update the Chrome pref.
current.multiple_choice_pref.SetValue(config_value);
@@ -203,9 +203,9 @@ void LanguageChewingConfigView::NotifyPrefChanged() {
}
for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
- const std::wstring value = current.multiple_choice_pref.GetValue();
+ const std::string value = current.multiple_choice_pref.GetValue();
for (int i = 0; i < current.combobox_model->num_items(); ++i) {
- if (UTF8ToWide(current.combobox_model->GetConfigValueAt(i)) == value) {
+ if (current.combobox_model->GetConfigValueAt(i) == value) {
current.combobox->SetSelectedItem(i);
break;
}
diff --git a/chrome/browser/chromeos/options/language_config_model.cc b/chrome/browser/chromeos/options/language_config_model.cc
index 07c33bb..4b256ba 100644
--- a/chrome/browser/chromeos/options/language_config_model.cc
+++ b/chrome/browser/chromeos/options/language_config_model.cc
@@ -136,7 +136,7 @@ void LanguageConfigModel::UpdateInputMethodPreferences(
// function below uses stable sort, the relateve order of input methods that
// belong to the same language (e.g. "mozc" and "xkb:jp::jpn") is maintained.
input_method::SortInputMethodIdsByNames(&new_input_method_ids);
- preload_engines_.SetValue(UTF8ToWide(JoinString(new_input_method_ids, ',')));
+ preload_engines_.SetValue(JoinString(new_input_method_ids, ','));
}
void LanguageConfigModel::DeactivateInputMethodsFor(
@@ -186,11 +186,10 @@ bool LanguageConfigModel::InputMethodIsActivated(
void LanguageConfigModel::GetActiveInputMethodIds(
std::vector<std::string>* out_input_method_ids) {
- const std::wstring value = preload_engines_.GetValue();
+ const std::string value = preload_engines_.GetValue();
out_input_method_ids->clear();
- if (!value.empty()) {
- SplitString(WideToUTF8(value), ',', out_input_method_ids);
- }
+ if (!value.empty())
+ SplitString(value, ',', out_input_method_ids);
}
void LanguageConfigModel::GetInputMethodIdsFromLanguageCode(
diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc
index e89b85c..fc57503 100644
--- a/chrome/browser/chromeos/options/language_config_view.cc
+++ b/chrome/browser/chromeos/options/language_config_view.cc
@@ -169,8 +169,7 @@ void LanguageConfigView::ButtonPressed(
UiLanguageButton* button = static_cast<UiLanguageButton*>(sender);
PrefService* prefs = g_browser_process->local_state();
if (prefs) {
- prefs->SetString(prefs::kApplicationLocale,
- UTF8ToWide(button->language_code()));
+ prefs->SetString(prefs::kApplicationLocale, button->language_code());
prefs->SavePersistentPrefs();
RestartMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow());
}
diff --git a/chrome/browser/chromeos/options/language_hangul_config_view.cc b/chrome/browser/chromeos/options/language_hangul_config_view.cc
index e200f6f..1d2d88a 100644
--- a/chrome/browser/chromeos/options/language_hangul_config_view.cc
+++ b/chrome/browser/chromeos/options/language_hangul_config_view.cc
@@ -30,7 +30,7 @@ class HangulKeyboardComboboxModel : public ComboboxModel {
HangulKeyboardComboboxModel() {
for (size_t i = 0; i < arraysize(kHangulKeyboardNameIDPairs); ++i) {
layouts_.push_back(std::make_pair(
- l10n_util::GetString(kHangulKeyboardNameIDPairs[i].message_id),
+ l10n_util::GetStringUTF8(kHangulKeyboardNameIDPairs[i].message_id),
kHangulKeyboardNameIDPairs[i].keyboard_id));
}
}
@@ -46,15 +46,15 @@ class HangulKeyboardComboboxModel : public ComboboxModel {
LOG(ERROR) << "Index is out of bounds: " << index;
return L"";
}
- return layouts_.at(index).first;
+ return UTF8ToWide(layouts_.at(index).first);
}
// Gets a keyboard layout ID (e.g. "2", "3f", ..) for an item at zero-origin
// |index|. This function is NOT part of the ComboboxModel interface.
- std::wstring GetItemIDAt(int index) {
+ std::string GetItemIDAt(int index) {
if (index < 0 || index > GetItemCount()) {
LOG(ERROR) << "Index is out of bounds: " << index;
- return L"";
+ return "";
}
return layouts_.at(index).second;
}
@@ -62,7 +62,7 @@ class HangulKeyboardComboboxModel : public ComboboxModel {
// Gets an index (>= 0) of an item whose keyboard layout ID is |layout_ld|.
// Returns -1 if such item is not found. This function is NOT part of the
// ComboboxModel interface.
- int GetIndexFromID(const std::wstring& layout_id) {
+ int GetIndexFromID(const std::string& layout_id) {
for (size_t i = 0; i < layouts_.size(); ++i) {
if (GetItemIDAt(i) == layout_id) {
return static_cast<int>(i);
@@ -72,7 +72,7 @@ class HangulKeyboardComboboxModel : public ComboboxModel {
}
private:
- std::vector<std::pair<std::wstring, std::wstring> > layouts_;
+ std::vector<std::pair<std::string, std::string> > layouts_;
DISALLOW_COPY_AND_ASSIGN(HangulKeyboardComboboxModel);
};
@@ -90,8 +90,8 @@ LanguageHangulConfigView::~LanguageHangulConfigView() {
void LanguageHangulConfigView::ItemChanged(
views::Combobox* sender, int prev_index, int new_index) {
- const std::wstring id
- = hangul_keyboard_combobox_model_->GetItemIDAt(new_index);
+ const std::string id =
+ hangul_keyboard_combobox_model_->GetItemIDAt(new_index);
LOG(INFO) << "Changing Hangul keyboard pref to " << id;
keyboard_pref_.SetValue(id);
}
@@ -160,12 +160,11 @@ void LanguageHangulConfigView::Observe(NotificationType type,
}
void LanguageHangulConfigView::NotifyPrefChanged() {
- const std::wstring id = keyboard_pref_.GetValue();
- const int index
- = hangul_keyboard_combobox_model_->GetIndexFromID(id);
- if (index >= 0) {
+ const std::string id = keyboard_pref_.GetValue();
+ const int index =
+ hangul_keyboard_combobox_model_->GetIndexFromID(id);
+ if (index >= 0)
hangul_keyboard_combobox_->SetSelectedItem(index);
- }
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/options/language_mozc_config_view.cc b/chrome/browser/chromeos/options/language_mozc_config_view.cc
index 80d25ed..cd01a08 100644
--- a/chrome/browser/chromeos/options/language_mozc_config_view.cc
+++ b/chrome/browser/chromeos/options/language_mozc_config_view.cc
@@ -85,8 +85,8 @@ void LanguageMozcConfigView::ItemChanged(
for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
if (current.combobox == sender) {
- const std::wstring config_value =
- UTF8ToWide(current.combobox_model->GetConfigValueAt(new_index));
+ const std::string config_value =
+ current.combobox_model->GetConfigValueAt(new_index);
LOG(INFO) << "Changing Mozc pref to " << config_value;
// Update the Chrome pref.
current.multiple_choice_pref.SetValue(config_value);
@@ -220,9 +220,9 @@ void LanguageMozcConfigView::NotifyPrefChanged() {
}
for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
- const std::wstring value = current.multiple_choice_pref.GetValue();
+ const std::string value = current.multiple_choice_pref.GetValue();
for (int i = 0; i < current.combobox_model->num_items(); ++i) {
- if (UTF8ToWide(current.combobox_model->GetConfigValueAt(i)) == value) {
+ if (current.combobox_model->GetConfigValueAt(i) == value) {
current.combobox->SetSelectedItem(i);
break;
}
@@ -242,7 +242,7 @@ void LanguageMozcConfigView::ResetToDefaults() {
}
for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
prefs_and_comboboxes_[i].multiple_choice_pref.SetValue(
- UTF8ToWide(kMozcMultipleChoicePrefs[i].default_pref_value));
+ kMozcMultipleChoicePrefs[i].default_pref_value);
}
for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
prefs_and_sliders_[i].integer_pref.SetValue(
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index 7b5c27a..f9ff16d 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -126,11 +126,11 @@ class DateTimeSection : public SettingsPageSection,
L"(GMT+%d) " : L"(GMT%d) "), hour_offset) + output;
}
- virtual std::wstring GetTimeZoneIDAt(int index) {
+ virtual std::string GetTimeZoneIDAt(int index) {
icu::UnicodeString id;
timezones_[index]->getID(id);
- std::wstring output;
- UTF16ToWide(id.getBuffer(), id.length(), &output);
+ std::string output;
+ UTF16ToUTF8(id.getBuffer(), id.length(), &output);
return output;
}
@@ -141,7 +141,7 @@ class DateTimeSection : public SettingsPageSection,
};
// Selects the timezone.
- void SelectTimeZone(const std::wstring& id);
+ void SelectTimeZone(const std::string& id);
// TimeZone combobox model.
views::Combobox* timezone_combobox_;
@@ -184,12 +184,12 @@ void DateTimeSection::InitContents(GridLayout* layout) {
void DateTimeSection::NotifyPrefChanged(const std::wstring* pref_name) {
if (!pref_name || *pref_name == prefs::kTimeZone) {
- std::wstring timezone = timezone_.GetValue();
+ std::string timezone = timezone_.GetValue();
SelectTimeZone(timezone);
}
}
-void DateTimeSection::SelectTimeZone(const std::wstring& id) {
+void DateTimeSection::SelectTimeZone(const std::string& id) {
for (int i = 0; i < timezone_combobox_model_.GetItemCount(); i++) {
if (timezone_combobox_model_.GetTimeZoneIDAt(i) == id) {
timezone_combobox_->SetSelectedItem(i);