diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 15:43:49 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 15:43:49 +0000 |
commit | 2f19a2efcd04eefd8b5c2da41bf1d0ceff852fb6 (patch) | |
tree | 739490caf153d00af3720a1d2b8107f405f8c4da /chrome/browser/chromeos | |
parent | cc3b29e4a1baae0a2a652838afba77e65eac1524 (diff) | |
download | chromium_src-2f19a2efcd04eefd8b5c2da41bf1d0ceff852fb6.zip chromium_src-2f19a2efcd04eefd8b5c2da41bf1d0ceff852fb6.tar.gz chromium_src-2f19a2efcd04eefd8b5c2da41bf1d0ceff852fb6.tar.bz2 |
Convert wide strings in Chrome OS DOM UI code.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3159015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
13 files changed, 222 insertions, 220 deletions
diff --git a/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc b/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc index 8b594c4..67173a3 100644 --- a/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/accounts_options_handler.cc @@ -21,20 +21,20 @@ AccountsOptionsHandler::~AccountsOptionsHandler() { void AccountsOptionsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); - localized_strings->SetString(L"accountsPage", l10n_util::GetString( + localized_strings->SetString("accountsPage", l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_TAB_LABEL)); - localized_strings->SetString(L"allow_BWSI", l10n_util::GetString( + localized_strings->SetString("allow_BWSI", l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_ALLOW_BWSI_DESCRIPTION)); - localized_strings->SetString(L"allow_guest",l10n_util::GetString( + localized_strings->SetString("allow_guest",l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_ALLOW_GUEST_DESCRIPTION)); - localized_strings->SetString(L"show_user_on_signin",l10n_util::GetString( + localized_strings->SetString("show_user_on_signin",l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_SHOW_USER_NAMES_ON_SINGIN_DESCRIPTION)); - localized_strings->SetString(L"username_edit_hint",l10n_util::GetString( + localized_strings->SetString("username_edit_hint",l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_USERNAME_EDIT_HINT)); - localized_strings->SetString(L"username_format",l10n_util::GetString( + localized_strings->SetString("username_format",l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_USERNAME_FORMAT)); - localized_strings->SetString(L"add_users",l10n_util::GetString( + localized_strings->SetString("add_users",l10n_util::GetStringUTF16( IDS_OPTIONS_ACCOUNTS_ADD_USERS)); } diff --git a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc index 785ed7b..c32defa 100644 --- a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc @@ -12,6 +12,7 @@ #include "base/base64.h" #include "base/basictypes.h" #include "base/callback.h" +#include "base/string16.h" #include "base/values.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -44,34 +45,35 @@ void InternetOptionsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); // Internet page - ChromeOS - localized_strings->SetString(L"internetPage", - l10n_util::GetString(IDS_OPTIONS_INTERNET_TAB_LABEL)); - - localized_strings->SetString(L"wired_title", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRED_NETWORK)); - localized_strings->SetString(L"wireless_title", - l10n_util::GetString( + localized_strings->SetString("internetPage", + l10n_util::GetStringUTF16(IDS_OPTIONS_INTERNET_TAB_LABEL)); + + localized_strings->SetString("wired_title", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRED_NETWORK)); + localized_strings->SetString("wireless_title", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIRELESS_NETWORK)); - localized_strings->SetString(L"remembered_title", - l10n_util::GetString( + localized_strings->SetString("remembered_title", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_SECTION_TITLE_REMEMBERED_NETWORK)); - localized_strings->SetString(L"connect_button", - l10n_util::GetString( + localized_strings->SetString("connect_button", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_CONNECT)); - localized_strings->SetString(L"disconnect_button", - l10n_util::GetString( + localized_strings->SetString("disconnect_button", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_DISCONNECT)); - localized_strings->SetString(L"options_button", - l10n_util::GetString( + localized_strings->SetString("options_button", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_OPTIONS)); - localized_strings->SetString(L"forget_button", - l10n_util::GetString( + localized_strings->SetString("forget_button", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_FORGET)); - localized_strings->Set(L"wiredList", GetWiredList()); - localized_strings->Set(L"wirelessList", GetWirelessList()); - localized_strings->Set(L"rememberedList", GetRememberedList()); + localized_strings->Set("wiredList", GetWiredList()); + localized_strings->Set("wirelessList", GetWirelessList()); + localized_strings->Set("rememberedList", GetRememberedList()); } void InternetOptionsHandler::RegisterMessages() { @@ -84,9 +86,9 @@ void InternetOptionsHandler::RegisterMessages() { void InternetOptionsHandler::NetworkChanged(chromeos::NetworkLibrary* cros) { if (dom_ui_) { DictionaryValue dictionary; - dictionary.Set(L"wiredList", GetWiredList()); - dictionary.Set(L"wirelessList", GetWirelessList()); - dictionary.Set(L"rememberedList", GetRememberedList()); + dictionary.Set("wiredList", GetWiredList()); + dictionary.Set("wirelessList", GetWirelessList()); + dictionary.Set("rememberedList", GetRememberedList()); dom_ui_->CallJavascriptFunction( L"options.InternetOptions.refreshNetworkData", dictionary); } @@ -195,14 +197,14 @@ ListValue* InternetOptionsHandler::GetNetwork(const std::string& service_path, s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING; else if (connected) s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED; - std::wstring status = l10n_util::GetString(s); + string16 status = l10n_util::GetStringUTF16(s); // service path network->Append(Value::CreateStringValue(service_path)); // name network->Append(Value::CreateStringValue(name)); // status - network->Append(Value::CreateStringValue(l10n_util::GetString(s))); + network->Append(Value::CreateStringValue(status)); // type network->Append(Value::CreateIntegerValue(connection_type)); // connected diff --git a/chrome/browser/chromeos/dom_ui/labs_handler.cc b/chrome/browser/chromeos/dom_ui/labs_handler.cc index 915941f..9504d6d 100644 --- a/chrome/browser/chromeos/dom_ui/labs_handler.cc +++ b/chrome/browser/chromeos/dom_ui/labs_handler.cc @@ -28,15 +28,15 @@ void LabsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); // Labs page - ChromeOS - localized_strings->SetString(L"labsPage", - l10n_util::GetString(IDS_OPTIONS_LABS_TAB_LABEL)); - localized_strings->SetString(L"mediaplayer_title", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_MEDIAPLAYER)); - localized_strings->SetString(L"mediaplayer", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_MEDIAPLAYER_DESCRIPTION)); + localized_strings->SetString("labsPage", + l10n_util::GetStringUTF16(IDS_OPTIONS_LABS_TAB_LABEL)); + localized_strings->SetString("mediaplayer_title", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_MEDIAPLAYER)); + localized_strings->SetString("mediaplayer", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_MEDIAPLAYER_DESCRIPTION)); - localized_strings->SetString(L"advanced_file_title", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_ADVANCEDFS)); - localized_strings->SetString(L"advanced_filesystem", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_ADVANCEDFS_DESCRIPTION)); + localized_strings->SetString("advanced_file_title", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_ADVANCEDFS)); + localized_strings->SetString("advanced_filesystem", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ADVANCEDFS_DESCRIPTION)); } diff --git a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc index 4d30e2c..314a4c4 100644 --- a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc @@ -30,7 +30,7 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) { localized_strings->SetString( GetI18nContentValue(kChewingBooleanPrefs[i]), - l10n_util::GetString(kChewingBooleanPrefs[i].message_id)); + l10n_util::GetStringUTF16(kChewingBooleanPrefs[i].message_id)); } for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { @@ -38,13 +38,13 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( kChewingIntegerPrefs[i]; localized_strings->SetString( GetI18nContentValue(preference), - l10n_util::GetString(preference.message_id)); + l10n_util::GetStringUTF16(preference.message_id)); localized_strings->SetString( GetTemplateDataMinName(preference), - UTF8ToWide(base::IntToString(preference.min_pref_value))); + base::IntToString(preference.min_pref_value)); localized_strings->SetString( GetTemplateDataMaxName(preference), - UTF8ToWide(base::IntToString(preference.max_pref_value))); + base::IntToString(preference.max_pref_value)); } for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; @@ -53,7 +53,7 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( kChewingMultipleChoicePrefs[i]; localized_strings->SetString( GetI18nContentValue(preference), - l10n_util::GetString(preference.label_message_id)); + l10n_util::GetStringUTF16(preference.label_message_id)); localized_strings->Set( GetTemplateDataPropertyName(preference), CreateMultipleChoiceList(preference)); @@ -61,7 +61,7 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( localized_strings->SetString( GetI18nContentValue(kChewingHsuSelKeyType), - l10n_util::GetString(kChewingHsuSelKeyType.label_message_id)); + l10n_util::GetStringUTF16(kChewingHsuSelKeyType.label_message_id)); int hsu_sel_key_type_min = std::numeric_limits<int>::max(); int hsu_sel_key_type_max = std::numeric_limits<int>::min(); @@ -82,10 +82,10 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( localized_strings->SetString( GetTemplateDataMinName(kChewingHsuSelKeyType), - UTF8ToWide(base::IntToString(hsu_sel_key_type_min))); + base::IntToString(hsu_sel_key_type_min)); localized_strings->SetString( GetTemplateDataMaxName(kChewingHsuSelKeyType), - UTF8ToWide(base::IntToString(hsu_sel_key_type_max))); + base::IntToString(hsu_sel_key_type_max)); } } // namespace chromeos diff --git a/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc index 020baeb..3d77d08 100644 --- a/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc @@ -22,19 +22,19 @@ void LanguageHangulOptionsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); // Language Hangul page - ChromeOS - localized_strings->SetString(L"keyboard_layout", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT)); + localized_strings->SetString("keyboard_layout", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT)); - localized_strings->Set(L"keyboardLayoutList", GetKeyboardLayoutList()); + localized_strings->Set("keyboardLayoutList", GetKeyboardLayoutList()); } ListValue* LanguageHangulOptionsHandler::GetKeyboardLayoutList() { ListValue* keyboard_layout_list = new ListValue(); for (size_t i = 0; i < arraysize(kHangulKeyboardNameIDPairs); ++i) { ListValue* option = new ListValue(); - option->Append(Value::CreateStringValue(ASCIIToWide( - kHangulKeyboardNameIDPairs[i].keyboard_id))); - option->Append(Value::CreateStringValue(l10n_util::GetString( + option->Append(Value::CreateStringValue( + kHangulKeyboardNameIDPairs[i].keyboard_id)); + option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( kHangulKeyboardNameIDPairs[i].message_id))); keyboard_layout_list->Append(option); } diff --git a/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc index e8b04f8..17d900b 100644 --- a/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc @@ -27,7 +27,7 @@ void LanguageMozcOptionsHandler::GetLocalizedValues( for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) { localized_strings->SetString( GetI18nContentValue(kMozcBooleanPrefs[i]), - l10n_util::GetString(kMozcBooleanPrefs[i].message_id)); + l10n_util::GetStringUTF16(kMozcBooleanPrefs[i].message_id)); } for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) { @@ -35,7 +35,7 @@ void LanguageMozcOptionsHandler::GetLocalizedValues( kMozcMultipleChoicePrefs[i]; localized_strings->SetString( GetI18nContentValue(preference), - l10n_util::GetString(preference.label_message_id)); + l10n_util::GetStringUTF16(preference.label_message_id)); localized_strings->Set(GetTemplateDataPropertyName(preference), CreateMultipleChoiceList(preference)); } @@ -44,13 +44,13 @@ void LanguageMozcOptionsHandler::GetLocalizedValues( const LanguageIntegerRangePreference& preference = kMozcIntegerPrefs[i]; localized_strings->SetString( GetI18nContentValue(preference), - l10n_util::GetString(preference.message_id)); + l10n_util::GetStringUTF16(preference.message_id)); localized_strings->SetString( GetTemplateDataMinName(preference), - UTF8ToWide(base::IntToString(preference.min_pref_value))); + base::IntToString(preference.min_pref_value)); localized_strings->SetString( GetTemplateDataMaxName(preference), - UTF8ToWide(base::IntToString(preference.max_pref_value))); + base::IntToString(preference.max_pref_value)); } } diff --git a/chrome/browser/chromeos/dom_ui/language_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_options_handler.cc index a2045e5..11e006b 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_options_handler.cc @@ -35,65 +35,65 @@ LanguageOptionsHandler::~LanguageOptionsHandler() { void LanguageOptionsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); - localized_strings->SetString(L"languagePage", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE)); - localized_strings->SetString(L"add_button", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_BUTTON)); - localized_strings->SetString(L"configure", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_CONFIGURE)); - localized_strings->SetString(L"input_method", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD)); - localized_strings->SetString(L"languages", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES)); - localized_strings->SetString(L"please_add_another_input_method", - l10n_util::GetString( + localized_strings->SetString("languagePage", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE)); + localized_strings->SetString("add_button", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_BUTTON)); + localized_strings->SetString("configure", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_CONFIGURE)); + localized_strings->SetString("input_method", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD)); + localized_strings->SetString("languages", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES)); + localized_strings->SetString("please_add_another_input_method", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_PLEASE_ADD_ANOTHER_INPUT_METHOD)); - localized_strings->SetString(L"please_add_another_language", - l10n_util::GetString( + localized_strings->SetString("please_add_another_language", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_PLEASE_ADD_ANOTHER_LANGUAGE)); - localized_strings->SetString(L"remove_button", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON)); - localized_strings->SetString(L"restart_button", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_RESTART_BUTTON)); - localized_strings->SetString(L"add_language_instructions", - l10n_util::GetString( + localized_strings->SetString("remove_button", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON)); + localized_strings->SetString("restart_button", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_RESTART_BUTTON)); + localized_strings->SetString("add_language_instructions", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_INSTRUCTIONS)); - localized_strings->SetString(L"input_method_instructions", - l10n_util::GetString( + localized_strings->SetString("input_method_instructions", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD_INSTRUCTIONS)); - localized_strings->SetString(L"switch_input_methods_hint", - l10n_util::GetStringF( + localized_strings->SetString("switch_input_methods_hint", + l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_SWITCH_INPUT_METHODS_HINT, - L"alt+shift")); - localized_strings->SetString(L"select_previous_input_method_hint", - l10n_util::GetStringF( + ASCIIToUTF16("alt+shift"))); + localized_strings->SetString("select_previous_input_method_hint", + l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_SELECT_PREVIOUS_INPUT_METHOD_HINT, - L"ctrl+space")); - localized_strings->SetString(L"cannot_be_displayed_in_this_language", - l10n_util::GetStringF( + ASCIIToUTF16("ctrl+space"))); + localized_strings->SetString("cannot_be_displayed_in_this_language", + l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE, - l10n_util::GetString(IDS_PRODUCT_OS_NAME))); - localized_strings->SetString(L"is_displayed_in_this_language", - l10n_util::GetStringF( + l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))); + localized_strings->SetString("is_displayed_in_this_language", + l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE, - l10n_util::GetString(IDS_PRODUCT_OS_NAME))); - localized_strings->SetString(L"display_in_this_language", - l10n_util::GetStringF( + l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))); + localized_strings->SetString("display_in_this_language", + l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE, - l10n_util::GetString(IDS_PRODUCT_OS_NAME))); - localized_strings->SetString(L"restart_required", - l10n_util::GetString(IDS_OPTIONS_RESTART_REQUIRED)); + l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))); + localized_strings->SetString("restart_required", + l10n_util::GetStringUTF16(IDS_OPTIONS_RESTART_REQUIRED)); // GetSupportedInputMethods() never return NULL. scoped_ptr<InputMethodDescriptors> descriptors( CrosLibrary::Get()->GetInputMethodLibrary()->GetSupportedInputMethods()); // The followigns are resources, rather than local strings. - localized_strings->SetString(L"currentUiLanguageCode", - UTF8ToWide(g_browser_process->GetApplicationLocale())); - localized_strings->Set(L"inputMethodList", GetInputMethodList(*descriptors)); - localized_strings->Set(L"languageList", GetLanguageList(*descriptors)); - localized_strings->Set(L"uiLanguageCodeSet", GetUiLanguageCodeSet()); + localized_strings->SetString("currentUiLanguageCode", + g_browser_process->GetApplicationLocale()); + localized_strings->Set("inputMethodList", GetInputMethodList(*descriptors)); + localized_strings->Set("languageList", GetLanguageList(*descriptors)); + localized_strings->Set("uiLanguageCodeSet", GetUiLanguageCodeSet()); } void LanguageOptionsHandler::RegisterMessages() { @@ -191,9 +191,9 @@ ListValue* LanguageOptionsHandler::GetLanguageList( for (size_t i = 0; i < display_names.size(); ++i) { const LanguagePair& pair = language_map[display_names[i]]; DictionaryValue* dictionary = new DictionaryValue(); - dictionary->SetString(L"code", pair.first); - dictionary->SetString(L"displayName", display_names[i]); - dictionary->SetString(L"nativeDisplayName", pair.second); + dictionary->SetString("code", pair.first); + dictionary->SetString("displayName", WideToUTF16Hack(display_names[i])); + dictionary->SetString("nativeDisplayName", WideToUTF16Hack(pair.second)); language_list->Append(dictionary); } diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.cc b/chrome/browser/chromeos/dom_ui/language_options_util.cc index 6c62f68..0a39259 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_util.cc +++ b/chrome/browser/chromeos/dom_ui/language_options_util.cc @@ -26,7 +26,7 @@ ListValue* CreateMultipleChoiceList( ListValue* option = new ListValue(); option->Append(Value::CreateStringValue( preference.values_and_ids[i].ibus_config_value)); - option->Append(Value::CreateStringValue(l10n_util::GetString( + option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( preference.values_and_ids[i].item_message_id))); list_value->Append(option); } diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.h b/chrome/browser/chromeos/dom_ui/language_options_util.h index 72d8cca..6c3de43 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_util.h +++ b/chrome/browser/chromeos/dom_ui/language_options_util.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_CHROMEOS_DOM_UI_LANGUAGE_OPTIONS_UTIL_H_ #pragma once +#include <string> + #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/language_preferences.h" @@ -15,28 +17,28 @@ namespace { // Returns an i18n-content value corresponding to |preference|. template <typename T> -std::wstring GetI18nContentValue(const T& preference) { - return ASCIIToWide(preference.ibus_config_name) + L"Content"; +std::string GetI18nContentValue(const T& preference) { + return std::string(preference.ibus_config_name) + "Content"; } // Returns a property name of templateData corresponding to |preference|. template <typename T> -std::wstring GetTemplateDataPropertyName(const T& preference) { - return ASCIIToWide(preference.ibus_config_name) + L"Value"; +std::string GetTemplateDataPropertyName(const T& preference) { + return std::string(preference.ibus_config_name) + "Value"; } // Returns an property name of templateData corresponding the value of the min // attribute. template <typename T> -std::wstring GetTemplateDataMinName(const T& preference) { - return ASCIIToWide(preference.ibus_config_name) + L"Min"; +std::string GetTemplateDataMinName(const T& preference) { + return std::string(preference.ibus_config_name) + "Min"; } // Returns an property name of templateData corresponding the value of the max // attribute. template <typename T> -std::wstring GetTemplateDataMaxName(const T& preference) { - return ASCIIToWide(preference.ibus_config_name) + L"Max"; +std::string GetTemplateDataMaxName(const T& preference) { + return std::string(preference.ibus_config_name) + "Max"; } } // namespace diff --git a/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc index 4125456..7c1e3c8 100644 --- a/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc @@ -28,12 +28,12 @@ void LanguagePinyinOptionsHandler::GetLocalizedValues( for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { localized_strings->SetString( GetI18nContentValue(kPinyinBooleanPrefs[i]), - l10n_util::GetString(kPinyinBooleanPrefs[i].message_id)); + l10n_util::GetStringUTF16(kPinyinBooleanPrefs[i].message_id)); } localized_strings->SetString( GetI18nContentValue(kPinyinDoublePinyinSchema), - l10n_util::GetString( + l10n_util::GetStringUTF16( kPinyinDoublePinyinSchema.label_message_id)); ListValue* list_value = new ListValue(); for (size_t i = 0; @@ -46,7 +46,7 @@ void LanguagePinyinOptionsHandler::GetLocalizedValues( option->Append(Value::CreateIntegerValue( kPinyinDoublePinyinSchema.values_and_ids[i]. ibus_config_value)); - option->Append(Value::CreateStringValue(l10n_util::GetString( + option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( kPinyinDoublePinyinSchema.values_and_ids[i]. item_message_id))); list_value->Append(option); diff --git a/chrome/browser/chromeos/dom_ui/proxy_handler.cc b/chrome/browser/chromeos/dom_ui/proxy_handler.cc index 3d4a722..b9cd1cb 100644 --- a/chrome/browser/chromeos/dom_ui/proxy_handler.cc +++ b/chrome/browser/chromeos/dom_ui/proxy_handler.cc @@ -29,36 +29,36 @@ void ProxyHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); // Proxy page - ChromeOS - localized_strings->SetString(L"proxyPage", - l10n_util::GetString(IDS_OPTIONS_PROXY_TAB_LABEL)); - localized_strings->SetString(L"proxy_config_title", - l10n_util::GetString(IDS_PROXY_CONFIG_TITLE)); - localized_strings->SetString(L"proxyDirectIternetConnection", - l10n_util::GetString(IDS_PROXY_DIRECT_CONNECTION)); + localized_strings->SetString("proxyPage", + l10n_util::GetStringUTF16(IDS_OPTIONS_PROXY_TAB_LABEL)); + localized_strings->SetString("proxy_config_title", + l10n_util::GetStringUTF16(IDS_PROXY_CONFIG_TITLE)); + localized_strings->SetString("proxyDirectIternetConnection", + l10n_util::GetStringUTF16(IDS_PROXY_DIRECT_CONNECTION)); - localized_strings->SetString(L"proxyManual", - l10n_util::GetString(IDS_PROXY_MANUAL_CONFIG)); - localized_strings->SetString(L"sameProxyProtocols", - l10n_util::GetString(IDS_PROXY_SAME_FORALL)); + localized_strings->SetString("proxyManual", + l10n_util::GetStringUTF16(IDS_PROXY_MANUAL_CONFIG)); + localized_strings->SetString("sameProxyProtocols", + l10n_util::GetStringUTF16(IDS_PROXY_SAME_FORALL)); - localized_strings->SetString(L"httpProxy", - l10n_util::GetString(IDS_PROXY_HTTP_PROXY)); - localized_strings->SetString(L"secureHttpProxy", - l10n_util::GetString(IDS_PROXY_HTTP_SECURE_HTTP_PROXY)); - localized_strings->SetString(L"ftpProxy", - l10n_util::GetString(IDS_PROXY_FTP_PROXY)); - localized_strings->SetString(L"socksHost", - l10n_util::GetString(IDS_PROXY_SOCKS_HOST)); - localized_strings->SetString(L"proxyAutomatic", - l10n_util::GetString(IDS_PROXY_AUTOMATIC)); - localized_strings->SetString(L"proxyConfigUrl", - l10n_util::GetString(IDS_PROXY_CONFIG_URL)); - localized_strings->SetString(L"advanced_proxy_config", - l10n_util::GetString(IDS_PROXY_ADVANCED_CONFIG)); - localized_strings->SetString(L"addHost", - l10n_util::GetString(IDS_PROXY_ADD_HOST)); - localized_strings->SetString(L"removeHost", - l10n_util::GetString(IDS_PROXY_REMOVE_HOST)); - localized_strings->SetString(L"proxyPort", - l10n_util::GetString(IDS_PROXY_PORT)); + localized_strings->SetString("httpProxy", + l10n_util::GetStringUTF16(IDS_PROXY_HTTP_PROXY)); + localized_strings->SetString("secureHttpProxy", + l10n_util::GetStringUTF16(IDS_PROXY_HTTP_SECURE_HTTP_PROXY)); + localized_strings->SetString("ftpProxy", + l10n_util::GetStringUTF16(IDS_PROXY_FTP_PROXY)); + localized_strings->SetString("socksHost", + l10n_util::GetStringUTF16(IDS_PROXY_SOCKS_HOST)); + localized_strings->SetString("proxyAutomatic", + l10n_util::GetStringUTF16(IDS_PROXY_AUTOMATIC)); + localized_strings->SetString("proxyConfigUrl", + l10n_util::GetStringUTF16(IDS_PROXY_CONFIG_URL)); + localized_strings->SetString("advanced_proxy_config", + l10n_util::GetStringUTF16(IDS_PROXY_ADVANCED_CONFIG)); + localized_strings->SetString("addHost", + l10n_util::GetStringUTF16(IDS_PROXY_ADD_HOST)); + localized_strings->SetString("removeHost", + l10n_util::GetStringUTF16(IDS_PROXY_REMOVE_HOST)); + localized_strings->SetString("proxyPort", + l10n_util::GetStringUTF16(IDS_PROXY_PORT)); } diff --git a/chrome/browser/chromeos/dom_ui/system_options_handler.cc b/chrome/browser/chromeos/dom_ui/system_options_handler.cc index 09b7608..0320772 100644 --- a/chrome/browser/chromeos/dom_ui/system_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/system_options_handler.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" +#include <string> + #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/callback.h" @@ -69,73 +71,71 @@ void SystemOptionsHandler::GetLocalizedValues( DictionaryValue* localized_strings) { DCHECK(localized_strings); // System page - ChromeOS - localized_strings->SetString(L"systemPage", - l10n_util::GetString(IDS_OPTIONS_SYSTEM_TAB_LABEL)); - localized_strings->SetString(L"datetime_title", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME)); - localized_strings->SetString(L"timezone", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION)); - - localized_strings->SetString(L"touchpad", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD)); - localized_strings->SetString(L"enable_tap_to_click", - l10n_util::GetString( + localized_strings->SetString("systemPage", + l10n_util::GetStringUTF16(IDS_OPTIONS_SYSTEM_TAB_LABEL)); + localized_strings->SetString("datetime_title", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME)); + localized_strings->SetString("timezone", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION)); + + localized_strings->SetString("touchpad", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_TOUCHPAD)); + localized_strings->SetString("enable_tap_to_click", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION)); - localized_strings->SetString(L"enable_vert_edge_scroll", - l10n_util::GetString( + localized_strings->SetString("enable_vert_edge_scroll", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_VERT_EDGE_SCROLL_ENABLED_DESCRIPTION)); - localized_strings->SetString(L"sensitivity", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION)); - localized_strings->SetString(L"speed_factor", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SPEED_FACTOR_DESCRIPTION)); - - localized_strings->SetString(L"language", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_LANGUAGE)); - localized_strings->SetString(L"language_customize", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE)); - - localized_strings->SetString(L"keyboard", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_KEYBOARD)); - localized_strings->SetString(L"repeat_keys", - l10n_util::GetString( + localized_strings->SetString("sensitivity", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION)); + localized_strings->SetString("speed_factor", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SPEED_FACTOR_DESCRIPTION)); + + localized_strings->SetString("language", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_LANGUAGE)); + localized_strings->SetString("language_customize", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE)); + + localized_strings->SetString("keyboard", + l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_SECTION_TITLE_KEYBOARD)); + localized_strings->SetString("repeat_keys", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_ENABLED)); - localized_strings->SetString(L"repeat_delay", - l10n_util::GetString( + localized_strings->SetString("repeat_delay", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_DELAY)); - localized_strings->SetString(L"repeat_delay_short", - l10n_util::GetString( + localized_strings->SetString("repeat_delay_short", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_DELAY_SHORT)); - localized_strings->SetString(L"repeat_delay_long", - l10n_util::GetString( + localized_strings->SetString("repeat_delay_long", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_DELAY_LONG)); - localized_strings->SetString(L"repeat_delay_min", - UTF8ToWide(base::IntToString( - chromeos::kXkbAutoRepeatDelayPref.min_pref_value))); - localized_strings->SetString(L"repeat_delay_max", - UTF8ToWide(base::IntToString( - chromeos::kXkbAutoRepeatDelayPref.max_pref_value))); - localized_strings->SetString(L"repeat_speed", - l10n_util::GetString( + localized_strings->SetString("repeat_delay_min", + base::IntToString(chromeos::kXkbAutoRepeatDelayPref.min_pref_value)); + localized_strings->SetString("repeat_delay_max", + base::IntToString(chromeos::kXkbAutoRepeatDelayPref.max_pref_value)); + localized_strings->SetString("repeat_speed", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_SPEED)); - localized_strings->SetString(L"repeat_speed_fast", - l10n_util::GetString( + localized_strings->SetString("repeat_speed_fast", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_SPEED_FAST)); - localized_strings->SetString(L"repeat_speed_slow", - l10n_util::GetString( + localized_strings->SetString("repeat_speed_slow", + l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_SPEED_SLOW)); - localized_strings->SetString(L"repeat_speed_min", - UTF8ToWide(base::IntToString( - chromeos::kXkbAutoRepeatIntervalPref.min_pref_value))); - localized_strings->SetString(L"repeat_speed_max", - UTF8ToWide(base::IntToString( - chromeos::kXkbAutoRepeatIntervalPref.max_pref_value))); - - localized_strings->SetString(L"accessibility_title", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); - localized_strings->SetString(L"accessibility", - l10n_util::GetString(IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); - - localized_strings->Set(L"timezoneList", GetTimezoneList()); + localized_strings->SetString("repeat_speed_min", + base::IntToString(chromeos::kXkbAutoRepeatIntervalPref.min_pref_value)); + localized_strings->SetString("repeat_speed_max", + base::IntToString(chromeos::kXkbAutoRepeatIntervalPref.max_pref_value)); + + localized_strings->SetString("accessibility_title", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); + localized_strings->SetString("accessibility", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); + + localized_strings->Set("timezoneList", GetTimezoneList()); } ListValue* SystemOptionsHandler::GetTimezoneList() { @@ -151,29 +151,27 @@ ListValue* SystemOptionsHandler::GetTimezoneList() { return timezoneList; } -std::wstring SystemOptionsHandler::GetTimezoneName( - const icu::TimeZone* timezone) { +string16 SystemOptionsHandler::GetTimezoneName(const icu::TimeZone* timezone) { DCHECK(timezone); icu::UnicodeString name; timezone->getDisplayName(name); - std::wstring output; - UTF16ToWide(name.getBuffer(), name.length(), &output); + string16 output(name.getBuffer(), name.length()); int hour_offset = timezone->getRawOffset() / 3600000; + // TODO(viettrungluu): Avoid wide string (need string16 StringPrintf()). Also, + // this formatting doesn't look properly internationalized (e.g., for RTL). const wchar_t* format; if (hour_offset == 0) format = L"(GMT) "; else format = L"(GMT%+d) "; - return StringPrintf(format, hour_offset) + output; + return WideToUTF16Hack(StringPrintf(format, hour_offset)) + output; } -std::wstring SystemOptionsHandler::GetTimezoneID( - const icu::TimeZone* timezone) { +string16 SystemOptionsHandler::GetTimezoneID(const icu::TimeZone* timezone) { DCHECK(timezone); icu::UnicodeString id; timezone->getID(id); - std::wstring output; - UTF16ToWide(id.getBuffer(), id.length(), &output); + string16 output(id.getBuffer(), id.length()); return output; } diff --git a/chrome/browser/chromeos/dom_ui/system_options_handler.h b/chrome/browser/chromeos/dom_ui/system_options_handler.h index d6fe6aa..63a1058 100644 --- a/chrome/browser/chromeos/dom_ui/system_options_handler.h +++ b/chrome/browser/chromeos/dom_ui/system_options_handler.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_CHROMEOS_DOM_UI_SYSTEM_OPTIONS_HANDLER_H_ #pragma once -#include <string> #include <vector> +#include "base/string16.h" #include "chrome/browser/dom_ui/options_ui.h" #include "third_party/icu/public/i18n/unicode/timezone.h" @@ -26,10 +26,10 @@ class SystemOptionsHandler : public OptionsPageUIHandler { ListValue* GetTimezoneList(); // Gets timezone name. - std::wstring GetTimezoneName(const icu::TimeZone* timezone); + string16 GetTimezoneName(const icu::TimeZone* timezone); // Gets timezone ID which is also used as timezone pref value. - std::wstring GetTimezoneID(const icu::TimeZone* timezone); + string16 GetTimezoneID(const icu::TimeZone* timezone); // Timezones. std::vector<icu::TimeZone*> timezones_; |