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/tab_contents | |
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/tab_contents')
5 files changed, 17 insertions, 19 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index cbe8d0f..6efd343 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -255,8 +255,8 @@ NavigationEntry* NavigationController::CreateNavigationEntry( entry->set_user_typed_url(url); entry->set_update_virtual_url_with_url(reverse_on_redirect); if (url.SchemeIsFile()) { - std::wstring languages = profile->GetPrefs()->GetString( - prefs::kAcceptLanguages); + std::wstring languages = UTF8ToWide(profile->GetPrefs()->GetString( + prefs::kAcceptLanguages)); entry->set_title(WideToUTF16Hack( file_util::GetFilenameFromPath(net::FormatUrl(url, languages)))); } diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc index cd42683..4ce5bda 100644 --- a/chrome/browser/tab_contents/navigation_entry.cc +++ b/chrome/browser/tab_contents/navigation_entry.cc @@ -90,8 +90,8 @@ const string16& NavigationEntry::GetTitleForDisplay( // Use the virtual URL first if any, and fall back on using the real URL. std::wstring languages; if (navigation_controller) { - languages = navigation_controller->profile()->GetPrefs()->GetString( - prefs::kAcceptLanguages); + languages = UTF8ToWide(navigation_controller->profile()->GetPrefs()-> + GetString(prefs::kAcceptLanguages)); } std::wstring title; diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 0d03414..8fb7fa2 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -971,7 +971,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) { StringPrefMember dictionary_language; dictionary_language.Init(prefs::kSpellCheckDictionary, profile_->GetPrefs(), NULL); - dictionary_language.SetValue(ASCIIToWide(languages[language_number])); + dictionary_language.SetValue(languages[language_number]); } return; } @@ -1365,7 +1365,7 @@ void RenderViewContextMenu::Inspect(int x, int y) { void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { chrome_browser_net::WriteURLToClipboard( url, - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), + UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), g_browser_process->clipboard()); } diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 6edd873..a530642 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -183,19 +183,19 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( WebPreferences web_prefs; web_prefs.fixed_font_family = - prefs->GetString(prefs::kWebKitFixedFontFamily); + UTF8ToWide(prefs->GetString(prefs::kWebKitFixedFontFamily)); web_prefs.serif_font_family = - prefs->GetString(prefs::kWebKitSerifFontFamily); + UTF8ToWide(prefs->GetString(prefs::kWebKitSerifFontFamily)); web_prefs.sans_serif_font_family = - prefs->GetString(prefs::kWebKitSansSerifFontFamily); + UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)); if (prefs->GetBoolean(prefs::kWebKitStandardFontIsSerif)) web_prefs.standard_font_family = web_prefs.serif_font_family; else web_prefs.standard_font_family = web_prefs.sans_serif_font_family; web_prefs.cursive_font_family = - prefs->GetString(prefs::kWebKitCursiveFontFamily); + UTF8ToWide(prefs->GetString(prefs::kWebKitCursiveFontFamily)); web_prefs.fantasy_font_family = - prefs->GetString(prefs::kWebKitFantasyFontFamily); + UTF8ToWide(prefs->GetString(prefs::kWebKitFantasyFontFamily)); web_prefs.default_font_size = prefs->GetInteger(prefs::kWebKitDefaultFontSize); @@ -206,8 +206,7 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( web_prefs.minimum_logical_font_size = prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); - web_prefs.default_encoding = - WideToASCII(prefs->GetString(prefs::kDefaultCharset)); + web_prefs.default_encoding = prefs->GetString(prefs::kDefaultCharset); web_prefs.javascript_can_open_windows_automatically = prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); @@ -290,8 +289,7 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( web_prefs.default_encoding); if (web_prefs.default_encoding.empty()) { prefs->ClearPref(prefs::kDefaultCharset); - web_prefs.default_encoding = WideToASCII( - prefs->GetString(prefs::kDefaultCharset)); + web_prefs.default_encoding = prefs->GetString(prefs::kDefaultCharset); } DCHECK(!web_prefs.default_encoding.empty()); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index e3d1870..43c1a1f 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -1835,7 +1835,7 @@ void TabContents::GenerateKeywordIfNecessary( } const TemplateURL* current_url; - std::wstring url = UTF8ToWide(params.searchable_form_url.spec()); + GURL url = params.searchable_form_url; if (!url_model->CanReplaceKeyword(keyword, url, ¤t_url)) return; @@ -1850,7 +1850,7 @@ void TabContents::GenerateKeywordIfNecessary( TemplateURL* new_url = new TemplateURL(); new_url->set_keyword(keyword); new_url->set_short_name(keyword); - new_url->SetURL(url, 0, 0); + new_url->SetURL(url.spec(), 0, 0); new_url->add_input_encoding(params.searchable_form_encoding); DCHECK(controller_.GetLastCommittedEntry()); const GURL& favicon_url = @@ -2818,7 +2818,7 @@ void TabContents::LoadStateChanged(const GURL& url, upload_position_ = upload_position; upload_size_ = upload_size; std::wstring languages = - profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); + UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); std::string host = url.host(); load_state_host_ = net::IDNToUnicode(host.c_str(), host.size(), languages, NULL); @@ -3050,7 +3050,7 @@ std::wstring TabContents::GetMessageBoxTitle(const GURL& frame_url, // TODO(brettw) it should be easier than this to do the correct language // handling without getting the accept language from the profile. std::wstring base_address = gfx::ElideUrl(clean_url, gfx::Font(), 0, - profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); + UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages))); // Force URL to have LTR directionality. base::i18n::GetDisplayStringInLTRDirectionality(&base_address); |