diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 20:35:19 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 20:35:19 +0000 |
commit | ddd231eaa03153f6d04894cceb0b4480755e1277 (patch) | |
tree | faafed02945c1f8934e6e393ac0c6b094c303cdf /chrome/browser/gtk | |
parent | c5e30d8572ffae1e0d4fbb2fff765f9a8cbace77 (diff) | |
download | chromium_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/gtk')
-rw-r--r-- | chrome/browser/gtk/browser_toolbar_gtk.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/edit_search_engine_dialog.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/edit_search_engine_dialog.h | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/keyword_editor_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/keyword_editor_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/keyword_editor_view_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/options/fonts_page_gtk.cc | 10 | ||||
-rw-r--r-- | chrome/browser/gtk/options/general_page_gtk.cc | 9 | ||||
-rw-r--r-- | chrome/browser/gtk/options/languages_page_gtk.cc | 17 | ||||
-rw-r--r-- | chrome/browser/gtk/options/languages_page_gtk_unittest.cc | 82 | ||||
-rw-r--r-- | chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/options/passwords_page_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/options/url_picker_dialog_gtk.cc | 2 |
14 files changed, 79 insertions, 83 deletions
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc index 47dad14..907f1f5 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_toolbar_gtk.cc @@ -711,9 +711,8 @@ void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, bool url_is_newtab = url.spec() == chrome::kChromeUINewTabURL; home_page_is_new_tab_page_.SetValue(url_is_newtab); - if (!url_is_newtab) { - home_page_.SetValue(UTF8ToWide(url.spec())); - } + if (!url_is_newtab) + home_page_.SetValue(url.spec()); } void BrowserToolbarGtk::NotifyPrefChanged(const std::wstring* pref) { diff --git a/chrome/browser/gtk/edit_search_engine_dialog.cc b/chrome/browser/gtk/edit_search_engine_dialog.cc index ec7590b..a91ad05 100644 --- a/chrome/browser/gtk/edit_search_engine_dialog.cc +++ b/chrome/browser/gtk/edit_search_engine_dialog.cc @@ -235,8 +235,8 @@ std::wstring EditSearchEngineDialog::GetKeywordInput() const { return UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(keyword_entry_))); } -std::wstring EditSearchEngineDialog::GetURLInput() const { - return UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(url_entry_))); +std::string EditSearchEngineDialog::GetURLInput() const { + return gtk_entry_get_text(GTK_ENTRY(url_entry_)); } void EditSearchEngineDialog::EnableControls() { diff --git a/chrome/browser/gtk/edit_search_engine_dialog.h b/chrome/browser/gtk/edit_search_engine_dialog.h index 1793671..c7afbef 100644 --- a/chrome/browser/gtk/edit_search_engine_dialog.h +++ b/chrome/browser/gtk/edit_search_engine_dialog.h @@ -32,7 +32,7 @@ class EditSearchEngineDialog { // Retrieve the user input in the various fields. std::wstring GetTitleInput() const; std::wstring GetKeywordInput() const; - std::wstring GetURLInput() const; + std::string GetURLInput() const; // Set sensitivity of buttons based on entry state. void EnableControls(); diff --git a/chrome/browser/gtk/keyword_editor_view.cc b/chrome/browser/gtk/keyword_editor_view.cc index 199c624..9a2eab5 100644 --- a/chrome/browser/gtk/keyword_editor_view.cc +++ b/chrome/browser/gtk/keyword_editor_view.cc @@ -59,7 +59,7 @@ void KeywordEditorView::Show(Profile* profile) { void KeywordEditorView::OnEditedKeyword(const TemplateURL* template_url, const std::wstring& title, const std::wstring& keyword, - const std::wstring& url) { + const std::string& url) { if (template_url) { controller_->ModifyTemplateURL(template_url, title, keyword, url); diff --git a/chrome/browser/gtk/keyword_editor_view.h b/chrome/browser/gtk/keyword_editor_view.h index 7ba6e6c..a5d5f9e 100644 --- a/chrome/browser/gtk/keyword_editor_view.h +++ b/chrome/browser/gtk/keyword_editor_view.h @@ -31,7 +31,7 @@ class KeywordEditorView : public TableModelObserver, virtual void OnEditedKeyword(const TemplateURL* template_url, const std::wstring& title, const std::wstring& keyword, - const std::wstring& url); + const std::string& url); private: // Column ids for |list_store_|. enum { diff --git a/chrome/browser/gtk/keyword_editor_view_unittest.cc b/chrome/browser/gtk/keyword_editor_view_unittest.cc index 8f2cd93..431a868 100644 --- a/chrome/browser/gtk/keyword_editor_view_unittest.cc +++ b/chrome/browser/gtk/keyword_editor_view_unittest.cc @@ -30,7 +30,7 @@ class KeywordEditorViewTest : public testing::Test { TemplateURL* template_url = new TemplateURL(); template_url->set_short_name(UTF8ToWide(name)); template_url->set_keyword(UTF8ToWide(keyword)); - template_url->SetURL(L"http://example.com/{searchTerms}", 0, 0); + template_url->SetURL("http://example.com/{searchTerms}", 0, 0); profile_->GetTemplateURLModel()->Add(template_url); if (make_default) profile_->GetTemplateURLModel()->SetDefaultSearchProvider(template_url); @@ -105,7 +105,7 @@ TEST_F(KeywordEditorViewTest, Add) { EXPECT_STREQ("!,_,A1 (Default),_,@,_", GetDisplayedEngines(editor).c_str()); EXPECT_EQ(-1, GetSelectedRowNum(editor)); - editor.OnEditedKeyword(NULL, L"B", L"b", L"example.com"); + editor.OnEditedKeyword(NULL, L"B", L"b", "example.com"); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.edit_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.remove_button_)); @@ -113,7 +113,7 @@ TEST_F(KeywordEditorViewTest, Add) { EXPECT_STREQ("!,_,A1 (Default),_,@,_,B", GetDisplayedEngines(editor).c_str()); EXPECT_EQ(6, GetSelectedRowNum(editor)); - editor.OnEditedKeyword(NULL, L"C", L"c", L"example.com/{searchTerms}"); + editor.OnEditedKeyword(NULL, L"C", L"c", "example.com/{searchTerms}"); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.edit_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.remove_button_)); @@ -122,7 +122,7 @@ TEST_F(KeywordEditorViewTest, Add) { GetDisplayedEngines(editor).c_str()); EXPECT_EQ(7, GetSelectedRowNum(editor)); - editor.OnEditedKeyword(NULL, L"D", L"d", L"example.com"); + editor.OnEditedKeyword(NULL, L"D", L"d", "example.com"); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.edit_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(editor.remove_button_)); @@ -239,23 +239,23 @@ TEST_F(KeywordEditorViewTest, Edit) { EXPECT_STREQ("!,_,A,B (Default),_,@,_,C,D", GetDisplayedEngines(editor).c_str()); - editor.OnEditedKeyword(a, L"AA", L"a", L"example.com/{searchTerms}"); + editor.OnEditedKeyword(a, L"AA", L"a", "example.com/{searchTerms}"); EXPECT_STREQ("!,_,AA,B (Default),_,@,_,C,D", GetDisplayedEngines(editor).c_str()); - editor.OnEditedKeyword(b, L"BB", L"b", L"foo.example.com/{searchTerms}"); + editor.OnEditedKeyword(b, L"BB", L"b", "foo.example.com/{searchTerms}"); EXPECT_STREQ("!,_,AA,BB (Default),_,@,_,C,D", GetDisplayedEngines(editor).c_str()); - editor.OnEditedKeyword(b, L"BBB", L"b", L"example.com"); + editor.OnEditedKeyword(b, L"BBB", L"b", "example.com"); EXPECT_STREQ("!,_,AA,BBB,_,@,_,C,D", GetDisplayedEngines(editor).c_str()); - editor.OnEditedKeyword(d, L"DD", L"d", L"example.com"); + editor.OnEditedKeyword(d, L"DD", L"d", "example.com"); EXPECT_STREQ("!,_,AA,BBB,_,@,_,C,DD", GetDisplayedEngines(editor).c_str()); - editor.OnEditedKeyword(c, L"CC", L"cc", L"example.com"); + editor.OnEditedKeyword(c, L"CC", L"cc", "example.com"); EXPECT_STREQ("!,_,AA,BBB,_,@,_,CC,DD", GetDisplayedEngines(editor).c_str()); } diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 3972ab6..7882451 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -1162,7 +1162,8 @@ gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed( GURL url = tab_contents->GetURL(); std::wstring display_host; net::AppendFormattedHost(url, - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), &display_host, + UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), + &display_host, NULL, NULL); info_bubble_ = new ContentSettingBubbleGtk( diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc index 96c918e..f5b1902 100644 --- a/chrome/browser/gtk/options/fonts_page_gtk.cc +++ b/chrome/browser/gtk/options/fonts_page_gtk.cc @@ -18,12 +18,12 @@ namespace { // Make a Gtk font name string from a font family name and pixel size. -std::string MakeFontName(std::wstring family_name, int pixel_size) { +std::string MakeFontName(std::string family_name, int pixel_size) { // The given font might not be available (the default fonts we use are not // installed by default on some distros). So figure out which font we are // actually falling back to and display that. (See crbug.com/31381.) std::wstring actual_family_name = gfx::Font::CreateFont( - family_name, pixel_size).FontName(); + UTF8ToWide(family_name), pixel_size).FontName(); std::string fontname; // TODO(mattm): We can pass in the size in pixels (px), and the font button // actually honors it, but when you open the selector it interprets it as @@ -152,7 +152,7 @@ void FontsPageGtk::SetFontsFromButton(StringPrefMember* name_pref, PangoFontDescription* desc = pango_font_description_from_string( gtk_font_button_get_font_name(GTK_FONT_BUTTON(font_button))); int size = pango_font_description_get_size(desc); - name_pref->SetValue(UTF8ToWide(pango_font_description_get_family(desc))); + name_pref->SetValue(pango_font_description_get_family(desc)); size_pref->SetValue(size / PANGO_SCALE); pango_font_description_free(desc); // Reset the button font in px, since the chooser will have set it in points. @@ -181,6 +181,6 @@ void FontsPageGtk::OnFixedFontSet(GtkWidget* font_button) { void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) { int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); - default_encoding_.SetValue(ASCIIToWide(default_encoding_combobox_model_-> - GetEncodingCharsetByIndex(index))); + default_encoding_.SetValue(default_encoding_combobox_model_-> + GetEncodingCharsetByIndex(index)); } diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index 0df5b20..d2f240b 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -161,8 +161,7 @@ void GeneralPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { *pref_name == prefs::kHomePage) { bool managed = new_tab_page_is_home_page_.IsManaged() || homepage_.IsManaged(); - bool homepage_valid = - homepage_.GetValue() != UTF8ToWide(chrome::kChromeUINewTabURL); + bool homepage_valid = homepage_.GetValue() != chrome::kChromeUINewTabURL; bool use_new_tab_page_for_homepage = new_tab_page_is_home_page_.GetValue() || !homepage_valid; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(homepage_use_newtab_radio_), @@ -173,7 +172,7 @@ void GeneralPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { gtk_widget_set_sensitive(homepage_use_url_radio_, !managed); if (homepage_valid) gtk_entry_set_text(GTK_ENTRY(homepage_use_url_entry_), - WideToUTF8(homepage_.GetValue()).c_str()); + homepage_.GetValue().c_str()); gtk_widget_set_sensitive(homepage_use_url_entry_, !managed && !use_new_tab_page_for_homepage); } @@ -642,10 +641,10 @@ void GeneralPageGtk::SetHomepage(const GURL& homepage) { if (!homepage.is_valid() || homepage.spec() == chrome::kChromeUINewTabURL) { new_tab_page_is_home_page_.SetValue(true); if (!homepage.has_host()) - homepage_.SetValue(std::wstring()); + homepage_.SetValue(std::string()); } else { new_tab_page_is_home_page_.SetValue(false); - homepage_.SetValue(UTF8ToWide(homepage.spec())); + homepage_.SetValue(homepage.spec()); } } diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc index 5406db7..59eaacf 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.cc +++ b/chrome/browser/gtk/options/languages_page_gtk.cc @@ -281,10 +281,8 @@ void LanguagesPageGtk::SetColumnValues(int row, GtkTreeIter* iter) { } void LanguagesPageGtk::OnAnyModelUpdate() { - if (!initializing_) { - accept_languages_.SetValue(ASCIIToWide( - language_order_table_model_->GetLanguageList())); - } + if (!initializing_) + accept_languages_.SetValue(language_order_table_model_->GetLanguageList()); EnableControls(); } @@ -317,7 +315,7 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { initializing_ = true; if (!pref_name || *pref_name == prefs::kAcceptLanguages) { language_order_table_model_->SetAcceptLanguagesString( - WideToASCII(accept_languages_.GetValue())); + accept_languages_.GetValue()); } if (!pref_name || *pref_name == prefs::kSpellCheckDictionary) { int index = dictionary_language_model_->GetSelectedLanguageIndex( @@ -325,10 +323,9 @@ void LanguagesPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { // If not found, fall back from "language-region" to "language". if (index < 0) { - const std::string& lang_region = WideToASCII( - dictionary_language_.GetValue()); - dictionary_language_.SetValue(ASCIIToWide( - SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region))); + const std::string& lang_region = dictionary_language_.GetValue(); + dictionary_language_.SetValue( + SpellCheckCommon::GetLanguageFromLanguageRegion(lang_region)); index = dictionary_language_model_->GetSelectedLanguageIndex( prefs::kSpellCheckDictionary); } @@ -449,5 +446,5 @@ void LanguagesPageGtk::OnDictionaryLanguageChanged(GtkWidget* widget) { UserMetricsRecordAction(UserMetricsAction("Options_DictionaryLanguage"), profile()->GetPrefs()); - dictionary_language_.SetValue(ASCIIToWide(language)); + dictionary_language_.SetValue(language); } diff --git a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc index e587363..cf68dbb 100644 --- a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc +++ b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc @@ -56,7 +56,7 @@ class LanguagesPageGtkTest : public testing::Test { }; TEST_F(LanguagesPageGtkTest, RemoveAcceptLang) { - profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, L"en,ja,es"); + profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en,ja,es"); LanguagesPageGtk page(profile_.get()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); @@ -74,8 +74,8 @@ TEST_F(LanguagesPageGtkTest, RemoveAcceptLang) { gtk_button_clicked(GTK_BUTTON(page.remove_button_)); EXPECT_STREQ("English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.remove_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); @@ -92,8 +92,8 @@ TEST_F(LanguagesPageGtkTest, RemoveAcceptLang) { gtk_button_clicked(GTK_BUTTON(page.remove_button_)); EXPECT_STREQ("English", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.remove_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); @@ -110,8 +110,8 @@ TEST_F(LanguagesPageGtkTest, RemoveAcceptLang) { gtk_button_clicked(GTK_BUTTON(page.remove_button_)); EXPECT_STREQ("", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.remove_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); @@ -120,7 +120,7 @@ TEST_F(LanguagesPageGtkTest, RemoveAcceptLang) { } TEST_F(LanguagesPageGtkTest, RemoveMultipleAcceptLang) { - profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, L"en,ja,es,fr,it"); + profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en,ja,es,fr,it"); LanguagesPageGtk page(profile_.get()); GtkTreeIter iter; gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(page.language_order_store_), @@ -136,8 +136,8 @@ TEST_F(LanguagesPageGtkTest, RemoveMultipleAcceptLang) { gtk_button_clicked(GTK_BUTTON(page.remove_button_)); EXPECT_STREQ("English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.remove_button_)); EXPECT_EQ(1, page.FirstSelectedRowNum()); @@ -151,14 +151,14 @@ TEST_F(LanguagesPageGtkTest, RemoveMultipleAcceptLang) { gtk_button_clicked(GTK_BUTTON(page.remove_button_)); EXPECT_STREQ("", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.remove_button_)); EXPECT_EQ(-1, page.FirstSelectedRowNum()); } TEST_F(LanguagesPageGtkTest, MoveAcceptLang) { - profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, L"en,ja,es"); + profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en,ja,es"); LanguagesPageGtk page(profile_.get()); EXPECT_STREQ("English,Japanese,Spanish", GetDisplayedLangs(page).c_str()); GtkTreeIter iter; @@ -173,33 +173,33 @@ TEST_F(LanguagesPageGtkTest, MoveAcceptLang) { EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); EXPECT_STREQ("Japanese,English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("ja,en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("ja,en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); gtk_button_clicked(GTK_BUTTON(page.move_down_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); EXPECT_STREQ("Japanese,Spanish,English", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("ja,es,en", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("ja,es,en", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); gtk_button_clicked(GTK_BUTTON(page.move_up_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); EXPECT_STREQ("Japanese,English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("ja,en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("ja,en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); gtk_button_clicked(GTK_BUTTON(page.move_up_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); EXPECT_STREQ("English,Japanese,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en,ja,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en,ja,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); } TEST_F(LanguagesPageGtkTest, AddAcceptLang) { - profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, L""); + profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, ""); LanguagesPageGtk page(profile_.get()); EXPECT_STREQ("", GetDisplayedLangs(page).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); @@ -209,8 +209,8 @@ TEST_F(LanguagesPageGtkTest, AddAcceptLang) { page.OnAddLanguage("en"); EXPECT_STREQ("English", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); @@ -219,8 +219,8 @@ TEST_F(LanguagesPageGtkTest, AddAcceptLang) { page.OnAddLanguage("es"); EXPECT_STREQ("English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); @@ -231,8 +231,8 @@ TEST_F(LanguagesPageGtkTest, AddAcceptLang) { gtk_tree_selection_unselect_all(page.language_order_selection_); page.OnAddLanguage("en"); EXPECT_STREQ("English,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("en,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("en,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(page.add_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_up_button_)); EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(page.move_down_button_)); @@ -265,20 +265,20 @@ TEST_F(LanguagesPageGtkTest, EnableSpellChecking) { // TODO(mattm): add EnableAutoSpellChecking test TEST_F(LanguagesPageGtkTest, DictionaryLanguage) { - profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, L"it"); - profile_->GetPrefs()->SetString(prefs::kSpellCheckDictionary, L"es"); + profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "it"); + profile_->GetPrefs()->SetString(prefs::kSpellCheckDictionary, "es"); LanguagesPageGtk page(profile_.get()); EXPECT_STREQ("Italian", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("it", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("it", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_STREQ("Spanish", GetDisplayedSpellCheckerLang(page).c_str()); int spanish_index = gtk_combo_box_get_active( GTK_COMBO_BOX(page.dictionary_language_combobox_)); - profile_->GetPrefs()->SetString(prefs::kSpellCheckDictionary, L"fr"); + profile_->GetPrefs()->SetString(prefs::kSpellCheckDictionary, "fr"); EXPECT_STREQ("Italian", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("it", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("it", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_STREQ("French", GetDisplayedSpellCheckerLang(page).c_str()); int french_index = gtk_combo_box_get_active( GTK_COMBO_BOX(page.dictionary_language_combobox_)); @@ -286,22 +286,22 @@ TEST_F(LanguagesPageGtkTest, DictionaryLanguage) { gtk_combo_box_set_active( GTK_COMBO_BOX(page.dictionary_language_combobox_), spanish_index); EXPECT_STREQ("Italian,Spanish", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("it,es", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("it,es", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_STREQ("Spanish", GetDisplayedSpellCheckerLang(page).c_str()); gtk_combo_box_set_active( GTK_COMBO_BOX(page.dictionary_language_combobox_), french_index); EXPECT_STREQ("Italian,French", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("it,fr", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("it,fr", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_STREQ("French", GetDisplayedSpellCheckerLang(page).c_str()); gtk_combo_box_set_active( GTK_COMBO_BOX(page.dictionary_language_combobox_), page.dictionary_language_model_->GetIndexFromLocale("it")); EXPECT_STREQ("Italian", GetDisplayedLangs(page).c_str()); - EXPECT_STREQ("it", WideToASCII( - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)).c_str()); + EXPECT_STREQ("it", + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages).c_str()); EXPECT_STREQ("Italian", GetDisplayedSpellCheckerLang(page).c_str()); } diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc index 4495bdf..82f6a25 100644 --- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc +++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc @@ -111,8 +111,8 @@ PasswordStore* PasswordsExceptionsPageGtk::GetPasswordStore() { void PasswordsExceptionsPageGtk::SetExceptionList( const std::vector<webkit_glue::PasswordForm*>& result) { - std::wstring languages = - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); + std::wstring languages = UTF8ToWide( + profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); gtk_list_store_clear(exception_list_store_); STLDeleteElements(&exception_list_); exception_list_ = result; diff --git a/chrome/browser/gtk/options/passwords_page_gtk.cc b/chrome/browser/gtk/options/passwords_page_gtk.cc index 75ee9a2..26fd572 100644 --- a/chrome/browser/gtk/options/passwords_page_gtk.cc +++ b/chrome/browser/gtk/options/passwords_page_gtk.cc @@ -156,7 +156,7 @@ PasswordStore* PasswordsPageGtk::GetPasswordStore() { void PasswordsPageGtk::SetPasswordList( const std::vector<webkit_glue::PasswordForm*>& result) { std::wstring languages = - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); + UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); gtk_list_store_clear(password_list_store_); STLDeleteElements(&password_list_); password_list_ = result; diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc index 515eb47..5298a1d 100644 --- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc +++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc @@ -196,7 +196,7 @@ std::string UrlPickerDialogGtk::GetURLForPath(GtkTreePath* path) const { return std::string(); } std::wstring languages = - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); + UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); // Because this gets parsed by FixupURL(), it's safe to omit the scheme or // trailing slash, and unescape most characters, but we need to not drop any // username/password, or unescape anything that changes the meaning. |