summaryrefslogtreecommitdiffstats
path: root/chrome/browser
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
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')
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc8
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc2
-rw-r--r--chrome/browser/autocomplete/history_url_provider.cc6
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc6
-rw-r--r--chrome/browser/autocomplete/keyword_provider_unittest.cc16
-rw-r--r--chrome/browser/autocomplete/search_provider.cc13
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc24
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/automation/automation_provider.h2
-rw-r--r--chrome/browser/browser.cc21
-rw-r--r--chrome/browser/browser_encoding_uitest.cc2
-rw-r--r--chrome/browser/browser_init.cc4
-rw-r--r--chrome/browser/browser_main.cc8
-rw-r--r--chrome/browser/browser_theme_provider.cc5
-rw-r--r--chrome/browser/character_encoding.cc8
-rw-r--r--chrome/browser/character_encoding.h2
-rw-r--r--chrome/browser/chromeos/language_preferences.h10
-rw-r--r--chrome/browser/chromeos/login/language_switch_menu.cc2
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc2
-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
-rw-r--r--chrome/browser/chromeos/preferences.cc42
-rw-r--r--chrome/browser/chromeos/preferences.h8
-rw-r--r--chrome/browser/chromeos/status/clock_menu_button_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/status/language_menu_button.cc19
-rw-r--r--chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm4
-rw-r--r--chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/font_language_settings_controller.mm16
-rw-r--r--chrome/browser/cocoa/keyword_editor_cocoa_controller.h2
-rw-r--r--chrome/browser/cocoa/keyword_editor_cocoa_controller.mm2
-rw-r--r--chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm8
-rw-r--r--chrome/browser/cocoa/location_bar/location_bar_view_mac.mm7
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm14
-rw-r--r--chrome/browser/cocoa/search_engine_list_model_unittest.mm10
-rw-r--r--chrome/browser/content_setting_bubble_model.cc2
-rw-r--r--chrome/browser/custom_home_pages_table_model.cc2
-rw-r--r--chrome/browser/default_encoding_combo_model.cc4
-rw-r--r--chrome/browser/dom_ui/core_options_handler.cc2
-rw-r--r--chrome/browser/dom_ui/ntp_resource_cache.cc8
-rw-r--r--chrome/browser/dom_ui/tips_handler.cc5
-rw-r--r--chrome/browser/download/download_manager.cc35
-rw-r--r--chrome/browser/download/save_package.cc10
-rw-r--r--chrome/browser/encoding_menu_controller.cc14
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc3
-rw-r--r--chrome/browser/extensions/extension_i18n_api.cc11
-rw-r--r--chrome/browser/extensions/extension_updater.cc10
-rw-r--r--chrome/browser/extensions/extension_updater_unittest.cc4
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc3
-rw-r--r--chrome/browser/geolocation/geolocation_settings_state.cc2
-rw-r--r--chrome/browser/google_url_tracker.cc6
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc5
-rw-r--r--chrome/browser/gtk/edit_search_engine_dialog.cc4
-rw-r--r--chrome/browser/gtk/edit_search_engine_dialog.h2
-rw-r--r--chrome/browser/gtk/keyword_editor_view.cc2
-rw-r--r--chrome/browser/gtk/keyword_editor_view.h2
-rw-r--r--chrome/browser/gtk/keyword_editor_view_unittest.cc18
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc3
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.cc10
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.cc9
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.cc17
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk_unittest.cc82
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc4
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/url_picker_dialog_gtk.cc2
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc10
-rw-r--r--chrome/browser/importer/ie_importer.cc11
-rw-r--r--chrome/browser/importer/importer_messages.h2
-rw-r--r--chrome/browser/importer/importer_unittest.cc62
-rw-r--r--chrome/browser/importer/profile_writer.cc12
-rw-r--r--chrome/browser/intranet_redirect_detector.cc6
-rw-r--r--chrome/browser/language_combobox_model.cc3
-rw-r--r--chrome/browser/managed_prefs_banner_base_unittest.cc6
-rw-r--r--chrome/browser/metrics/metrics_log.cc2
-rw-r--r--chrome/browser/metrics/metrics_service.cc10
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc22
-rw-r--r--chrome/browser/possible_url_model.cc6
-rw-r--r--chrome/browser/pref_member.cc2
-rw-r--r--chrome/browser/pref_member.h6
-rw-r--r--chrome/browser/pref_member_unittest.cc40
-rw-r--r--chrome/browser/pref_service.cc6
-rw-r--r--chrome/browser/pref_service.h4
-rw-r--r--chrome/browser/pref_service_unittest.cc40
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc4
-rw-r--r--chrome/browser/profile.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc8
-rw-r--r--chrome/browser/search_engines/edit_search_engine_controller.cc28
-rw-r--r--chrome/browser/search_engines/edit_search_engine_controller.h8
-rw-r--r--chrome/browser/search_engines/keyword_editor_controller.cc5
-rw-r--r--chrome/browser/search_engines/keyword_editor_controller.h4
-rw-r--r--chrome/browser/search_engines/keyword_editor_controller_unittest.cc12
-rw-r--r--chrome/browser/search_engines/template_url.cc151
-rw-r--r--chrome/browser/search_engines/template_url.h32
-rw-r--r--chrome/browser/search_engines/template_url_fetcher.cc4
-rw-r--r--chrome/browser/search_engines/template_url_model.cc63
-rw-r--r--chrome/browser/search_engines/template_url_model.h7
-rw-r--r--chrome/browser/search_engines/template_url_model_unittest.cc84
-rw-r--r--chrome/browser/search_engines/template_url_parser.cc16
-rw-r--r--chrome/browser/search_engines/template_url_parser_unittest.cc26
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc8
-rw-r--r--chrome/browser/search_engines/template_url_table_model.cc4
-rw-r--r--chrome/browser/search_engines/template_url_table_model.h2
-rw-r--r--chrome/browser/search_engines/template_url_unittest.cc194
-rw-r--r--chrome/browser/spellcheck_host.cc12
-rw-r--r--chrome/browser/sync/glue/preference_model_associator_unittest.cc16
-rw-r--r--chrome/browser/sync/profile_sync_service_preference_unittest.cc18
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc4
-rw-r--r--chrome/browser/tab_contents/navigation_entry.cc4
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc4
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc16
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc8
-rw-r--r--chrome/browser/toolbar_model.cc5
-rw-r--r--chrome/browser/translate/translate_manager.cc4
-rw-r--r--chrome/browser/translate/translate_manager2.cc6
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc5
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc2
-rw-r--r--chrome/browser/views/edit_search_engine_dialog.cc7
-rw-r--r--chrome/browser/views/keyword_editor_view.cc2
-rw-r--r--chrome/browser/views/keyword_editor_view.h2
-rw-r--r--chrome/browser/views/options/exceptions_page_view.cc3
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc16
-rw-r--r--chrome/browser/views/options/general_page_view.cc24
-rw-r--r--chrome/browser/views/options/languages_page_view.cc21
-rw-r--r--chrome/browser/views/options/passwords_page_view.cc3
-rw-r--r--chrome/browser/views/url_picker.cc4
-rw-r--r--chrome/browser/web_resource/web_resource_service.cc13
-rw-r--r--chrome/browser/webdata/web_database.cc8
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc8
132 files changed, 881 insertions, 880 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 1846e2d..e42ee92 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -598,8 +598,12 @@ void AutocompleteProvider::UpdateStarredStateOfMatches() {
std::wstring AutocompleteProvider::StringForURLDisplay(const GURL& url,
bool check_accept_lang,
bool trim_http) const {
- return net::FormatUrl(url, (check_accept_lang && profile_) ?
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(),
+ std::wstring languages = (check_accept_lang && profile_) ?
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) :
+ std::wstring();
+ return net::FormatUrl(
+ url,
+ languages,
net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP),
UnescapeRule::SPACES, NULL, NULL, NULL);
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
index 35dbff5..e267f3c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
@@ -192,7 +192,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest,
ASSERT_TRUE(model->loaded());
TemplateURL* template_url = new TemplateURL();
- template_url->SetURL(UTF8ToWide(kSearchURL), 0, 0);
+ template_url->SetURL(kSearchURL, 0, 0);
template_url->set_keyword(UTF8ToWide(kSearchKeyword));
template_url->set_short_name(UTF8ToWide(kSearchShortName));
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index a4cbd28..f1bd7f9 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -663,8 +663,10 @@ void HistoryURLProvider::RunAutocompletePasses(
// onto the |params_| member for later deletion below if we need to run pass
// 2.
std::wstring languages(languages_);
- if (languages.empty() && profile_)
- languages = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ if (languages.empty() && profile_) {
+ languages =
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
+ }
scoped_ptr<HistoryURLProviderParams> params(
new HistoryURLProviderParams(input, trim_http, languages));
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index 1b7e2ae..756818c 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -260,7 +260,7 @@ void KeywordProvider::FillInURLAndContents(
ACMatchClassification(0, ACMatchClassification::DIM));
} else {
// Keyword that has no replacement text (aka a shorthand for a URL).
- match->destination_url = GURL(WideToUTF8(element->url()->url()));
+ match->destination_url = GURL(element->url()->url());
match->contents.assign(element->short_name());
AutocompleteMatch::ClassifyLocationInString(0, match->contents.length(),
match->contents.length(), ACMatchClassification::NONE,
@@ -272,9 +272,9 @@ void KeywordProvider::FillInURLAndContents(
// input, but we rely on later canonicalization functions to do more
// fixup to make the URL valid if necessary.
DCHECK(element->url()->SupportsReplacement());
- match->destination_url = GURL(WideToUTF8(element->url()->ReplaceSearchTerms(
+ match->destination_url = GURL(element->url()->ReplaceSearchTerms(
*element, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- std::wstring())));
+ std::wstring()));
std::vector<size_t> content_param_offsets;
match->contents.assign(l10n_util::GetStringF(message_id,
element->short_name(),
diff --git a/chrome/browser/autocomplete/keyword_provider_unittest.cc b/chrome/browser/autocomplete/keyword_provider_unittest.cc
index ed93c74..0578496 100644
--- a/chrome/browser/autocomplete/keyword_provider_unittest.cc
+++ b/chrome/browser/autocomplete/keyword_provider_unittest.cc
@@ -36,13 +36,13 @@ class KeywordProviderTest : public testing::Test {
void KeywordProviderTest::SetUp() {
static const TemplateURLModel::Initializer kTestKeywordData[] = {
- { L"aa", L"aa.com?foo=%s", L"aa" },
- { L"aaaa", L"http://aaaa/?aaaa=1&b=%s&c", L"aaaa" },
- { L"aaaaa", L"%s", L"aaaaa" },
- { L"ab", L"bogus URL %s", L"ab" },
- { L"weasel", L"weasel%sweasel", L"weasel" },
- { L"www", L" +%2B?=%sfoo ", L"www" },
- { L"z", L"%s=z", L"z" },
+ { L"aa", "aa.com?foo=%s", L"aa" },
+ { L"aaaa", "http://aaaa/?aaaa=1&b=%s&c", L"aaaa" },
+ { L"aaaaa", "%s", L"aaaaa" },
+ { L"ab", "bogus URL %s", L"ab" },
+ { L"weasel", "weasel%sweasel", L"weasel" },
+ { L"www", " +%2B?=%sfoo ", L"www" },
+ { L"z", "%s=z", L"z" },
};
model_.reset(new TemplateURLModel(kTestKeywordData,
@@ -180,7 +180,7 @@ TEST_F(KeywordProviderTest, Description) {
TEST_F(KeywordProviderTest, AddKeyword) {
TemplateURL* template_url = new TemplateURL();
std::wstring keyword(L"foo");
- std::wstring url(L"http://www.google.com/foo?q={searchTerms}");
+ std::string url("http://www.google.com/foo?q={searchTerms}");
template_url->SetURL(url, 0, 0);
template_url->set_keyword(keyword);
template_url->set_short_name(L"Test");
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 87d0a68..08dc01c 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -368,9 +368,9 @@ URLFetcher* SearchProvider::CreateSuggestFetcher(int id,
const TemplateURLRef* const suggestions_url = provider.suggestions_url();
DCHECK(suggestions_url->SupportsReplacement());
URLFetcher* fetcher = URLFetcher::Create(id,
- GURL(WideToUTF8(suggestions_url->ReplaceSearchTerms(
- provider, text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- std::wstring()))),
+ GURL(suggestions_url->ReplaceSearchTerms(
+ provider, text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
+ std::wstring())),
URLFetcher::GET, this);
fetcher->set_request_context(profile_->GetRequestContext());
fetcher->Start();
@@ -702,9 +702,10 @@ void SearchProvider::AddMatchToMap(const std::wstring& query_string,
const TemplateURLRef* const search_url = provider.url();
DCHECK(search_url->SupportsReplacement());
match.destination_url =
- GURL(WideToUTF8(search_url->ReplaceSearchTerms(provider, query_string,
- accepted_suggestion,
- input_text)));
+ GURL(search_url->ReplaceSearchTerms(provider,
+ query_string,
+ accepted_suggestion,
+ input_text));
// Search results don't look like URLs.
match.transition =
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 1e489f2..b013db9 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -96,8 +96,8 @@ void SearchProviderTest::SetUp() {
// Reset the default TemplateURL.
default_t_url_ = new TemplateURL();
- default_t_url_->SetURL(L"http://defaultturl/{searchTerms}", 0, 0);
- default_t_url_->SetSuggestionsURL(L"http://defaultturl2/{searchTerms}", 0, 0);
+ default_t_url_->SetURL("http://defaultturl/{searchTerms}", 0, 0);
+ default_t_url_->SetSuggestionsURL("http://defaultturl2/{searchTerms}", 0, 0);
turl_model->Add(default_t_url_);
turl_model->SetDefaultSearchProvider(default_t_url_);
TemplateURL::IDType default_provider_id = default_t_url_->id();
@@ -106,8 +106,8 @@ void SearchProviderTest::SetUp() {
// Add url1, with search term term1_.
HistoryService* history =
profile_.GetHistoryService(Profile::EXPLICIT_ACCESS);
- term1_url_ = GURL(WideToUTF8(default_t_url_->url()->ReplaceSearchTerms(
- *default_t_url_, UTF16ToWide(term1_), 0, std::wstring())));
+ term1_url_ = GURL(default_t_url_->url()->ReplaceSearchTerms(
+ *default_t_url_, UTF16ToWide(term1_), 0, std::wstring()));
history->AddPageWithDetails(term1_url_, string16(), 1, 1,
base::Time::Now(), false);
history->SetKeywordSearchTermsForURL(term1_url_, default_t_url_->id(),
@@ -116,15 +116,15 @@ void SearchProviderTest::SetUp() {
// Create another TemplateURL.
keyword_t_url_ = new TemplateURL();
keyword_t_url_->set_keyword(L"k");
- keyword_t_url_->SetURL(L"http://keyword/{searchTerms}", 0, 0);
- keyword_t_url_->SetSuggestionsURL(L"http://suggest_keyword/{searchTerms}", 0,
+ keyword_t_url_->SetURL("http://keyword/{searchTerms}", 0, 0);
+ keyword_t_url_->SetSuggestionsURL("http://suggest_keyword/{searchTerms}", 0,
0);
profile_.GetTemplateURLModel()->Add(keyword_t_url_);
ASSERT_NE(0, keyword_t_url_->id());
// Add a page and search term for keyword_t_url_.
- keyword_url_ = GURL(WideToUTF8(keyword_t_url_->url()->ReplaceSearchTerms(
- *keyword_t_url_, UTF16ToWide(keyword_term_), 0, std::wstring())));
+ keyword_url_ = GURL(keyword_t_url_->url()->ReplaceSearchTerms(
+ *keyword_t_url_, UTF16ToWide(keyword_term_), 0, std::wstring()));
history->AddPageWithDetails(keyword_url_, string16(), 1, 1,
base::Time::Now(), false);
history->SetKeywordSearchTermsForURL(keyword_url_, keyword_t_url_->id(),
@@ -199,9 +199,9 @@ TEST_F(SearchProviderTest, QueryDefaultProvider) {
ASSERT_TRUE(fetcher);
// And the URL matches what we expected.
- GURL expected_url = GURL(WideToUTF8(default_t_url_->suggestions_url()->
+ GURL expected_url = GURL(default_t_url_->suggestions_url()->
ReplaceSearchTerms(*default_t_url_, UTF16ToWide(term),
- 0, std::wstring())));
+ 0, std::wstring()));
ASSERT_TRUE(fetcher->original_url() == expected_url);
// Tell the SearchProvider the suggest query is done.
@@ -243,9 +243,9 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) {
ASSERT_TRUE(keyword_fetcher);
// And the URL matches what we expected.
- GURL expected_url = GURL(WideToUTF8(keyword_t_url_->suggestions_url()->
+ GURL expected_url = GURL(keyword_t_url_->suggestions_url()->
ReplaceSearchTerms(*keyword_t_url_, UTF16ToWide(term), 0,
- std::wstring())));
+ std::wstring()));
ASSERT_TRUE(keyword_fetcher->original_url() == expected_url);
// Tell the SearchProvider the keyword suggest query is done.
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 2041e1e..07c37d3 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -2916,7 +2916,7 @@ void AutomationProvider::SetIntPreference(int handle,
void AutomationProvider::SetStringPreference(int handle,
const std::wstring& name,
- const std::wstring& value,
+ const std::string& value,
bool* success) {
*success = false;
if (browser_tracker_->ContainsHandle(handle)) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 1be5a48..3727bd8 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -618,7 +618,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
// Sets the string value for preference with name |name|.
void SetStringPreference(int handle,
const std::wstring& name,
- const std::wstring& value,
+ const std::string& value,
bool* success);
// Gets the bool value for preference with name |name|.
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index ea1549a..a4fc69d 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+ // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1368,7 +1368,7 @@ void Browser::WriteCurrentURLToClipboard() {
chrome_browser_net::WriteURLToClipboard(
contents->GetURL(),
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)),
g_browser_process->clipboard());
}
@@ -1506,13 +1506,12 @@ void Browser::OverrideEncoding(int encoding_id) {
contents->SetOverrideEncoding(selected_encoding);
// Update the list of recently selected encodings.
std::string new_selected_encoding_list;
- if (CharacterEncoding::UpdateRecentlySelectdEncoding(
- WideToASCII(profile_->GetPrefs()->GetString(
- prefs::kRecentlySelectedEncoding)),
+ if (CharacterEncoding::UpdateRecentlySelectedEncoding(
+ profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding),
encoding_id,
&new_selected_encoding_list)) {
profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding,
- ASCIIToWide(new_selected_encoding_list));
+ new_selected_encoding_list);
}
}
@@ -1842,9 +1841,10 @@ void Browser::SetNewHomePagePrefs(PrefService* prefs) {
prefs->FindPreference(prefs::kHomePage);
if (home_page_pref &&
!home_page_pref->IsManaged() &&
- !prefs->HasPrefPath(prefs::kHomePage))
+ !prefs->HasPrefPath(prefs::kHomePage)) {
prefs->SetString(prefs::kHomePage,
- ASCIIToWide(GoogleURLTracker::kDefaultGoogleHomepage));
+ GoogleURLTracker::kDefaultGoogleHomepage);
+ }
const PrefService::Preference* home_page_is_new_tab_page_pref =
prefs->FindPreference(prefs::kHomePageIsNewTabPage);
if (home_page_is_new_tab_page_pref &&
@@ -2648,7 +2648,8 @@ void Browser::UpdateTargetURL(TabContents* source, const GURL& url) {
if (source == GetSelectedTabContents()) {
PrefService* prefs = profile_->GetPrefs();
- GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages));
+ GetStatusBubble()->SetURL(
+ url, UTF8ToWide(prefs->GetString(prefs::kAcceptLanguages)));
}
}
@@ -3866,7 +3867,7 @@ GURL Browser::GetHomePage() const {
if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage))
return GURL(chrome::kChromeUINewTabURL);
GURL home_page(URLFixerUpper::FixupURL(
- WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)),
+ profile_->GetPrefs()->GetString(prefs::kHomePage),
std::string()));
if (!home_page.is_valid())
return GURL(chrome::kChromeUINewTabURL);
diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc
index 64ef5ea..b6c7496 100644
--- a/chrome/browser/browser_encoding_uitest.cc
+++ b/chrome/browser/browser_encoding_uitest.cc
@@ -238,7 +238,7 @@ TEST_F(BrowserEncodingTest, FLAKY_TestEncodingAutoDetect) {
// auto-detector (Please refer to the above comments) to make sure we
// incorrectly decode the page. Now we use ISO-8859-4.
ASSERT_TRUE(browser->SetStringPreference(prefs::kDefaultCharset,
- L"ISO-8859-4"));
+ "ISO-8859-4"));
scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab.get());
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 23a47be..5a4fa6c 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -836,9 +836,9 @@ std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine(
}
const TemplateURLRef* search_url = default_provider->url();
DCHECK(search_url->SupportsReplacement());
- urls.push_back(GURL(WideToUTF8(search_url->ReplaceSearchTerms(
+ urls.push_back(GURL(search_url->ReplaceSearchTerms(
*default_provider, value.substr(2),
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()))));
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
} else {
// This will create a file URL or a regular URL.
GURL url(URLFixerUpper::FixupRelativeFile(cur_dir_, value));
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 2df6969..77b700f 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -425,8 +425,10 @@ PrefService* InitializeLocalState(const CommandLine& parsed_command_line,
// becomes our default language in the prefs.
// Other platforms obey the system locale.
std::wstring install_lang;
- if (GoogleUpdateSettings::GetLanguage(&install_lang))
- local_state->SetString(prefs::kApplicationLocale, install_lang);
+ if (GoogleUpdateSettings::GetLanguage(&install_lang)) {
+ local_state->SetString(prefs::kApplicationLocale,
+ WideToASCII(install_lang));
+ }
#endif // defined(OS_WIN)
}
@@ -990,7 +992,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride());
#else
std::string app_locale = ResourceBundle::InitSharedInstance(
- local_state->GetString(prefs::kApplicationLocale));
+ ASCIIToWide(local_state->GetString(prefs::kApplicationLocale)));
g_browser_process->SetApplicationLocale(app_locale);
FilePath resources_pack_path;
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index b26ff4e..c11a181 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -308,8 +308,7 @@ bool BrowserThemeProvider::UsingDefaultTheme() {
}
std::string BrowserThemeProvider::GetThemeID() const {
- std::wstring id = profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
- return WideToUTF8(id);
+ return profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
}
// static
@@ -572,7 +571,7 @@ void BrowserThemeProvider::SavePackName(const FilePath& pack_path) {
}
void BrowserThemeProvider::SaveThemeID(const std::string& id) {
- profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, UTF8ToWide(id));
+ profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, id);
}
void BrowserThemeProvider::BuildFromExtension(Extension* extension) {
diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc
index cd2693a..1e05017 100644
--- a/chrome/browser/character_encoding.cc
+++ b/chrome/browser/character_encoding.cc
@@ -123,7 +123,8 @@ class CanonicalEncodingMap {
private:
scoped_ptr<IdToCanonicalEncodingNameMapType> id_to_encoding_name_map_;
scoped_ptr<CanonicalEncodingNameToIdMapType> encoding_name_to_id_map_;
- scoped_ptr<CanonicalNameDisplayNameMapType> encoding_name_to_display_name_map_;
+ scoped_ptr<CanonicalNameDisplayNameMapType>
+ encoding_name_to_display_name_map_;
std::vector<int> locale_dependent_encoding_ids_;
std::vector<CharacterEncoding::EncodingInfo> current_display_encodings_;
@@ -171,7 +172,8 @@ const CanonicalNameDisplayNameMapType*
}
// Then save in the overrides.
for (int i = 0; i < canonical_display_name_overrides_length; ++i) {
- (*encoding_name_to_display_name_map_)[canonical_display_name_overrides[i].canonical_form] =
+ (*encoding_name_to_display_name_map_)
+ [canonical_display_name_overrides[i].canonical_form] =
canonical_display_name_overrides[i].display_form;
}
DCHECK(static_cast<int>(encoding_name_to_display_name_map_->size()) ==
@@ -499,7 +501,7 @@ const std::vector<CharacterEncoding::EncodingInfo>*
}
// Static
-bool CharacterEncoding::UpdateRecentlySelectdEncoding(
+bool CharacterEncoding::UpdateRecentlySelectedEncoding(
const std::string& original_selected_encodings,
int new_selected_encoding_id,
std::string* selected_encodings) {
diff --git a/chrome/browser/character_encoding.h b/chrome/browser/character_encoding.h
index 1f72fe4..6f59381 100644
--- a/chrome/browser/character_encoding.h
+++ b/chrome/browser/character_encoding.h
@@ -88,7 +88,7 @@ class CharacterEncoding {
// |new_selected_encoding_id|. If the encoding is already in the original
// list, then returns false. Otherwise |selected_encoding_list| will return a
// new string for user selected encoding short list and function returns true.
- static bool UpdateRecentlySelectdEncoding(
+ static bool UpdateRecentlySelectedEncoding(
const std::string& original_selected_encodings,
int new_selected_encoding_id,
std::string* selected_encodings);
diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h
index 0862987..69d8313 100644
--- a/chrome/browser/chromeos/language_preferences.h
+++ b/chrome/browser/chromeos/language_preferences.h
@@ -154,16 +154,16 @@ const char kHangulKeyboardConfigName[] = "HangulKeyboard";
const struct HangulKeyboardNameIDPair {
int message_id;
- const wchar_t* keyboard_id;
+ const char* keyboard_id;
} kHangulKeyboardNameIDPairs[] = {
// We have to sync the |keyboard_id|s with those in
// ibus-hangul/files/setup/main.py.
- { IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_2_SET, L"2" },
+ { IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_2_SET, "2" },
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_FINAL,
- L"3f" },
- { IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_390, L"39" },
+ "3f" },
+ { IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_390, "39" },
{ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_KEYBOARD_3_SET_NO_SHIFT,
- L"3s" },
+ "3s" },
// We don't support "Sebeolsik 2 set" keyboard.
};
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index 4c0ea24..fceddc5 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -86,7 +86,7 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) {
// Save new locale.
DCHECK(g_browser_process);
PrefService* prefs = g_browser_process->local_state();
- prefs->SetString(prefs::kApplicationLocale, UTF8ToWide(locale));
+ prefs->SetString(prefs::kApplicationLocale, locale);
prefs->SavePersistentPrefs();
// Switch the locale.
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 8e87f5c..31860df 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -591,7 +591,7 @@ void ShowLoginWizard(const std::string& first_screen_name,
icu::TimeZone::adoptDefault(timezone);
// Save timezone to default profile preferences.
PrefService* prefs = ProfileManager::GetDefaultProfile()->GetPrefs();
- prefs->SetString(prefs::kTimeZone, UTF8ToWide(timezone_name));
+ prefs->SetString(prefs::kTimeZone, timezone_name);
prefs->SavePersistentPrefs();
}
}
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);
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 5a20b49..30251b0 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -51,7 +51,7 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
}
prefs->RegisterStringPref(
prefs::kLanguageHangulKeyboard,
- WideToUTF8(kHangulKeyboardNameIDPairs[0].keyboard_id));
+ kHangulKeyboardNameIDPairs[0].keyboard_id);
for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name,
kPinyinBooleanPrefs[i].default_pref_value);
@@ -167,14 +167,16 @@ void Preferences::NotifyPrefChanged(const std::wstring* pref_name) {
// here.
if (!pref_name || *pref_name == prefs::kLanguageHotkeyNextEngineInMenu) {
- SetLanguageConfigStringListAsCSV(kHotKeySectionName,
- kNextEngineInMenuConfigName,
- language_hotkey_next_engine_in_menu_.GetValue());
+ SetLanguageConfigStringListAsCSV(
+ kHotKeySectionName,
+ kNextEngineInMenuConfigName,
+ language_hotkey_next_engine_in_menu_.GetValue());
}
if (!pref_name || *pref_name == prefs::kLanguageHotkeyPreviousEngine) {
- SetLanguageConfigStringListAsCSV(kHotKeySectionName,
- kPreviousEngineConfigName,
- language_hotkey_previous_engine_.GetValue());
+ SetLanguageConfigStringListAsCSV(
+ kHotKeySectionName,
+ kPreviousEngineConfigName,
+ language_hotkey_previous_engine_.GetValue());
}
if (!pref_name || *pref_name == prefs::kLanguagePreloadEngines) {
SetLanguageConfigStringListAsCSV(kGeneralSectionName,
@@ -257,9 +259,9 @@ void Preferences::NotifyPrefChanged(const std::wstring* pref_name) {
}
}
-void Preferences::SetTimeZone(const std::wstring& id) {
+void Preferences::SetTimeZone(const std::string& id) {
icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
- icu::UnicodeString::fromUTF8(WideToASCII(id)));
+ icu::UnicodeString::fromUTF8(id));
icu::TimeZone::adoptDefault(timezone);
}
@@ -285,10 +287,10 @@ void Preferences::SetLanguageConfigInteger(const char* section,
void Preferences::SetLanguageConfigString(const char* section,
const char* name,
- const std::wstring& value) {
+ const std::string& value) {
ImeConfigValue config;
config.type = ImeConfigValue::kValueTypeString;
- config.string_value = WideToUTF8(value);
+ config.string_value = value;
CrosLibrary::Get()->GetInputMethodLibrary()->
SetImeConfig(section, name, config);
}
@@ -296,25 +298,25 @@ void Preferences::SetLanguageConfigString(const char* section,
void Preferences::SetLanguageConfigStringList(
const char* section,
const char* name,
- const std::vector<std::wstring>& values) {
+ const std::vector<std::string>& values) {
ImeConfigValue config;
config.type = ImeConfigValue::kValueTypeStringList;
- for (size_t i = 0; i < values.size(); ++i) {
- config.string_list_value.push_back(WideToUTF8(values[i]));
- }
+ for (size_t i = 0; i < values.size(); ++i)
+ config.string_list_value.push_back(values[i]);
+
CrosLibrary::Get()->GetInputMethodLibrary()->
SetImeConfig(section, name, config);
}
void Preferences::SetLanguageConfigStringListAsCSV(const char* section,
const char* name,
- const std::wstring& value) {
+ const std::string& value) {
LOG(INFO) << "Setting " << name << " to '" << value << "'";
- std::vector<std::wstring> split_values;
- if (!value.empty()) {
- SplitString(value, L',', &split_values);
- }
+ std::vector<std::string> split_values;
+ if (!value.empty())
+ SplitString(value, ',', &split_values);
+
// We should call the cros API even when |value| is empty, to disable default
// config.
SetLanguageConfigStringList(section, name, split_values);
diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h
index 1d02b34..9f1770c 100644
--- a/chrome/browser/chromeos/preferences.h
+++ b/chrome/browser/chromeos/preferences.h
@@ -43,7 +43,7 @@ class Preferences : public NotificationObserver {
virtual void NotifyPrefChanged(const std::wstring* pref_name);
private:
- void SetTimeZone(const std::wstring& id);
+ void SetTimeZone(const std::string& id);
// Writes boolean |value| to the input method (IBus) configuration daemon.
// |section| (e.g. "general") and |name| (e.g. "use_global_engine") should
@@ -62,19 +62,19 @@ class Preferences : public NotificationObserver {
// |section| and |name| should not be NULL.
void SetLanguageConfigString(const char* section,
const char* name,
- const std::wstring& value);
+ const std::string& value);
// Writes a string list to the input method (IBus) configuration daemon.
// |section| and |name| should not be NULL.
void SetLanguageConfigStringList(const char* section,
const char* name,
- const std::vector<std::wstring>& values);
+ const std::vector<std::string>& values);
// A variant of SetLanguageConfigStringList. You can pass comma-separated
// values. Examples of |value|: "", "Control+space,Hiragana"
void SetLanguageConfigStringListAsCSV(const char* section,
const char* name,
- const std::wstring& value);
+ const std::string& value);
StringPrefMember timezone_;
BooleanPrefMember tap_to_click_enabled_;
diff --git a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
index 9c7fe34..cfaf61e 100644
--- a/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
+++ b/chrome/browser/chromeos/status/clock_menu_button_browsertest.cc
@@ -37,7 +37,7 @@ IN_PROC_BROWSER_TEST_F(ClockMenuButtonTest, TimezoneTest) {
std::wstring text_before = clock->text();
StringPrefMember timezone;
timezone.Init(prefs::kTimeZone, browser()->profile()->GetPrefs(), NULL);
- timezone.SetValue(ASCIIToWide("Asia/Hong_Kong"));
+ timezone.SetValue("Asia/Hong_Kong");
std::wstring text_after = clock->text();
EXPECT_NE(text_before, text_after);
}
diff --git a/chrome/browser/chromeos/status/language_menu_button.cc b/chrome/browser/chromeos/status/language_menu_button.cc
index c13ea7b..0f14de0 100644
--- a/chrome/browser/chromeos/status/language_menu_button.cc
+++ b/chrome/browser/chromeos/status/language_menu_button.cc
@@ -155,18 +155,17 @@ LanguageMenuButton::LanguageMenuButton(StatusAreaHost* host)
if (pref_service) {
previous_input_method_pref_.Init(
prefs::kLanguagePreviousInputMethod, pref_service, this);
- const std::wstring& previous_input_method_id =
+ const std::string& previous_input_method_id =
previous_input_method_pref_.GetValue();
- if (!previous_input_method_id.empty()) {
- library->ChangeInputMethod(WideToUTF8(previous_input_method_id));
- }
+ if (!previous_input_method_id.empty())
+ library->ChangeInputMethod(previous_input_method_id);
+
current_input_method_pref_.Init(
prefs::kLanguageCurrentInputMethod, pref_service, this);
- const std::wstring& current_input_method_id =
+ const std::string& current_input_method_id =
current_input_method_pref_.GetValue();
- if (!current_input_method_id.empty()) {
- library->ChangeInputMethod(WideToUTF8(current_input_method_id));
- }
+ if (!current_input_method_id.empty())
+ library->ChangeInputMethod(current_input_method_id);
}
library->AddObserver(this);
}
@@ -399,8 +398,8 @@ void LanguageMenuButton::InputMethodChanged(InputMethodLibrary* obj) {
// Update Chrome prefs as well.
if (GetPrefService(host_)) {
// Sometimes (e.g. initial boot) |previous_input_method.id| is empty.
- previous_input_method_pref_.SetValue(UTF8ToWide(previous_input_method.id));
- current_input_method_pref_.SetValue(UTF8ToWide(current_input_method.id));
+ previous_input_method_pref_.SetValue(previous_input_method.id);
+ current_input_method_pref_.SetValue(current_input_method.id);
}
}
diff --git a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm
index d3e2131..7bd5219 100644
--- a/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm
+++ b/chrome/browser/cocoa/edit_search_engine_cocoa_controller.mm
@@ -120,7 +120,7 @@ void ShiftOriginY(NSView* view, CGFloat amount) {
DCHECK([self validateFields]);
std::wstring title = base::SysNSStringToWide([nameField_ stringValue]);
std::wstring keyword = base::SysNSStringToWide([keywordField_ stringValue]);
- std::wstring url = base::SysNSStringToWide([urlField_ stringValue]);
+ std::string url = base::SysNSStringToUTF8([urlField_ stringValue]);
controller_->AcceptAddOrEdit(title, keyword, url);
[self doClose];
}
@@ -169,7 +169,7 @@ void ShiftOriginY(NSView* view, CGFloat amount) {
forImageView:keywordImage_
textField:keywordField_];
- std::wstring url = base::SysNSStringToWide([urlField_ stringValue]);
+ std::string url = base::SysNSStringToUTF8([urlField_ stringValue]);
BOOL urlValid = controller_->IsURLValid(url);
[self setIsValid:urlValid
toolTip:IDS_SEARCH_ENGINES_INVALID_URL_TT
diff --git a/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm b/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm
index f03578d..e38c022 100644
--- a/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm
+++ b/chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm
@@ -206,7 +206,7 @@ TEST_F(EditSearchEngineControllerTest, EditTemplateURL) {
TemplateURL url;
url.set_short_name(L"Foobar");
url.set_keyword(L"keyword");
- std::wstring urlString = TemplateURLRef::DisplayURLToURLRef(
+ std::string urlString = TemplateURLRef::DisplayURLToURLRef(
L"http://foo-bar.com");
url.SetURL(urlString, 0, 1);
TestingProfile* profile = browser_helper_.profile();
diff --git a/chrome/browser/cocoa/font_language_settings_controller.mm b/chrome/browser/cocoa/font_language_settings_controller.mm
index 4aa0f11..1958e00 100644
--- a/chrome/browser/cocoa/font_language_settings_controller.mm
+++ b/chrome/browser/cocoa/font_language_settings_controller.mm
@@ -42,7 +42,7 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window,
// Convert the name/size preference values to NSFont objects.
serifName_.Init(prefs::kWebKitSerifFontFamily, profile->GetPrefs(), NULL);
serifSize_.Init(prefs::kWebKitDefaultFontSize, profile->GetPrefs(), NULL);
- NSString* serif = base::SysWideToNSString(serifName_.GetValue());
+ NSString* serif = base::SysUTF8ToNSString(serifName_.GetValue());
serifFont_.reset(
[[NSFont fontWithName:serif size:serifSize_.GetValue()] retain]);
@@ -50,7 +50,7 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window,
NULL);
sansSerifSize_.Init(prefs::kWebKitDefaultFontSize, profile->GetPrefs(),
NULL);
- NSString* sansSerif = base::SysWideToNSString(sansSerifName_.GetValue());
+ NSString* sansSerif = base::SysUTF8ToNSString(sansSerifName_.GetValue());
sansSerifFont_.reset(
[[NSFont fontWithName:sansSerif
size:sansSerifSize_.GetValue()] retain]);
@@ -59,7 +59,7 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window,
NULL);
fixedWidthSize_.Init(prefs::kWebKitDefaultFixedFontSize,
profile->GetPrefs(), NULL);
- NSString* fixedWidth = base::SysWideToNSString(fixedWidthName_.GetValue());
+ NSString* fixedWidth = base::SysUTF8ToNSString(fixedWidthName_.GetValue());
fixedWidthFont_.reset(
[[NSFont fontWithName:fixedWidth
size:fixedWidthSize_.GetValue()] retain]);
@@ -93,7 +93,7 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window,
// Find and set the default encoding.
defaultEncoding_.Init(prefs::kDefaultCharset, profile->GetPrefs(), NULL);
NSString* defaultEncoding =
- base::SysWideToNSString(defaultEncoding_.GetValue());
+ base::SysUTF8ToNSString(defaultEncoding_.GetValue());
NSUInteger index = 0;
for (NSDictionary* entry in encodings_.get()) {
NSString* encoding = [entry objectForKey:kCharacterInfoEncoding];
@@ -201,23 +201,23 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window,
- (IBAction)save:(id)sender {
if (changedSerif_) {
- serifName_.SetValue(base::SysNSStringToWide([serifFont_ fontName]));
+ serifName_.SetValue(base::SysNSStringToUTF8([serifFont_ fontName]));
serifSize_.SetValue([serifFont_ pointSize]);
}
if (changedSansSerif_) {
sansSerifName_.SetValue(
- base::SysNSStringToWide([sansSerifFont_ fontName]));
+ base::SysNSStringToUTF8([sansSerifFont_ fontName]));
sansSerifSize_.SetValue([sansSerifFont_ pointSize]);
}
if (changedFixedWidth_) {
fixedWidthName_.SetValue(
- base::SysNSStringToWide([fixedWidthFont_ fontName]));
+ base::SysNSStringToUTF8([fixedWidthFont_ fontName]));
fixedWidthSize_.SetValue([fixedWidthFont_ pointSize]);
}
if (changedEncoding_) {
NSDictionary* object = [encodings_ objectAtIndex:defaultEncodingIndex_];
NSString* newEncoding = [object objectForKey:kCharacterInfoEncoding];
- std::wstring encoding = base::SysNSStringToWide(newEncoding);
+ std::string encoding = base::SysNSStringToUTF8(newEncoding);
defaultEncoding_.SetValue(encoding);
}
[self closeSheet:sender];
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
index d4c0390..647b200 100644
--- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.h
@@ -37,7 +37,7 @@ class KeywordEditorModelObserver : public TemplateURLModelObserver,
virtual void OnEditedKeyword(const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url);
+ const std::string& url);
// TableModelObserver overrides. Invalidate icon cache.
virtual void OnModelChanged();
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
index 559c840..21c7a20 100644
--- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
@@ -52,7 +52,7 @@ void KeywordEditorModelObserver::OnEditedKeyword(
const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url) {
+ const std::string& url) {
KeywordEditorController* controller = [controller_ controller];
if (template_url) {
controller->ModifyTemplateURL(template_url, title, keyword, url);
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm b/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
index ccdaf09..2ea9648 100644
--- a/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm
@@ -148,7 +148,7 @@ TEST_F(KeywordEditorCocoaControllerTest, IndexInModelForRowMixed) {
// Add a default engine.
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://test1/{searchTerms}", 0, 0);
+ t_url->SetURL("http://test1/{searchTerms}", 0, 0);
t_url->set_keyword(L"test1");
t_url->set_short_name(L"Test1");
t_url->set_show_in_default_list(true);
@@ -156,7 +156,7 @@ TEST_F(KeywordEditorCocoaControllerTest, IndexInModelForRowMixed) {
// Add a non-default engine.
t_url = new TemplateURL();
- t_url->SetURL(L"http://test2/{searchTerms}", 0, 0);
+ t_url->SetURL("http://test2/{searchTerms}", 0, 0);
t_url->set_keyword(L"test2");
t_url->set_short_name(L"Test2");
t_url->set_show_in_default_list(false);
@@ -191,14 +191,14 @@ TEST_F(KeywordEditorCocoaControllerTest, IndexInModelForDefault) {
// Add 2 default engines.
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://test1/{searchTerms}", 0, 0);
+ t_url->SetURL("http://test1/{searchTerms}", 0, 0);
t_url->set_keyword(L"test1");
t_url->set_short_name(L"Test1");
t_url->set_show_in_default_list(true);
template_model->Add(t_url);
t_url = new TemplateURL();
- t_url->SetURL(L"http://test2/{searchTerms}", 0, 0);
+ t_url->SetURL("http://test2/{searchTerms}", 0, 0);
t_url->set_keyword(L"test2");
t_url->set_short_name(L"Test2");
t_url->set_show_in_default_list(true);
diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
index 2858984..22c3447d 100644
--- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm
@@ -893,9 +893,10 @@ void LocationBarViewMac::ContentSettingImageView::OnMousePressed(NSRect bounds)
return;
GURL url = tabContents->GetURL();
std::wstring displayHost;
- net::AppendFormattedHost(url,
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), &displayHost,
- NULL, NULL);
+ net::AppendFormattedHost(
+ url,
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)),
+ &displayHost, NULL, NULL);
// Transform mouse coordinates to screen space.
AutocompleteTextField* textField = owner_->GetAutocompleteTextField();
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index a86031e..3bc8ef6 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -912,9 +912,9 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase {
if (!homepage.is_valid() || homepage.spec() == GetNewTabUIURLString()) {
newTabPageIsHomePage_.SetValue(true);
if (!homepage.has_host())
- homepage_.SetValue(std::wstring());
+ homepage_.SetValue(std::string());
} else {
- homepage_.SetValue(UTF8ToWide(homepage.spec()));
+ homepage_.SetValue(homepage.spec());
}
}
}
@@ -951,7 +951,7 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase {
[self setNewTabPageIsHomePageIndex:useNewTabPage];
}
if (*prefName == prefs::kHomePage) {
- NSString* value = base::SysWideToNSString(homepage_.GetValue());
+ NSString* value = base::SysUTF8ToNSString(homepage_.GetValue());
[self setHomepageURL:value];
}
@@ -1114,7 +1114,7 @@ enum { kHomepageNewTabPage, kHomepageURL };
// Returns the homepage URL.
- (NSString*)homepageURL {
- NSString* value = base::SysWideToNSString(homepage_.GetValue());
+ NSString* value = base::SysUTF8ToNSString(homepage_.GetValue());
return value;
}
@@ -1429,7 +1429,7 @@ const int kDisabledIndex = 1;
[self recordUserAction:UserMetricsAction("Options_SetDownloadDirectory")];
NSURL* path = [[panel URLs] lastObject]; // We only allow 1 item.
[self willChangeValueForKey:@"defaultDownloadLocation"];
- defaultDownloadLocation_.SetValue(base::SysNSStringToWide([path path]));
+ defaultDownloadLocation_.SetValue(base::SysNSStringToUTF8([path path]));
[self didChangeValueForKey:@"defaultDownloadLocation"];
}
}
@@ -1440,7 +1440,7 @@ const int kDisabledIndex = 1;
[panel setAllowsMultipleSelection:NO];
[panel setCanChooseFiles:NO];
[panel setCanChooseDirectories:YES];
- NSString* path = base::SysWideToNSString(defaultDownloadLocation_.GetValue());
+ NSString* path = base::SysUTF8ToNSString(defaultDownloadLocation_.GetValue());
[panel beginSheetForDirectory:path
file:nil
types:nil
@@ -1647,7 +1647,7 @@ const int kDisabledIndex = 1;
- (NSURL*)defaultDownloadLocation {
NSString* pathString =
- base::SysWideToNSString(defaultDownloadLocation_.GetValue());
+ base::SysUTF8ToNSString(defaultDownloadLocation_.GetValue());
return [NSURL fileURLWithPath:pathString];
}
diff --git a/chrome/browser/cocoa/search_engine_list_model_unittest.mm b/chrome/browser/cocoa/search_engine_list_model_unittest.mm
index 60ed101..c6a45cf 100644
--- a/chrome/browser/cocoa/search_engine_list_model_unittest.mm
+++ b/chrome/browser/cocoa/search_engine_list_model_unittest.mm
@@ -30,13 +30,13 @@ class SearchEngineListModelTest : public PlatformTest {
// Build a fake set of template urls.
template_model_.reset(new TemplateURLModel(helper_.profile()));
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google.com/?q={searchTerms}", 0, 0);
+ t_url->SetURL("http://www.google.com/?q={searchTerms}", 0, 0);
t_url->set_keyword(L"keyword");
t_url->set_short_name(L"google");
t_url->set_show_in_default_list(true);
template_model_->Add(t_url);
t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google2.com/?q={searchTerms}", 0, 0);
+ t_url->SetURL("http://www.google2.com/?q={searchTerms}", 0, 0);
t_url->set_keyword(L"keyword2");
t_url->set_short_name(L"google2");
t_url->set_show_in_default_list(true);
@@ -81,13 +81,13 @@ TEST_F(SearchEngineListModelTest, Default) {
// Add two more URLs, neither of which are shown in the default list.
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google3.com/?q={searchTerms}", 0, 0);
+ t_url->SetURL("http://www.google3.com/?q={searchTerms}", 0, 0);
t_url->set_keyword(L"keyword3");
t_url->set_short_name(L"google3 not eligible");
t_url->set_show_in_default_list(false);
template_model_->Add(t_url);
t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google4.com/?q={searchTerms}", 0, 0);
+ t_url->SetURL("http://www.google4.com/?q={searchTerms}", 0, 0);
t_url->set_keyword(L"keyword4");
t_url->set_short_name(L"google4");
t_url->set_show_in_default_list(false);
@@ -110,7 +110,7 @@ TEST_F(SearchEngineListModelTest, Default) {
TEST_F(SearchEngineListModelTest, Notification) {
// Add one more item to force a notification.
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google3.com/foo/bar", 0, 0);
+ t_url->SetURL("http://www.google3.com/foo/bar", 0, 0);
t_url->set_keyword(L"keyword3");
t_url->set_short_name(L"google3");
t_url->set_show_in_default_list(true);
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc
index 260e126..d4735dc 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -75,7 +75,7 @@ class ContentSettingSingleRadioGroup : public ContentSettingTitleAndLinkModel {
GURL url = tab_contents()->GetURL();
std::wstring display_host_wide;
net::AppendFormattedHost(url,
- profile()->GetPrefs()->GetString(prefs::kAcceptLanguages),
+ UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)),
&display_host_wide, NULL, NULL);
std::string display_host(WideToUTF8(display_host_wide));
diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc
index aa3937f..446aea5 100644
--- a/chrome/browser/custom_home_pages_table_model.cc
+++ b/chrome/browser/custom_home_pages_table_model.cc
@@ -214,7 +214,7 @@ CustomHomePagesTableModel::Entry*
std::wstring CustomHomePagesTableModel::FormattedURL(int row) const {
std::wstring languages =
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
std::wstring url(net::FormatUrl(entries_[row].url, languages));
base::i18n::GetDisplayStringInLTRDirectionality(&url);
return url;
diff --git a/chrome/browser/default_encoding_combo_model.cc b/chrome/browser/default_encoding_combo_model.cc
index 7db6cce..83477b8 100644
--- a/chrome/browser/default_encoding_combo_model.cc
+++ b/chrome/browser/default_encoding_combo_model.cc
@@ -39,9 +39,9 @@ int DefaultEncodingComboboxModel::GetSelectedEncodingIndex(Profile* profile) {
current_encoding_string.Init(prefs::kDefaultCharset,
profile->GetPrefs(),
NULL);
- const std::wstring current_encoding = current_encoding_string.GetValue();
+ const std::string current_encoding = current_encoding_string.GetValue();
for (int i = 0; i < GetItemCount(); ++i) {
- if (GetEncodingCharsetByIndex(i) == WideToASCII(current_encoding))
+ if (GetEncodingCharsetByIndex(i) == current_encoding)
return i;
}
diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc
index 3aa1587..d040d7f 100644
--- a/chrome/browser/dom_ui/core_options_handler.cc
+++ b/chrome/browser/dom_ui/core_options_handler.cc
@@ -193,7 +193,7 @@ void CoreOptionsHandler::HandleSetPref(const Value* value,
pref_service->SetInteger(pref_name.c_str(), int_value);
break;
case Value::TYPE_STRING:
- pref_service->SetString(pref_name.c_str(), UTF8ToWide(value_string));
+ pref_service->SetString(pref_name.c_str(), value_string);
break;
default:
NOTREACHED();
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 4d28320..8dd23b9 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -381,8 +381,8 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() {
std::vector<std::string> subst;
// Cache-buster for background.
- subst.push_back(WideToUTF8(
- profile_->GetPrefs()->GetString(prefs::kCurrentThemeID))); // $1
+ subst.push_back(
+ profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
// Colors.
subst.push_back(SkColorToRGBAString(color_background)); // $2
@@ -451,8 +451,8 @@ void NTPResourceCache::CreateNewTabCSS() {
std::vector<std::string> subst2;
// Cache-buster for background.
- subst.push_back(WideToASCII(
- profile_->GetPrefs()->GetString(prefs::kCurrentThemeID))); // $1
+ subst.push_back(
+ profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
// Colors.
subst.push_back(SkColorToRGBAString(color_background)); // $2
diff --git a/chrome/browser/dom_ui/tips_handler.cc b/chrome/browser/dom_ui/tips_handler.cc
index 161fb6c..1a7b59c 100644
--- a/chrome/browser/dom_ui/tips_handler.cc
+++ b/chrome/browser/dom_ui/tips_handler.cc
@@ -46,9 +46,8 @@ void TipsHandler::HandleGetTips(const Value* content) {
// the tip service starts up.
PrefService* current_prefs = dom_ui_->GetProfile()->GetPrefs();
if (current_prefs->HasPrefPath(prefs::kNTPTipsServer)) {
- std::wstring server = current_prefs->GetString(prefs::kNTPTipsServer);
- std::wstring locale =
- ASCIIToWide(g_browser_process->GetApplicationLocale());
+ std::string server = current_prefs->GetString(prefs::kNTPTipsServer);
+ std::string locale = g_browser_process->GetApplicationLocale();
if (!EndsWith(server, locale, false)) {
dom_ui_->CallJavascriptFunction(L"tips", list_value);
return;
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index db04135..b41be08 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -586,14 +586,19 @@ bool DownloadManager::Init(Profile* profile) {
// We store any file extension that should be opened automatically at
// download completion in this pref.
- std::wstring extensions_to_open =
+ std::string extensions_to_open =
prefs->GetString(prefs::kDownloadExtensionsToOpen);
- std::vector<std::wstring> extensions;
- SplitString(extensions_to_open, L':', &extensions);
+ std::vector<std::string> extensions;
+ SplitString(extensions_to_open, ':', &extensions);
+
for (size_t i = 0; i < extensions.size(); ++i) {
- if (!extensions[i].empty() && !IsExecutableFile(
- FilePath::FromWStringHack(extensions[i])))
- auto_open_.insert(FilePath::FromWStringHack(extensions[i]).value());
+#if defined(OS_POSIX)
+ FilePath path(extensions[i]);
+#elif defined(OS_WIN)
+ FilePath path(UTF8ToWide(extensions[i]));
+#endif
+ if (!extensions[i].empty() && !IsExecutableFile(path))
+ auto_open_.insert(path.value());
}
other_download_manager_observer_.reset(
@@ -1618,22 +1623,20 @@ bool DownloadManager::HasAutoOpenFileTypesRegistered() const {
void DownloadManager::SaveAutoOpens() {
PrefService* prefs = profile_->GetPrefs();
if (prefs) {
- FilePath::StringType extensions;
+ std::string extensions;
for (AutoOpenSet::iterator it = auto_open_.begin();
it != auto_open_.end(); ++it) {
- extensions += *it + FILE_PATH_LITERAL(":");
+#if defined(OS_POSIX)
+ std::string this_extension = *it;
+#elif defined(OS_WIN)
+ std::string this_extension = base::SysWideToUTF8(*it);
+#endif
+ extensions += this_extension + ":";
}
if (!extensions.empty())
extensions.erase(extensions.size() - 1);
- std::wstring extensions_w;
-#if defined(OS_WIN)
- extensions_w = extensions;
-#elif defined(OS_POSIX)
- extensions_w = base::SysNativeMBToWide(extensions);
-#endif
-
- prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions_w);
+ prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions);
}
}
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index b9ae8c2..db34e35 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -1266,11 +1266,17 @@ void SavePackage::ContinueSave(SavePackageParam* param,
PrefService* prefs = tab_contents_->profile()->GetPrefs();
StringPrefMember save_file_path;
save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs, NULL);
+#if defined(OS_POSIX)
+ std::string path_string = param->dir.value();
+#elif defined(OS_WIN)
+ std::string path_string = WideToUTF8(param->dir.value());
+#endif
// If user change the default saving directory, we will remember it just
// like IE and FireFox.
if (!tab_contents_->profile()->IsOffTheRecord() &&
- save_file_path.GetValue() != param->dir.ToWStringHack())
- save_file_path.SetValue(param->dir.ToWStringHack());
+ save_file_path.GetValue() != path_string) {
+ save_file_path.SetValue(path_string);
+ }
param->save_type = (index == 1) ? SavePackage::SAVE_AS_ONLY_HTML :
SavePackage::SAVE_AS_COMPLETE_HTML;
diff --git a/chrome/browser/encoding_menu_controller.cc b/chrome/browser/encoding_menu_controller.cc
index 9667f5f..952276b 100644
--- a/chrome/browser/encoding_menu_controller.cc
+++ b/chrome/browser/encoding_menu_controller.cc
@@ -81,15 +81,12 @@ bool EncodingMenuController::IsItemChecked(
Profile* browser_profile,
const std::string& current_tab_encoding,
int item_id) {
- if (!DoesCommandBelongToEncodingMenu(item_id)) {
+ if (!DoesCommandBelongToEncodingMenu(item_id))
return false;
- }
std::string encoding = current_tab_encoding;
- if (encoding.empty()) {
- encoding = WideToASCII(browser_profile->GetPrefs()->GetString(
- prefs::kDefaultCharset));
- }
+ if (encoding.empty())
+ encoding = browser_profile->GetPrefs()->GetString(prefs::kDefaultCharset);
if (item_id == IDC_ENCODING_AUTO_DETECT) {
return browser_profile->GetPrefs()->GetBoolean(
@@ -124,9 +121,8 @@ void EncodingMenuController::GetEncodingMenuItems(Profile* profile,
// encodings and other encodings.
encodings = CharacterEncoding::GetCurrentDisplayEncodings(
g_browser_process->GetApplicationLocale(),
- WideToASCII(profile->GetPrefs()->GetString(prefs::kStaticEncodings)),
- WideToASCII(profile->GetPrefs()->GetString(
- prefs::kRecentlySelectedEncoding)));
+ profile->GetPrefs()->GetString(prefs::kStaticEncodings),
+ profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding));
DCHECK(encodings);
DCHECK(!encodings->empty());
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index a07179e..0eb7a30 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -323,7 +323,8 @@ bool SearchBookmarksFunction::RunImpl() {
BookmarkModel* model = profile()->GetBookmarkModel();
ListValue* json = new ListValue();
- std::wstring lang = profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ std::wstring lang =
+ UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
std::vector<const BookmarkNode*> nodes;
bookmark_utils::GetBookmarksContainingText(model, query,
std::numeric_limits<int>::max(),
diff --git a/chrome/browser/extensions/extension_i18n_api.cc b/chrome/browser/extensions/extension_i18n_api.cc
index c39b5d9..146e62a 100644
--- a/chrome/browser/extensions/extension_i18n_api.cc
+++ b/chrome/browser/extensions/extension_i18n_api.cc
@@ -1,21 +1,20 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/extension_i18n_api.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-namespace {
- // Errors.
- const char kEmptyAcceptLanguagesError[] = "accept-languages is empty.";
-} // namespace
+// Errors.
+static const char kEmptyAcceptLanguagesError[] = "accept-languages is empty.";
bool GetAcceptLanguagesFunction::RunImpl() {
std::wstring acceptLanguages =
- profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
// Currently, there are 2 ways to set browser's accept-languages: through UI
// or directly modify the preference file. The accept-languages set through
// UI is guranteed to be valid, and the accept-languages string returned from
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 95177c6..c3b1907 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -577,7 +577,7 @@ void ExtensionUpdater::ProcessBlacklist(const std::string& data) {
// Update the pref value for blacklist version
prefs_->SetString(kExtensionBlacklistUpdateVersion,
- ASCIIToWide(current_extension_fetch_.version));
+ current_extension_fetch_.version);
prefs_->ScheduleSavePersistentPrefs();
}
@@ -693,11 +693,10 @@ void ExtensionUpdater::CheckNow() {
if (blacklist_checks_enabled_ && service_->HasInstalledExtensions()) {
ManifestFetchData* blacklist_fetch =
new ManifestFetchData(GURL(kBlacklistUpdateUrl));
- std::wstring version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
+ std::string version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
int ping_days =
CalculatePingDays(service_->extension_prefs()->BlacklistLastPingDay());
- blacklist_fetch->AddExtension(kBlacklistAppID, WideToASCII(version),
- ping_days);
+ blacklist_fetch->AddExtension(kBlacklistAppID, version, ping_days);
StartUpdateCheck(blacklist_fetch);
}
@@ -717,8 +716,7 @@ void ExtensionUpdater::CheckNow() {
bool ExtensionUpdater::GetExistingVersion(const std::string& id,
std::string* version) {
if (id == kBlacklistAppID) {
- *version =
- WideToASCII(prefs_->GetString(kExtensionBlacklistUpdateVersion));
+ *version = prefs_->GetString(kExtensionBlacklistUpdateVersion);
return true;
}
Extension* extension = service_->GetExtensionById(id, false);
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index 5266888..416a395 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -625,8 +625,8 @@ class ExtensionUpdaterTest : public testing::Test {
// blacklist.
EXPECT_TRUE(service.processed_blacklist());
- EXPECT_EQ(version, WideToASCII(service.pref_service()->
- GetString(prefs::kExtensionBlacklistUpdateVersion)));
+ EXPECT_EQ(version, service.pref_service()->
+ GetString(prefs::kExtensionBlacklistUpdateVersion));
URLFetcher::set_factory(NULL);
}
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index 46d5bde..4aec91f 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -290,7 +290,8 @@ void GeolocationInfoBarQueueController::ShowQueuedInfoBar(
tab_contents, this,
render_process_id, render_view_id,
i->bridge_id, i->requesting_frame,
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
+ UTF8ToWide(profile_->GetPrefs()->GetString(
+ prefs::kAcceptLanguages)));
tab_contents->AddInfoBar(i->infobar_delegate);
break;
}
diff --git a/chrome/browser/geolocation/geolocation_settings_state.cc b/chrome/browser/geolocation/geolocation_settings_state.cc
index a045d6d..f246598 100644
--- a/chrome/browser/geolocation/geolocation_settings_state.cc
+++ b/chrome/browser/geolocation/geolocation_settings_state.cc
@@ -75,7 +75,7 @@ std::string GeolocationSettingsState::GURLToFormattedHost(
const GURL& url) const {
std::wstring display_host_wide;
net::AppendFormattedHost(
- url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
+ url, UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)),
&display_host_wide, NULL, NULL);
return WideToUTF8(display_host_wide);
}
diff --git a/chrome/browser/google_url_tracker.cc b/chrome/browser/google_url_tracker.cc
index 07748ce..b703393 100644
--- a/chrome/browser/google_url_tracker.cc
+++ b/chrome/browser/google_url_tracker.cc
@@ -21,8 +21,8 @@ const char GoogleURLTracker::kDefaultGoogleHomepage[] =
"http://www.google.com/";
GoogleURLTracker::GoogleURLTracker()
- : google_url_(WideToUTF8(g_browser_process->local_state()->GetString(
- prefs::kLastKnownGoogleURL))),
+ : google_url_(g_browser_process->local_state()->GetString(
+ prefs::kLastKnownGoogleURL)),
ALLOW_THIS_IN_INITIALIZER_LIST(fetcher_factory_(this)),
in_startup_sleep_(true),
already_fetched_(false),
@@ -158,7 +158,7 @@ void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source,
return;
// Update the saved base URL if it has changed.
- const std::wstring base_url_str(UTF8ToWide(base_url.spec()));
+ const std::string base_url_str(base_url.spec());
if (g_browser_process->local_state()->GetString(prefs::kLastKnownGoogleURL) !=
base_url_str) {
g_browser_process->local_state()->SetString(prefs::kLastKnownGoogleURL,
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.
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 40693ef..b9a7a74 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -186,7 +186,7 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
std::vector<TemplateURL*>* search_engines) {
DCHECK(search_engines);
- std::map<std::wstring, TemplateURL*> search_engine_for_url;
+ std::map<std::string, TemplateURL*> search_engine_for_url;
std::string content;
// The first XML file represents the default search engine in Firefox 3, so we
// need to keep it on top of the list.
@@ -200,8 +200,8 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
reinterpret_cast<const unsigned char*>(content.data()),
content.length(), &param_filter, template_url) &&
template_url->url()) {
- std::wstring url = template_url->url()->url();
- std::map<std::wstring, TemplateURL*>::iterator iter =
+ std::string url = template_url->url()->url();
+ std::map<std::string, TemplateURL*>::iterator iter =
search_engine_for_url.find(url);
if (iter != search_engine_for_url.end()) {
// We have already found a search engine with the same URL. We give
@@ -213,7 +213,7 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
}
// Give this a keyword to facilitate tab-to-search, if possible.
template_url->set_keyword(
- TemplateURLModel::GenerateKeyword(GURL(WideToUTF8(url)), false));
+ TemplateURLModel::GenerateKeyword(GURL(url), false));
template_url->set_show_in_default_list(true);
search_engine_for_url[url] = template_url;
if (!default_turl)
@@ -225,7 +225,7 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files,
}
// Put the results in the |search_engines| vector.
- std::map<std::wstring, TemplateURL*>::iterator t_iter;
+ std::map<std::string, TemplateURL*>::iterator t_iter;
for (t_iter = search_engine_for_url.begin();
t_iter != search_engine_for_url.end(); ++t_iter) {
if (t_iter->second == default_turl)
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index f65bbdd..2824b40 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -346,15 +346,15 @@ void IEImporter::ImportSearchEngines() {
RegKey key(HKEY_CURRENT_USER, kSearchScopePath, KEY_READ);
std::wstring default_search_engine_name;
const TemplateURL* default_search_engine = NULL;
- std::map<std::wstring, TemplateURL*> search_engines_map;
+ std::map<std::string, TemplateURL*> search_engines_map;
key.ReadValue(L"DefaultScope", &default_search_engine_name);
RegistryKeyIterator key_iterator(HKEY_CURRENT_USER, kSearchScopePath);
while (key_iterator.Valid()) {
std::wstring sub_key_name = kSearchScopePath;
sub_key_name.append(L"\\").append(key_iterator.Name());
RegKey sub_key(HKEY_CURRENT_USER, sub_key_name.c_str(), KEY_READ);
- std::wstring url;
- if (!sub_key.ReadValue(L"URL", &url) || url.empty()) {
+ std::wstring wide_url;
+ if (!sub_key.ReadValue(L"URL", &wide_url) || wide_url.empty()) {
LOG(INFO) << "No URL for IE search engine at " << key_iterator.Name();
++key_iterator;
continue;
@@ -372,7 +372,8 @@ void IEImporter::ImportSearchEngines() {
}
}
- std::map<std::wstring, TemplateURL*>::iterator t_iter =
+ std::string url(WideToUTF8(wide_url));
+ std::map<std::string, TemplateURL*>::iterator t_iter =
search_engines_map.find(url);
TemplateURL* template_url =
(t_iter != search_engines_map.end()) ? t_iter->second : NULL;
@@ -395,7 +396,7 @@ void IEImporter::ImportSearchEngines() {
}
// ProfileWriter::AddKeywords() requires a vector and we have a map.
- std::map<std::wstring, TemplateURL*>::iterator t_iter;
+ std::map<std::string, TemplateURL*>::iterator t_iter;
std::vector<TemplateURL*> search_engines;
int default_search_engine_index = -1;
for (t_iter = search_engines_map.begin(); t_iter != search_engines_map.end();
diff --git a/chrome/browser/importer/importer_messages.h b/chrome/browser/importer/importer_messages.h
index 3feca84..4bbba62 100644
--- a/chrome/browser/importer/importer_messages.h
+++ b/chrome/browser/importer/importer_messages.h
@@ -195,7 +195,7 @@ struct ParamTraits<TemplateURLRef> {
WriteParam(m, p.page_offset());
}
static bool Read(const Message* m, void** iter, param_type* p) {
- std::wstring url;
+ std::string url;
int index_offset;
int page_offset;
if (!ReadParam(m, iter, &url) ||
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 8a9f50c..7c3a45c 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -511,35 +511,35 @@ static const PasswordList kFirefox2Passwords[] = {
typedef struct {
const wchar_t* keyword;
- const wchar_t* url;
+ const char* url;
} KeywordList;
static const KeywordList kFirefox2Keywords[] = {
// Searh plugins
{ L"amazon.com",
- L"http://www.amazon.com/exec/obidos/external-search/?field-keywords="
- L"{searchTerms}&mode=blended" },
+ "http://www.amazon.com/exec/obidos/external-search/?field-keywords="
+ "{searchTerms}&mode=blended" },
{ L"answers.com",
- L"http://www.answers.com/main/ntquery?s={searchTerms}&gwp=13" },
+ "http://www.answers.com/main/ntquery?s={searchTerms}&gwp=13" },
{ L"search.creativecommons.org",
- L"http://search.creativecommons.org/?q={searchTerms}" },
+ "http://search.creativecommons.org/?q={searchTerms}" },
{ L"search.ebay.com",
- L"http://search.ebay.com/search/search.dll?query={searchTerms}&"
- L"MfcISAPICommand=GetResult&ht=1&ebaytag1=ebayreg&srchdesc=n&"
- L"maxRecordsReturned=300&maxRecordsPerPage=50&SortProperty=MetaEndSort" },
+ "http://search.ebay.com/search/search.dll?query={searchTerms}&"
+ "MfcISAPICommand=GetResult&ht=1&ebaytag1=ebayreg&srchdesc=n&"
+ "maxRecordsReturned=300&maxRecordsPerPage=50&SortProperty=MetaEndSort" },
{ L"google.com",
- L"http://www.google.com/search?q={searchTerms}&ie=utf-8&oe=utf-8&aq=t" },
+ "http://www.google.com/search?q={searchTerms}&ie=utf-8&oe=utf-8&aq=t" },
{ L"search.yahoo.com",
- L"http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8" },
+ "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8" },
{ L"flickr.com",
- L"http://www.flickr.com/photos/tags/?q={searchTerms}" },
+ "http://www.flickr.com/photos/tags/?q={searchTerms}" },
{ L"imdb.com",
- L"http://www.imdb.com/find?q={searchTerms}" },
+ "http://www.imdb.com/find?q={searchTerms}" },
{ L"webster.com",
- L"http://www.webster.com/cgi-bin/dictionary?va={searchTerms}" },
+ "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}" },
// Search keywords.
- { L"google", L"http://www.google.com/" },
- { L"< > & \" ' \\ /", L"http://g.cn/"},
+ { L"google", "http://www.google.com/" },
+ { L"< > & \" ' \\ /", "http://g.cn/"},
};
static const int kDefaultFirefox2KeywordIndex = 8;
@@ -650,7 +650,7 @@ class FirefoxObserver : public ProfileWriter,
int password_count_;
int keyword_count_;
std::wstring default_keyword_;
- std::wstring default_keyword_url_;
+ std::string default_keyword_url_;
};
TEST_F(ImporterTest, Firefox2Importer) {
@@ -708,30 +708,30 @@ static const PasswordList kFirefox3Passwords[] = {
static const KeywordList kFirefox3Keywords[] = {
{ L"amazon.com",
- L"http://www.amazon.com/exec/obidos/external-search/?field-keywords="
- L"{searchTerms}&mode=blended" },
+ "http://www.amazon.com/exec/obidos/external-search/?field-keywords="
+ "{searchTerms}&mode=blended" },
{ L"answers.com",
- L"http://www.answers.com/main/ntquery?s={searchTerms}&gwp=13" },
+ "http://www.answers.com/main/ntquery?s={searchTerms}&gwp=13" },
{ L"search.creativecommons.org",
- L"http://search.creativecommons.org/?q={searchTerms}" },
+ "http://search.creativecommons.org/?q={searchTerms}" },
{ L"search.ebay.com",
- L"http://search.ebay.com/search/search.dll?query={searchTerms}&"
- L"MfcISAPICommand=GetResult&ht=1&ebaytag1=ebayreg&srchdesc=n&"
- L"maxRecordsReturned=300&maxRecordsPerPage=50&SortProperty=MetaEndSort" },
+ "http://search.ebay.com/search/search.dll?query={searchTerms}&"
+ "MfcISAPICommand=GetResult&ht=1&ebaytag1=ebayreg&srchdesc=n&"
+ "maxRecordsReturned=300&maxRecordsPerPage=50&SortProperty=MetaEndSort" },
{ L"google.com",
- L"http://www.google.com/search?q={searchTerms}&ie=utf-8&oe=utf-8&aq=t" },
+ "http://www.google.com/search?q={searchTerms}&ie=utf-8&oe=utf-8&aq=t" },
{ L"en.wikipedia.org",
- L"http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}" },
+ "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}" },
{ L"search.yahoo.com",
- L"http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8" },
+ "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8" },
{ L"flickr.com",
- L"http://www.flickr.com/photos/tags/?q={searchTerms}" },
+ "http://www.flickr.com/photos/tags/?q={searchTerms}" },
{ L"imdb.com",
- L"http://www.imdb.com/find?q={searchTerms}" },
+ "http://www.imdb.com/find?q={searchTerms}" },
{ L"webster.com",
- L"http://www.webster.com/cgi-bin/dictionary?va={searchTerms}" },
+ "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}" },
// Search keywords.
- { L"\x4E2D\x6587", L"http://www.google.com/" },
+ { L"\x4E2D\x6587", "http://www.google.com/" },
};
static const int kDefaultFirefox3KeywordIndex = 8;
@@ -854,7 +854,7 @@ class Firefox3Observer : public ProfileWriter,
int keyword_count_;
bool import_search_engines_;
std::wstring default_keyword_;
- std::wstring default_keyword_url_;
+ std::string default_keyword_url_;
};
TEST_F(ImporterTest, Firefox30Importer) {
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 6217408..f3b469f 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -47,7 +47,7 @@ void ProfileWriter::AddHomepage(const GURL& home_page) {
// NOTE: We set the kHomePage value, but keep the NewTab page as the homepage.
const PrefService::Preference* pref = prefs->FindPreference(prefs::kHomePage);
if (pref && !pref->IsManaged()) {
- prefs->SetString(prefs::kHomePage, ASCIIToWide(home_page.spec()));
+ prefs->SetString(prefs::kHomePage, home_page.spec());
prefs->ScheduleSavePersistentPrefs();
}
}
@@ -166,13 +166,13 @@ static std::string BuildHostPathKey(const TemplateURL* t_url,
bool try_url_if_invalid) {
if (t_url->url()) {
if (try_url_if_invalid && !t_url->url()->IsValid())
- return HostPathKeyForURL(GURL(WideToUTF8(t_url->url()->url())));
+ return HostPathKeyForURL(GURL(t_url->url()->url()));
if (t_url->url()->SupportsReplacement()) {
- return HostPathKeyForURL(
- GURL(WideToUTF8(t_url->url()->ReplaceSearchTerms(
- *t_url, L"random string",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()))));
+ return HostPathKeyForURL(GURL(
+ t_url->url()->ReplaceSearchTerms(
+ *t_url, L"random string",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
}
}
return std::string();
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc
index 89f2f22..2d706ce 100644
--- a/chrome/browser/intranet_redirect_detector.cc
+++ b/chrome/browser/intranet_redirect_detector.cc
@@ -20,8 +20,8 @@
const size_t IntranetRedirectDetector::kNumCharsInHostnames = 10;
IntranetRedirectDetector::IntranetRedirectDetector()
- : redirect_origin_(WideToUTF8(g_browser_process->local_state()->GetString(
- prefs::kLastKnownIntranetRedirectOrigin))),
+ : redirect_origin_(g_browser_process->local_state()->GetString(
+ prefs::kLastKnownIntranetRedirectOrigin)),
ALLOW_THIS_IN_INITIALIZER_LIST(fetcher_factory_(this)),
in_startup_sleep_(true),
request_context_available_(!!Profile::GetDefaultRequestContext()) {
@@ -140,7 +140,7 @@ void IntranetRedirectDetector::OnURLFetchComplete(
g_browser_process->local_state()->SetString(
prefs::kLastKnownIntranetRedirectOrigin, redirect_origin_.is_valid() ?
- UTF8ToWide(redirect_origin_.spec()) : std::wstring());
+ redirect_origin_.spec() : std::string());
}
void IntranetRedirectDetector::Observe(NotificationType type,
diff --git a/chrome/browser/language_combobox_model.cc b/chrome/browser/language_combobox_model.cc
index 4e386a5..2d16a73 100644
--- a/chrome/browser/language_combobox_model.cc
+++ b/chrome/browser/language_combobox_model.cc
@@ -166,8 +166,7 @@ int LanguageComboboxModel::GetSelectedLanguageIndex(const std::wstring& prefs) {
local_state = profile_->GetPrefs();
DCHECK(local_state);
- const std::string& current_locale =
- WideToASCII(local_state->GetString(prefs.c_str()));
+ const std::string& current_locale = local_state->GetString(prefs.c_str());
return GetIndexFromLocale(current_locale);
}
diff --git a/chrome/browser/managed_prefs_banner_base_unittest.cc b/chrome/browser/managed_prefs_banner_base_unittest.cc
index 6343bf5..c3cf4ac 100644
--- a/chrome/browser/managed_prefs_banner_base_unittest.cc
+++ b/chrome/browser/managed_prefs_banner_base_unittest.cc
@@ -39,9 +39,9 @@ TEST_F(ManagedPrefsBannerBaseTest, VisibilityTest) {
EXPECT_FALSE(banner.DetermineVisibility());
managed_prefs_->prefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true);
EXPECT_FALSE(banner.DetermineVisibility());
- user_prefs_->prefs()->SetString(prefs::kHomePage, L"http://foo.com");
+ user_prefs_->prefs()->SetString(prefs::kHomePage, "http://foo.com");
EXPECT_FALSE(banner.DetermineVisibility());
- managed_prefs_->prefs()->SetString(prefs::kHomePage, L"http://bar.com");
+ managed_prefs_->prefs()->SetString(prefs::kHomePage, "http://bar.com");
EXPECT_TRUE(banner.DetermineVisibility());
}
@@ -62,5 +62,5 @@ TEST_F(ManagedPrefsBannerBaseTest, NotificationTest) {
EXPECT_CALL(banner, OnUpdateVisibility()).Times(0);
pref_service_->SetBoolean(prefs::kHomePageIsNewTabPage, true);
EXPECT_CALL(banner, OnUpdateVisibility()).Times(1);
- pref_service_->SetString(prefs::kHomePage, L"http://foo.com");
+ pref_service_->SetString(prefs::kHomePage, "http://foo.com");
}
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 219d686..abea0af 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -59,7 +59,7 @@ int64 MetricsLog::GetIncrementalUptime(PrefService* pref) {
std::string MetricsLog::GetInstallDate() const {
PrefService* pref = g_browser_process->local_state();
if (pref) {
- return WideToUTF8(pref->GetString(prefs::kMetricsClientIDTimestamp));
+ return pref->GetString(prefs::kMetricsClientIDTimestamp);
} else {
NOTREACHED();
return "0";
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index c158226..64fdd67 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -455,14 +455,14 @@ void MetricsService::SetRecording(bool enabled) {
if (client_id_.empty()) {
PrefService* pref = g_browser_process->local_state();
DCHECK(pref);
- client_id_ = WideToUTF8(pref->GetString(prefs::kMetricsClientID));
+ client_id_ = pref->GetString(prefs::kMetricsClientID);
if (client_id_.empty()) {
client_id_ = GenerateClientID();
- pref->SetString(prefs::kMetricsClientID, UTF8ToWide(client_id_));
+ pref->SetString(prefs::kMetricsClientID, client_id_);
// Might as well make a note of how long this ID has existed
pref->SetString(prefs::kMetricsClientIDTimestamp,
- Int64ToWString(Time::Now().ToTimeT()));
+ Int64ToString(Time::Now().ToTimeT()));
}
}
child_process_logging::SetClientId(client_id_);
@@ -667,13 +667,13 @@ void MetricsService::InitializeMetricsState() {
if ((pref->GetInt64(prefs::kStabilityStatsBuildTime)
!= MetricsLog::GetBuildTime()) ||
- (WideToUTF8(pref->GetString(prefs::kStabilityStatsVersion))
+ (pref->GetString(prefs::kStabilityStatsVersion)
!= MetricsLog::GetVersionString())) {
// This is a new version, so we don't want to confuse the stats about the
// old version with info that we upload.
DiscardOldStabilityStats(pref);
pref->SetString(prefs::kStabilityStatsVersion,
- UTF8ToWide(MetricsLog::GetVersionString()));
+ MetricsLog::GetVersionString());
pref->SetInt64(prefs::kStabilityStatsBuildTime,
MetricsLog::GetBuildTime());
}
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index ade8d0f..e5208ae 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -652,7 +652,7 @@ void ChromeURLRequestContextGetter::Observe(
DCHECK(pref_name_in && prefs);
if (*pref_name_in == prefs::kAcceptLanguages) {
std::string accept_language =
- WideToASCII(prefs->GetString(prefs::kAcceptLanguages));
+ prefs->GetString(prefs::kAcceptLanguages);
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
@@ -661,7 +661,7 @@ void ChromeURLRequestContextGetter::Observe(
accept_language));
} else if (*pref_name_in == prefs::kDefaultCharset) {
std::string default_charset =
- WideToASCII(prefs->GetString(prefs::kDefaultCharset));
+ prefs->GetString(prefs::kDefaultCharset);
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
@@ -944,9 +944,8 @@ ChromeURLRequestContextFactory::ChromeURLRequestContextFactory(Profile* profile)
// Set up Accept-Language and Accept-Charset header values
accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
- WideToASCII(prefs->GetString(prefs::kAcceptLanguages)));
- std::string default_charset =
- WideToASCII(prefs->GetString(prefs::kDefaultCharset));
+ prefs->GetString(prefs::kAcceptLanguages));
+ std::string default_charset = prefs->GetString(prefs::kDefaultCharset);
accept_charset_ =
net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
@@ -1053,23 +1052,22 @@ net::ProxyConfig* CreateProxyConfig(const PrefService* pref_service) {
}
if (pref_service->HasPrefPath(prefs::kProxyServer)) {
- std::wstring proxy_server = pref_service->GetString(prefs::kProxyServer);
- proxy_config->proxy_rules().ParseFromString(WideToASCII(proxy_server));
+ std::string proxy_server = pref_service->GetString(prefs::kProxyServer);
+ proxy_config->proxy_rules().ParseFromString(proxy_server);
}
if (pref_service->HasPrefPath(prefs::kProxyPacUrl)) {
- std::wstring proxy_pac = pref_service->GetString(prefs::kProxyPacUrl);
- proxy_config->set_pac_url(GURL(WideToASCII(proxy_pac)));
+ std::string proxy_pac = pref_service->GetString(prefs::kProxyPacUrl);
+ proxy_config->set_pac_url(GURL(proxy_pac));
}
proxy_config->set_auto_detect(pref_service->GetBoolean(
prefs::kProxyAutoDetect));
if (pref_service->HasPrefPath(prefs::kProxyBypassList)) {
- std::wstring proxy_bypass =
+ std::string proxy_bypass =
pref_service->GetString(prefs::kProxyBypassList);
- proxy_config->proxy_rules().bypass_rules.ParseFromString(
- WideToASCII(proxy_bypass));
+ proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass);
}
return proxy_config;
diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc
index 370163d..2240975 100644
--- a/chrome/browser/possible_url_model.cc
+++ b/chrome/browser/possible_url_model.cc
@@ -61,9 +61,9 @@ void PossibleURLModel::Reload(Profile *profile) {
void PossibleURLModel::OnHistoryQueryComplete(HistoryService::Handle h,
history::QueryResults* result) {
results_.resize(result->size());
- std::wstring languages = profile_
- ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
- : std::wstring();
+ std::wstring languages = profile_ ?
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) :
+ std::wstring();
for (size_t i = 0; i < result->size(); ++i) {
results_[i].url = (*result)[i].url();
results_[i].index = i;
diff --git a/chrome/browser/pref_member.cc b/chrome/browser/pref_member.cc
index dd5cc30..ea41df8 100644
--- a/chrome/browser/pref_member.cc
+++ b/chrome/browser/pref_member.cc
@@ -89,7 +89,7 @@ void StringPrefMember::UpdateValueFromPref() {
value_ = prefs()->GetString(pref_name().c_str());
}
-void StringPrefMember::UpdatePref(const std::wstring& value) {
+void StringPrefMember::UpdatePref(const std::string& value) {
prefs()->SetString(pref_name().c_str(), value);
}
diff --git a/chrome/browser/pref_member.h b/chrome/browser/pref_member.h
index 15e29e9..0c95c2f 100644
--- a/chrome/browser/pref_member.h
+++ b/chrome/browser/pref_member.h
@@ -171,14 +171,14 @@ class RealPrefMember : public PrefMember<double> {
DISALLOW_COPY_AND_ASSIGN(RealPrefMember);
};
-class StringPrefMember : public PrefMember<std::wstring> {
+class StringPrefMember : public PrefMember<std::string> {
public:
- StringPrefMember() : PrefMember<std::wstring>() { }
+ StringPrefMember() : PrefMember<std::string>() { }
virtual ~StringPrefMember() { }
protected:
virtual void UpdateValueFromPref();
- virtual void UpdatePref(const std::wstring& value);
+ virtual void UpdatePref(const std::string& value);
private:
DISALLOW_COPY_AND_ASSIGN(StringPrefMember);
diff --git a/chrome/browser/pref_member_unittest.cc b/chrome/browser/pref_member_unittest.cc
index 4b19513..dd3fb9cf 100644
--- a/chrome/browser/pref_member_unittest.cc
+++ b/chrome/browser/pref_member_unittest.cc
@@ -124,21 +124,21 @@ TEST(PrefMemberTest, BasicGetAndSet) {
string.Init(kStringPref, &prefs, NULL);
// Check the defaults
- EXPECT_EQ(L"default", prefs.GetString(kStringPref));
- EXPECT_EQ(L"default", string.GetValue());
- EXPECT_EQ(L"default", *string);
+ EXPECT_EQ("default", prefs.GetString(kStringPref));
+ EXPECT_EQ("default", string.GetValue());
+ EXPECT_EQ("default", *string);
// Try changing through the member variable.
- string.SetValue(L"foo");
- EXPECT_EQ(L"foo", string.GetValue());
- EXPECT_EQ(L"foo", prefs.GetString(kStringPref));
- EXPECT_EQ(L"foo", *string);
+ string.SetValue("foo");
+ EXPECT_EQ("foo", string.GetValue());
+ EXPECT_EQ("foo", prefs.GetString(kStringPref));
+ EXPECT_EQ("foo", *string);
// Try changing back through the pref.
- prefs.SetString(kStringPref, L"bar");
- EXPECT_EQ(L"bar", prefs.GetString(kStringPref));
- EXPECT_EQ(L"bar", string.GetValue());
- EXPECT_EQ(L"bar", *string);
+ prefs.SetString(kStringPref, "bar");
+ EXPECT_EQ("bar", prefs.GetString(kStringPref));
+ EXPECT_EQ("bar", string.GetValue());
+ EXPECT_EQ("bar", *string);
}
TEST(PrefMemberTest, TwoPrefs) {
@@ -167,26 +167,26 @@ TEST(PrefMemberTest, Observer) {
RegisterTestPrefs(&prefs);
PrefMemberTestClass test_obj(&prefs);
- EXPECT_EQ(L"default", *test_obj.str_);
+ EXPECT_EQ("default", *test_obj.str_);
// Calling SetValue should not fire the observer.
- test_obj.str_.SetValue(L"hello");
+ test_obj.str_.SetValue("hello");
EXPECT_EQ(0, test_obj.observe_cnt_);
- EXPECT_EQ(L"hello", prefs.GetString(kStringPref));
+ EXPECT_EQ("hello", prefs.GetString(kStringPref));
// Changing the pref does fire the observer.
- prefs.SetString(kStringPref, L"world");
+ prefs.SetString(kStringPref, "world");
EXPECT_EQ(1, test_obj.observe_cnt_);
- EXPECT_EQ(L"world", *(test_obj.str_));
+ EXPECT_EQ("world", *(test_obj.str_));
// Not changing the value should not fire the observer.
- prefs.SetString(kStringPref, L"world");
+ prefs.SetString(kStringPref, "world");
EXPECT_EQ(1, test_obj.observe_cnt_);
- EXPECT_EQ(L"world", *(test_obj.str_));
+ EXPECT_EQ("world", *(test_obj.str_));
- prefs.SetString(kStringPref, L"hello");
+ prefs.SetString(kStringPref, "hello");
EXPECT_EQ(2, test_obj.observe_cnt_);
- EXPECT_EQ(L"hello", prefs.GetString(kStringPref));
+ EXPECT_EQ("hello", prefs.GetString(kStringPref));
}
TEST(PrefMemberTest, NoInit) {
diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc
index 22429c2..c33f373 100644
--- a/chrome/browser/pref_service.cc
+++ b/chrome/browser/pref_service.cc
@@ -330,10 +330,10 @@ double PrefService::GetReal(const wchar_t* path) const {
return result;
}
-std::wstring PrefService::GetString(const wchar_t* path) const {
+std::string PrefService::GetString(const wchar_t* path) const {
DCHECK(CalledOnValidThread());
- std::wstring result;
+ std::string result;
const Preference* pref = FindPreference(path);
if (!pref) {
@@ -581,7 +581,7 @@ void PrefService::SetReal(const wchar_t* path, double value) {
FireObserversIfChanged(path, old_value.get());
}
-void PrefService::SetString(const wchar_t* path, const std::wstring& value) {
+void PrefService::SetString(const wchar_t* path, const std::string& value) {
DCHECK(CalledOnValidThread());
const Preference* pref = FindPreference(path);
diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h
index 6b83d04..2cb2fa2f 100644
--- a/chrome/browser/pref_service.h
+++ b/chrome/browser/pref_service.h
@@ -121,7 +121,7 @@ class PrefService : public NonThreadSafe {
bool GetBoolean(const wchar_t* path) const;
int GetInteger(const wchar_t* path) const;
double GetReal(const wchar_t* path) const;
- std::wstring GetString(const wchar_t* path) const;
+ std::string GetString(const wchar_t* path) const;
FilePath GetFilePath(const wchar_t* path) const;
// Returns the branch if it exists. If it's not a branch or the branch does
@@ -142,7 +142,7 @@ class PrefService : public NonThreadSafe {
void SetBoolean(const wchar_t* path, bool value);
void SetInteger(const wchar_t* path, int value);
void SetReal(const wchar_t* path, double value);
- void SetString(const wchar_t* path, const std::wstring& value);
+ void SetString(const wchar_t* path, const std::string& value);
void SetFilePath(const wchar_t* path, const FilePath& value);
// Int64 helper methods that actually store the given value as a string.
diff --git a/chrome/browser/pref_service_unittest.cc b/chrome/browser/pref_service_unittest.cc
index fe97b13..72a7ce8 100644
--- a/chrome/browser/pref_service_unittest.cc
+++ b/chrome/browser/pref_service_unittest.cc
@@ -25,8 +25,9 @@ using testing::Property;
class TestPrefObserver : public NotificationObserver {
public:
- TestPrefObserver(const PrefService* prefs, const std::wstring& pref_name,
- const std::wstring& new_pref_value)
+ TestPrefObserver(const PrefService* prefs,
+ const std::wstring& pref_name,
+ const std::string& new_pref_value)
: observer_fired_(false),
prefs_(prefs),
pref_name_(pref_name),
@@ -48,7 +49,7 @@ class TestPrefObserver : public NotificationObserver {
bool observer_fired() { return observer_fired_; }
- void Reset(const std::wstring& new_pref_value) {
+ void Reset(const std::string& new_pref_value) {
observer_fired_ = false;
new_pref_value_ = new_pref_value;
}
@@ -57,7 +58,7 @@ class TestPrefObserver : public NotificationObserver {
bool observer_fired_;
const PrefService* prefs_;
const std::wstring pref_name_;
- std::wstring new_pref_value_;
+ std::string new_pref_value_;
};
// TODO(port): port this test to POSIX.
@@ -74,14 +75,14 @@ TEST(PrefServiceTest, LocalizedPrefs) {
// The locale default should take preference over the user default.
EXPECT_FALSE(prefs.GetBoolean(kBoolean));
EXPECT_EQ(1, prefs.GetInteger(kInteger));
- EXPECT_EQ(L"hello", prefs.GetString(kString));
+ EXPECT_EQ("hello", prefs.GetString(kString));
prefs.SetBoolean(kBoolean, true);
EXPECT_TRUE(prefs.GetBoolean(kBoolean));
prefs.SetInteger(kInteger, 5);
EXPECT_EQ(5, prefs.GetInteger(kInteger));
- prefs.SetString(kString, L"foo");
- EXPECT_EQ(L"foo", prefs.GetString(kString));
+ prefs.SetString(kString, "foo");
+ EXPECT_EQ("foo", prefs.GetString(kString));
}
#endif
@@ -91,7 +92,7 @@ TEST(PrefServiceTest, NoObserverFire) {
const wchar_t pref_name[] = L"homepage";
prefs.RegisterStringPref(pref_name, "");
- const std::wstring new_pref_value(L"http://www.google.com/");
+ const std::string new_pref_value("http://www.google.com/");
TestPrefObserver obs(&prefs, pref_name, new_pref_value);
prefs.AddPrefObserver(pref_name, &obs);
// This should fire the checks in TestPrefObserver::Observe.
@@ -107,12 +108,12 @@ TEST(PrefServiceTest, NoObserverFire) {
EXPECT_FALSE(obs.observer_fired());
// Clearing the pref should cause the pref to fire.
- obs.Reset(L"");
+ obs.Reset("");
prefs.ClearPref(pref_name);
EXPECT_TRUE(obs.observer_fired());
// Clearing the pref again should not cause the pref to fire.
- obs.Reset(L"");
+ obs.Reset("");
prefs.ClearPref(pref_name);
EXPECT_FALSE(obs.observer_fired());
@@ -134,7 +135,7 @@ TEST(PrefServiceTest, HasPrefPath) {
EXPECT_FALSE(prefs.HasPrefPath(path));
// Set a value and make sure we have a path.
- prefs.SetString(path, L"blah");
+ prefs.SetString(path, "blah");
EXPECT_TRUE(prefs.HasPrefPath(path));
}
@@ -142,13 +143,13 @@ TEST(PrefServiceTest, Observers) {
const wchar_t pref_name[] = L"homepage";
DictionaryValue* dict = new DictionaryValue();
- dict->SetString(pref_name, std::wstring(L"http://www.cnn.com"));
+ dict->SetString(pref_name, std::string("http://www.cnn.com"));
DummyPrefStore* pref_store = new DummyPrefStore();
pref_store->set_prefs(dict);
PrefService prefs(new PrefValueStore(NULL, pref_store, NULL));
prefs.RegisterStringPref(pref_name, "");
- const std::wstring new_pref_value(L"http://www.google.com/");
+ const std::string new_pref_value("http://www.google.com/");
TestPrefObserver obs(&prefs, pref_name, new_pref_value);
prefs.AddPrefObserver(pref_name, &obs);
// This should fire the checks in TestPrefObserver::Observe.
@@ -158,7 +159,7 @@ TEST(PrefServiceTest, Observers) {
EXPECT_TRUE(obs.observer_fired());
// Now try adding a second pref observer.
- const std::wstring new_pref_value2(L"http://www.youtube.com/");
+ const std::string new_pref_value2("http://www.youtube.com/");
obs.Reset(new_pref_value2);
TestPrefObserver obs2(&prefs, pref_name, new_pref_value2);
prefs.AddPrefObserver(pref_name, &obs2);
@@ -169,7 +170,7 @@ TEST(PrefServiceTest, Observers) {
// Make sure obs2 still works after removing obs.
prefs.RemovePrefObserver(pref_name, &obs);
- obs.Reset(L"");
+ obs.Reset("");
obs2.Reset(new_pref_value);
// This should only fire the observer in obs2.
prefs.SetString(pref_name, new_pref_value);
@@ -183,7 +184,7 @@ TEST(PrefServiceTest, Observers) {
class PrefServiceSetValueTest : public testing::Test {
protected:
static const wchar_t name_[];
- static const wchar_t value_[];
+ static const char value_[];
PrefServiceSetValueTest()
: prefs_(new PrefValueStore(NULL, new DummyPrefStore(), NULL)),
@@ -206,8 +207,9 @@ class PrefServiceSetValueTest : public testing::Test {
scoped_ptr<Value> null_value_;
NotificationObserverMock observer_;
};
+
const wchar_t PrefServiceSetValueTest::name_[] = L"name";
-const wchar_t PrefServiceSetValueTest::value_[] = L"value";
+const char PrefServiceSetValueTest::value_[] = "value";
TEST_F(PrefServiceSetValueTest, SetStringValue) {
const char default_string[] = "default";
@@ -241,7 +243,7 @@ TEST_F(PrefServiceSetValueTest, SetDictionaryValue) {
Mock::VerifyAndClearExpectations(&observer_);
DictionaryValue* dict = prefs_.GetMutableDictionary(name_);
EXPECT_EQ(1U, dict->size());
- std::wstring out_value;
+ std::string out_value;
dict->GetString(name_, &out_value);
EXPECT_EQ(value_, out_value);
@@ -273,7 +275,7 @@ TEST_F(PrefServiceSetValueTest, SetListValue) {
Mock::VerifyAndClearExpectations(&observer_);
ListValue* list = prefs_.GetMutableList(name_);
ASSERT_EQ(1U, list->GetSize());
- std::wstring out_value;
+ std::string out_value;
list->GetString(0, &out_value);
EXPECT_EQ(value_, out_value);
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index a5f3017..8e7a839 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -120,8 +120,8 @@ GURL CloudPrintService::GetCloudPrintServiceURL() {
GURL cloud_print_service_url = GURL(command_line.GetSwitchValueASCII(
switches::kCloudPrintServiceURL));
if (cloud_print_service_url.is_empty()) {
- cloud_print_service_url = GURL(WideToUTF8(
- profile_->GetPrefs()->GetString(prefs::kCloudPrintServiceURL)));
+ cloud_print_service_url = GURL(
+ profile_->GetPrefs()->GetString(prefs::kCloudPrintServiceURL));
}
return cloud_print_service_url;
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 7a34dbc..a2ddb0b 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -1579,8 +1579,9 @@ void ProfileImpl::ReinitializeSpellCheckHost(bool force) {
PrefService* prefs = GetPrefs();
if (prefs->GetBoolean(prefs::kEnableSpellCheck)) {
// Retrieve the (perhaps updated recently) dictionary name from preferences.
- spellcheck_host_ = new SpellCheckHost(this,
- WideToASCII(prefs->GetString(prefs::kSpellCheckDictionary)),
+ spellcheck_host_ = new SpellCheckHost(
+ this,
+ prefs->GetString(prefs::kSpellCheckDictionary),
GetRequestContext());
spellcheck_host_->Initialize();
} else if (notify) {
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index b0320e9..ea5da62 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -258,8 +258,8 @@ void SafeBrowsingService::OnNewMacKeys(const std::string& client_key,
const std::string& wrapped_key) {
PrefService* prefs = g_browser_process->local_state();
if (prefs) {
- prefs->SetString(prefs::kSafeBrowsingClientKey, ASCIIToWide(client_key));
- prefs->SetString(prefs::kSafeBrowsingWrappedKey, ASCIIToWide(wrapped_key));
+ prefs->SetString(prefs::kSafeBrowsingClientKey, client_key);
+ prefs->SetString(prefs::kSafeBrowsingWrappedKey, wrapped_key);
}
}
@@ -604,9 +604,9 @@ void SafeBrowsingService::Start() {
std::string client_key, wrapped_key;
if (local_state) {
client_key =
- WideToASCII(local_state->GetString(prefs::kSafeBrowsingClientKey));
+ local_state->GetString(prefs::kSafeBrowsingClientKey);
wrapped_key =
- WideToASCII(local_state->GetString(prefs::kSafeBrowsingWrappedKey));
+ local_state->GetString(prefs::kSafeBrowsingWrappedKey);
}
// We will issue network fetches using the default profile's request context.
diff --git a/chrome/browser/search_engines/edit_search_engine_controller.cc b/chrome/browser/search_engines/edit_search_engine_controller.cc
index f79bce1..d64ec89 100644
--- a/chrome/browser/search_engines/edit_search_engine_controller.cc
+++ b/chrome/browser/search_engines/edit_search_engine_controller.cc
@@ -29,8 +29,8 @@ bool EditSearchEngineController::IsTitleValid(
}
bool EditSearchEngineController::IsURLValid(
- const std::wstring& url_input) const {
- std::wstring url = GetFixedUpURL(url_input);
+ const std::string& url_input) const {
+ std::string url = GetFixedUpURL(url_input);
if (url.empty())
return false;
@@ -45,14 +45,14 @@ bool EditSearchEngineController::IsURLValid(
if (template_url_ ==
profile_->GetTemplateURLModel()->GetDefaultSearchProvider())
return false;
- return GURL(WideToUTF16Hack(url)).is_valid();
+ return GURL(url).is_valid();
}
// If the url has a search term, replace it with a random string and make
// sure the resulting URL is valid. We don't check the validity of the url
// with the search term as that is not necessarily valid.
- return GURL(WideToUTF8(template_ref.ReplaceSearchTerms(TemplateURL(), L"a",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()))).is_valid();
+ return GURL(template_ref.ReplaceSearchTerms(TemplateURL(), L"a",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())).is_valid();
}
bool EditSearchEngineController::IsKeywordValid(
@@ -69,8 +69,8 @@ bool EditSearchEngineController::IsKeywordValid(
void EditSearchEngineController::AcceptAddOrEdit(
const std::wstring& title_input,
const std::wstring& keyword_input,
- const std::wstring& url_input) {
- std::wstring url_string = GetFixedUpURL(url_input);
+ const std::string& url_input) {
+ std::string url_string = GetFixedUpURL(url_input);
DCHECK(!url_string.empty());
const TemplateURL* existing =
@@ -120,10 +120,10 @@ void EditSearchEngineController::CleanUpCancelledAdd() {
}
}
-std::wstring EditSearchEngineController::GetFixedUpURL(
- const std::wstring& url_input) const {
- std::wstring url;
- TrimWhitespace(TemplateURLRef::DisplayURLToURLRef(url_input),
+std::string EditSearchEngineController::GetFixedUpURL(
+ const std::string& url_input) const {
+ std::string url;
+ TrimWhitespace(TemplateURLRef::DisplayURLToURLRef(UTF8ToWide(url_input)),
TRIM_ALL, &url);
if (url.empty())
return url;
@@ -133,14 +133,14 @@ std::wstring EditSearchEngineController::GetFixedUpURL(
// we need to replace the search terms before testing for the scheme.
TemplateURL t_url;
t_url.SetURL(url, 0, 0);
- std::wstring expanded_url =
+ std::string expanded_url =
t_url.url()->ReplaceSearchTerms(t_url, L"x", 0, std::wstring());
url_parse::Parsed parts;
std::string scheme(
- URLFixerUpper::SegmentURL(WideToUTF8(expanded_url), &parts));
+ URLFixerUpper::SegmentURL(expanded_url, &parts));
if (!parts.scheme.is_valid()) {
scheme.append("://");
- url.insert(0, UTF8ToWide(scheme));
+ url.insert(0, scheme);
}
return url;
diff --git a/chrome/browser/search_engines/edit_search_engine_controller.h b/chrome/browser/search_engines/edit_search_engine_controller.h
index becde82..0ceb1d3 100644
--- a/chrome/browser/search_engines/edit_search_engine_controller.h
+++ b/chrome/browser/search_engines/edit_search_engine_controller.h
@@ -22,7 +22,7 @@ class EditSearchEngineControllerDelegate {
virtual void OnEditedKeyword(const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url) = 0;
+ const std::string& url) = 0;
};
// EditSearchEngineController provides the core platform independent logic
@@ -43,7 +43,7 @@ class EditSearchEngineController {
// URL. The URL is valid if it contains no search terms and is a valid
// url, or if it contains a search term and replacing that search term with a
// character results in a valid url.
- bool IsURLValid(const std::wstring& url_input) const;
+ bool IsURLValid(const std::string& url_input) const;
// Returns true if the value of |keyword_input| represents a valid keyword.
// The keyword is valid if it is non-empty and does not conflict with an
@@ -53,7 +53,7 @@ class EditSearchEngineController {
// Completes the add or edit of a search engine.
void AcceptAddOrEdit(const std::wstring& title_input,
const std::wstring& keyword_input,
- const std::wstring& url_input);
+ const std::string& url_input);
// Deletes an unused TemplateURL, if its add was cancelled and it's not
// already owned by the TemplateURLModel.
@@ -66,7 +66,7 @@ class EditSearchEngineController {
private:
// Fixes up and returns the URL the user has input. The returned URL is
// suitable for use by TemplateURL.
- std::wstring GetFixedUpURL(const std::wstring& url_input) const;
+ std::string GetFixedUpURL(const std::string& url_input) const;
// The TemplateURL we're displaying information for. It may be NULL. If we
// have a keyword_editor_view, we assume that this TemplateURL is already in
diff --git a/chrome/browser/search_engines/keyword_editor_controller.cc b/chrome/browser/search_engines/keyword_editor_controller.cc
index 3e8ff11..d4f9848 100644
--- a/chrome/browser/search_engines/keyword_editor_controller.cc
+++ b/chrome/browser/search_engines/keyword_editor_controller.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/search_engines/keyword_editor_controller.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -29,7 +30,7 @@ void KeywordEditorController::RegisterPrefs(PrefService* prefs) {
int KeywordEditorController::AddTemplateURL(const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url) {
+ const std::string& url) {
DCHECK(!url.empty());
UserMetrics::RecordAction(UserMetricsAction("KeywordEditor_AddKeyword"),
@@ -54,7 +55,7 @@ int KeywordEditorController::AddTemplateURL(const std::wstring& title,
void KeywordEditorController::ModifyTemplateURL(const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url) {
+ const std::string& url) {
const int index = table_model_->IndexOfTemplateURL(template_url);
if (index == -1) {
// Will happen if url was deleted out from under us while the user was
diff --git a/chrome/browser/search_engines/keyword_editor_controller.h b/chrome/browser/search_engines/keyword_editor_controller.h
index 4c62feb..c358d6e 100644
--- a/chrome/browser/search_engines/keyword_editor_controller.h
+++ b/chrome/browser/search_engines/keyword_editor_controller.h
@@ -28,14 +28,14 @@ class KeywordEditorController {
// Returns the index of the added URL.
int AddTemplateURL(const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url);
+ const std::string& url);
// Invoked when the user modifies a TemplateURL. Updates the TemplateURLModel
// and table model appropriately.
void ModifyTemplateURL(const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url);
+ const std::string& url);
// Return true if the given |url| can be made the default.
bool CanMakeDefault(const TemplateURL* url) const;
diff --git a/chrome/browser/search_engines/keyword_editor_controller_unittest.cc b/chrome/browser/search_engines/keyword_editor_controller_unittest.cc
index 87d3db5..499f5aa 100644
--- a/chrome/browser/search_engines/keyword_editor_controller_unittest.cc
+++ b/chrome/browser/search_engines/keyword_editor_controller_unittest.cc
@@ -77,7 +77,7 @@ class KeywordEditorControllerTest : public testing::Test,
// Tests adding a TemplateURL.
TEST_F(KeywordEditorControllerTest, Add) {
- controller_->AddTemplateURL(L"a", L"b", L"http://c");
+ controller_->AddTemplateURL(L"a", L"b", "http://c");
// Verify the observer was notified.
VerifyChangeCount(0, 0, 1, 0);
@@ -95,29 +95,29 @@ TEST_F(KeywordEditorControllerTest, Add) {
EXPECT_EQ(L"a", turl->short_name());
EXPECT_EQ(L"b", turl->keyword());
EXPECT_TRUE(turl->url() != NULL);
- EXPECT_TRUE(turl->url()->url() == L"http://c");
+ EXPECT_TRUE(turl->url()->url() == "http://c");
}
// Tests modifying a TemplateURL.
TEST_F(KeywordEditorControllerTest, Modify) {
- controller_->AddTemplateURL(L"a", L"b", L"http://c");
+ controller_->AddTemplateURL(L"a", L"b", "http://c");
ClearChangeCount();
// Modify the entry.
const TemplateURL* turl = model_->GetTemplateURLs()[0];
- controller_->ModifyTemplateURL(turl, L"a1", L"b1", L"http://c1");
+ controller_->ModifyTemplateURL(turl, L"a1", L"b1", "http://c1");
// Make sure it was updated appropriately.
VerifyChangeCount(0, 1, 0, 0);
EXPECT_EQ(L"a1", turl->short_name());
EXPECT_EQ(L"b1", turl->keyword());
EXPECT_TRUE(turl->url() != NULL);
- EXPECT_TRUE(turl->url()->url() == L"http://c1");
+ EXPECT_TRUE(turl->url()->url() == "http://c1");
}
// Tests making a TemplateURL the default search provider.
TEST_F(KeywordEditorControllerTest, MakeDefault) {
- controller_->AddTemplateURL(L"a", L"b", L"http://c{searchTerms}");
+ controller_->AddTemplateURL(L"a", L"b", "http://c{searchTerms}");
ClearChangeCount();
const TemplateURL* turl = model_->GetTemplateURLs()[0];
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index becc4fd..beed6d3 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -24,36 +24,36 @@
// the terms is enclosed in braces. If the character preceeding the final
// brace is a ?, it indicates the term is optional and can be replaced with
// an empty string.
-static const wchar_t kStartParameter = '{';
-static const wchar_t kEndParameter = '}';
-static const wchar_t kOptional = '?';
+static const char kStartParameter = '{';
+static const char kEndParameter = '}';
+static const char kOptional = '?';
// Known parameters found in the URL.
-static const wchar_t kSearchTermsParameter[] = L"searchTerms";
+static const char kSearchTermsParameter[] = "searchTerms";
static const char kSearchTermsParameterFull[] = "{searchTerms}";
-static const wchar_t kCountParameter[] = L"count";
-static const wchar_t kStartIndexParameter[] = L"startIndex";
-static const wchar_t kStartPageParameter[] = L"startPage";
-static const wchar_t kLanguageParameter[] = L"language";
-static const wchar_t kInputEncodingParameter[] = L"inputEncoding";
-static const wchar_t kOutputEncodingParameter[] = L"outputEncoding";
-
-static const wchar_t kGoogleAcceptedSuggestionParameter[] =
- L"google:acceptedSuggestion";
+static const char kCountParameter[] = "count";
+static const char kStartIndexParameter[] = "startIndex";
+static const char kStartPageParameter[] = "startPage";
+static const char kLanguageParameter[] = "language";
+static const char kInputEncodingParameter[] = "inputEncoding";
+static const char kOutputEncodingParameter[] = "outputEncoding";
+
+static const char kGoogleAcceptedSuggestionParameter[] =
+ "google:acceptedSuggestion";
// Host/Domain Google searches are relative to.
-static const wchar_t kGoogleBaseURLParameter[] = L"google:baseURL";
+static const char kGoogleBaseURLParameter[] = "google:baseURL";
static const char kGoogleBaseURLParameterFull[] = "{google:baseURL}";
// Like google:baseURL, but for the Search Suggest capability.
static const char kGoogleBaseSuggestURLParameter[] =
"google:baseSuggestURL";
static const char kGoogleBaseSuggestURLParameterFull[] =
"{google:baseSuggestURL}";
-static const wchar_t kGoogleOriginalQueryForSuggestionParameter[] =
- L"google:originalQueryForSuggestion";
-static const wchar_t kGoogleRLZParameter[] = L"google:RLZ";
+static const char kGoogleOriginalQueryForSuggestionParameter[] =
+ "google:originalQueryForSuggestion";
+static const char kGoogleRLZParameter[] = "google:RLZ";
// Same as kSearchTermsParameter, with no escaping.
-static const wchar_t kGoogleUnescapedSearchTermsParameter[] =
- L"google:unescapedSearchTerms";
+static const char kGoogleUnescapedSearchTermsParameter[] =
+ "google:unescapedSearchTerms";
static const char kGoogleUnescapedSearchTermsParameterFull[] =
"{google:unescapedSearchTerms}";
@@ -65,19 +65,19 @@ static const char kDisplayUnescapedSearchTerms[] = "%S";
// Used if the count parameter is not optional. Indicates we want 10 search
// results.
-static const wchar_t kDefaultCount[] = L"10";
+static const char kDefaultCount[] = "10";
// Used if the parameter kOutputEncodingParameter is required.
-static const wchar_t kOutputEncodingType[] = L"UTF-8";
+static const char kOutputEncodingType[] = "UTF-8";
// static
-std::wstring* TemplateURLRef::google_base_url_ = NULL;
+std::string* TemplateURLRef::google_base_url_ = NULL;
TemplateURLRef::TemplateURLRef() {
- Set(std::wstring(), 0, 0);
+ Set(std::string(), 0, 0);
}
-void TemplateURLRef::Set(const std::wstring& url,
+void TemplateURLRef::Set(const std::string& url,
int index_offset,
int page_offset) {
url_ = url;
@@ -88,7 +88,7 @@ void TemplateURLRef::Set(const std::wstring& url,
bool TemplateURLRef::ParseParameter(size_t start,
size_t end,
- std::wstring* url,
+ std::string* url,
Replacements* replacements) const {
DCHECK(start != std::string::npos &&
end != std::string::npos && end > start);
@@ -98,8 +98,8 @@ bool TemplateURLRef::ParseParameter(size_t start,
optional = true;
length--;
}
- std::wstring parameter(url->substr(start + 1, length));
- std::wstring full_parameter(url->substr(start, end - start + 1));
+ std::string parameter(url->substr(start + 1, length));
+ std::string full_parameter(url->substr(start, end - start + 1));
// Remove the parameter from the string.
url->erase(start, end - start + 1);
if (parameter == kSearchTermsParameter) {
@@ -109,11 +109,11 @@ bool TemplateURLRef::ParseParameter(size_t start,
url->insert(start, kDefaultCount);
} else if (parameter == kStartIndexParameter) {
if (!optional) {
- url->insert(start, IntToWString(index_offset_));
+ url->insert(start, IntToString(index_offset_));
}
} else if (parameter == kStartPageParameter) {
if (!optional) {
- url->insert(start, IntToWString(page_offset_));
+ url->insert(start, IntToString(page_offset_));
}
} else if (parameter == kLanguageParameter) {
replacements->push_back(Replacement(LANGUAGE, start));
@@ -126,8 +126,7 @@ bool TemplateURLRef::ParseParameter(size_t start,
replacements->push_back(Replacement(GOOGLE_ACCEPTED_SUGGESTION, start));
} else if (parameter == kGoogleBaseURLParameter) {
replacements->push_back(Replacement(GOOGLE_BASE_URL, start));
- } else if (WideToUTF16Hack(parameter) ==
- ASCIIToUTF16(kGoogleBaseSuggestURLParameter)) {
+ } else if (parameter == kGoogleBaseSuggestURLParameter) {
replacements->push_back(Replacement(GOOGLE_BASE_SUGGEST_URL, start));
} else if (parameter == kGoogleOriginalQueryForSuggestionParameter) {
replacements->push_back(Replacement(GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION,
@@ -144,11 +143,11 @@ bool TemplateURLRef::ParseParameter(size_t start,
return true;
}
-std::wstring TemplateURLRef::ParseURL(const std::wstring& url,
- Replacements* replacements,
- bool* valid) const {
+std::string TemplateURLRef::ParseURL(const std::string& url,
+ Replacements* replacements,
+ bool* valid) const {
*valid = false;
- std::wstring parsed_url = url;
+ std::string parsed_url = url;
for (size_t last = 0; last != std::string::npos; ) {
last = parsed_url.find(kStartParameter, last);
if (last != std::string::npos) {
@@ -170,7 +169,7 @@ std::wstring TemplateURLRef::ParseURL(const std::wstring& url,
}
} else {
// Open brace without a closing brace, return.
- return std::wstring();
+ return std::string();
}
}
}
@@ -206,15 +205,15 @@ void TemplateURLRef::ParseIfNecessary() const {
}
void TemplateURLRef::ParseHostAndSearchTermKey() const {
- string16 url_string = WideToUTF16Hack(url_);
+ std::string url_string = url_;
ReplaceSubstringsAfterOffset(&url_string, 0,
- ASCIIToUTF16(kGoogleBaseURLParameterFull),
- WideToUTF16Hack(GoogleBaseURLValue()));
+ kGoogleBaseURLParameterFull,
+ GoogleBaseURLValue());
ReplaceSubstringsAfterOffset(&url_string, 0,
- ASCIIToUTF16(kGoogleBaseSuggestURLParameterFull),
- WideToUTF16Hack(GoogleBaseSuggestURLValue()));
+ kGoogleBaseSuggestURLParameterFull,
+ GoogleBaseSuggestURLValue());
- GURL url(UTF16ToUTF8(url_string));
+ GURL url(url_string);
if (!url.is_valid())
return;
@@ -241,14 +240,14 @@ void TemplateURLRef::ParseHostAndSearchTermKey() const {
}
}
-std::wstring TemplateURLRef::ReplaceSearchTerms(
+std::string TemplateURLRef::ReplaceSearchTerms(
const TemplateURL& host,
const std::wstring& terms,
int accepted_suggestion,
const std::wstring& original_query_for_suggestion) const {
ParseIfNecessary();
if (!valid_)
- return std::wstring();
+ return std::string();
if (replacements_.empty())
return parsed_url_;
@@ -259,7 +258,7 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
for (Replacements::iterator i = replacements_.begin();
i != replacements_.end(); ++i) {
if (i->type == SEARCH_TERMS) {
- std::wstring::size_type query_start = parsed_url_.find(L'?');
+ std::wstring::size_type query_start = parsed_url_.find('?');
is_in_query = query_start != std::wstring::npos &&
(static_cast<std::wstring::size_type>(i->index) > query_start);
break;
@@ -268,7 +267,7 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
string16 encoded_terms;
string16 encoded_original_query;
- std::wstring input_encoding;
+ std::string input_encoding;
// If the search terms are in query - escape them respecting the encoding.
if (is_in_query) {
// Encode the search terms so that we know the encoding.
@@ -283,7 +282,7 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
true,
&encoded_original_query);
}
- input_encoding = ASCIIToWide(encodings[i]);
+ input_encoding = encodings[i];
break;
}
}
@@ -295,14 +294,14 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
WideToUTF16Hack(EscapeQueryParamValueUTF8(
original_query_for_suggestion, true));
}
- input_encoding = L"UTF-8";
+ input_encoding = "UTF-8";
}
} else {
encoded_terms = WideToUTF16Hack(UTF8ToWide(EscapePath(WideToUTF8(terms))));
- input_encoding = L"UTF-8";
+ input_encoding = "UTF-8";
}
- std::wstring url = parsed_url_;
+ std::string url = parsed_url_;
// replacements_ is ordered in ascending order, as such we need to iterate
// from the back.
@@ -315,9 +314,9 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
case GOOGLE_ACCEPTED_SUGGESTION:
if (accepted_suggestion == NO_SUGGESTION_CHOSEN)
- url.insert(i->index, L"aq=f&");
+ url.insert(i->index, "aq=f&");
else if (accepted_suggestion != NO_SUGGESTIONS_AVAILABLE)
- url.insert(i->index, StringPrintf(L"aq=%d&", accepted_suggestion));
+ url.insert(i->index, StringPrintf("aq=%d&", accepted_suggestion));
break;
case GOOGLE_BASE_URL:
@@ -330,8 +329,8 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
case GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION:
if (accepted_suggestion >= 0)
- url.insert(i->index, L"oq=" +
- UTF16ToWideHack(encoded_original_query) + L"&");
+ url.insert(i->index, "oq=" + UTF16ToUTF8(encoded_original_query) +
+ "&");
break;
case GOOGLE_RLZ: {
@@ -344,7 +343,7 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
if (!rlz_string.empty()) {
rlz_string = L"rlz=" + rlz_string + L"&";
- url.insert(i->index, rlz_string);
+ url.insert(i->index, WideToUTF8(rlz_string));
}
#endif
break;
@@ -352,21 +351,20 @@ std::wstring TemplateURLRef::ReplaceSearchTerms(
case GOOGLE_UNESCAPED_SEARCH_TERMS: {
std::string unescaped_terms;
- base::WideToCodepage(terms, WideToASCII(input_encoding).c_str(),
+ base::WideToCodepage(terms, input_encoding.c_str(),
base::OnStringConversionError::SKIP,
&unescaped_terms);
- url.insert(i->index, std::wstring(unescaped_terms.begin(),
- unescaped_terms.end()));
+ url.insert(i->index, std::string(unescaped_terms.begin(),
+ unescaped_terms.end()));
break;
}
case LANGUAGE:
- url.insert(i->index,
- ASCIIToWide(g_browser_process->GetApplicationLocale()));
+ url.insert(i->index, g_browser_process->GetApplicationLocale());
break;
case SEARCH_TERMS:
- url.insert(i->index, UTF16ToWideHack(encoded_terms));
+ url.insert(i->index, UTF16ToUTF8(encoded_terms));
break;
default:
@@ -390,13 +388,10 @@ bool TemplateURLRef::IsValid() const {
std::wstring TemplateURLRef::DisplayURL() const {
ParseIfNecessary();
- if (!valid_)
- return url_; // If we're not valid, don't escape anything.
-
- if (replacements_.empty())
- return url_; // Nothing to replace, return the url.
+ if (!valid_ || replacements_.empty())
+ return UTF8ToWide(url_);
- string16 result = WideToUTF16Hack(url_);
+ string16 result = UTF8ToUTF16(url_);
ReplaceSubstringsAfterOffset(&result, 0,
ASCIIToUTF16(kSearchTermsParameterFull),
ASCIIToUTF16(kDisplaySearchTerms));
@@ -410,7 +405,7 @@ std::wstring TemplateURLRef::DisplayURL() const {
}
// static
-std::wstring TemplateURLRef::DisplayURLToURLRef(
+std::string TemplateURLRef::DisplayURLToURLRef(
const std::wstring& display_url) {
string16 result = WideToUTF16Hack(display_url);
ReplaceSubstringsAfterOffset(&result, 0, ASCIIToUTF16(kDisplaySearchTerms),
@@ -419,7 +414,7 @@ std::wstring TemplateURLRef::DisplayURLToURLRef(
&result, 0,
ASCIIToUTF16(kDisplayUnescapedSearchTerms),
ASCIIToUTF16(kGoogleUnescapedSearchTermsParameterFull));
- return UTF16ToWideHack(result);
+ return UTF16ToUTF8(result);
}
const std::string& TemplateURLRef::GetHost() const {
@@ -484,21 +479,21 @@ void TemplateURLRef::InvalidateCachedValues() const {
// Returns the value to use for replacements of type GOOGLE_BASE_URL.
// static
-std::wstring TemplateURLRef::GoogleBaseURLValue() {
+std::string TemplateURLRef::GoogleBaseURLValue() {
return google_base_url_ ?
- (*google_base_url_) : UTF8ToWide(GoogleURLTracker::GoogleURL().spec());
+ (*google_base_url_) : GoogleURLTracker::GoogleURL().spec();
}
// Returns the value to use for replacements of type GOOGLE_BASE_SUGGEST_URL.
// static
-std::wstring TemplateURLRef::GoogleBaseSuggestURLValue() {
+std::string TemplateURLRef::GoogleBaseSuggestURLValue() {
// The suggest base URL we want at the end is something like
// "http://clients1.google.TLD/complete/". The key bit we want from the
// original Google base URL is the TLD.
// Start with the Google base URL.
const GURL base_url(google_base_url_ ?
- GURL(WideToUTF8(*google_base_url_)) : GoogleURLTracker::GoogleURL());
+ GURL(*google_base_url_) : GoogleURLTracker::GoogleURL());
DCHECK(base_url.is_valid());
// Change "www." to "clients1." in the hostname. If no "www." was found, just
@@ -516,7 +511,7 @@ std::wstring TemplateURLRef::GoogleBaseSuggestURLValue() {
// Clear the query and ref.
repl.ClearQuery();
repl.ClearRef();
- return UTF8ToWide(base_url.ReplaceComponents(repl).spec());
+ return base_url.ReplaceComponents(repl).spec();
}
// TemplateURL ----------------------------------------------------------------
@@ -550,13 +545,13 @@ std::wstring TemplateURL::AdjustedShortNameForLocaleDirection() const {
return short_name_;
}
-void TemplateURL::SetSuggestionsURL(const std::wstring& suggestions_url,
+void TemplateURL::SetSuggestionsURL(const std::string& suggestions_url,
int index_offset,
int page_offset) {
suggestions_url_.Set(suggestions_url, index_offset, page_offset);
}
-void TemplateURL::SetURL(const std::wstring& url,
+void TemplateURL::SetURL(const std::string& url,
int index_offset,
int page_offset) {
url_.Set(url, index_offset, page_offset);
@@ -625,9 +620,9 @@ void TemplateURL::InvalidateCachedValues() const {
std::string TemplateURL::GetExtensionId() const {
DCHECK(IsExtensionKeyword());
- return GURL(WideToUTF8(url_.url())).host();
+ return GURL(url_.url()).host();
}
bool TemplateURL::IsExtensionKeyword() const {
- return GURL(WideToUTF8(url_.url())).SchemeIs(chrome::kExtensionScheme);
+ return GURL(url_.url()).SchemeIs(chrome::kExtensionScheme);
}
diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h
index 8641720..fb8a707 100644
--- a/chrome/browser/search_engines/template_url.h
+++ b/chrome/browser/search_engines/template_url.h
@@ -45,7 +45,7 @@ class TemplateURLRef {
TemplateURLRef();
- TemplateURLRef(const std::wstring& url, int index_offset, int page_offset)
+ TemplateURLRef(const std::string& url, int index_offset, int page_offset)
: url_(url),
index_offset_(index_offset),
page_offset_(page_offset),
@@ -64,14 +64,14 @@ class TemplateURLRef {
// returns false), an empty string is returned.
//
// The TemplateURL is used to determine the input encoding for the term.
- std::wstring ReplaceSearchTerms(
+ std::string ReplaceSearchTerms(
const TemplateURL& host,
const std::wstring& terms,
int accepted_suggestion,
const std::wstring& original_query_for_suggestion) const;
// Returns the raw URL. None of the parameters will have been replaced.
- const std::wstring& url() const { return url_; }
+ const std::string& url() const { return url_; }
// Returns the index number of the first search result.
int index_offset() const { return index_offset_; }
@@ -89,7 +89,7 @@ class TemplateURLRef {
// Converts a string as returned by DisplayURL back into a string as
// understood by TemplateURLRef.
- static std::wstring DisplayURLToURLRef(const std::wstring& display_url);
+ static std::string DisplayURLToURLRef(const std::wstring& display_url);
// If this TemplateURLRef is valid and contains one search term, this returns
// the host/path of the URL, otherwise this returns an empty string.
@@ -150,7 +150,7 @@ class TemplateURLRef {
void InvalidateCachedValues() const;
// Resets the url.
- void Set(const std::wstring& url, int index_offset, int page_offset);
+ void Set(const std::string& url, int index_offset, int page_offset);
// Parses the parameter in url at the specified offset. start/end specify the
// range of the parameter in the url, including the braces. If the parameter
@@ -163,7 +163,7 @@ class TemplateURLRef {
// returned.
bool ParseParameter(size_t start,
size_t end,
- std::wstring* url,
+ std::string* url,
Replacements* replacements) const;
// Parses the specified url, replacing parameters as necessary. If
@@ -171,9 +171,9 @@ class TemplateURLRef {
// known parameters that are encountered an entry is added to replacements.
// If there is an error parsing the url, valid is set to false, and an empty
// string is returned.
- std::wstring ParseURL(const std::wstring& url,
- Replacements* replacements,
- bool* valid) const;
+ std::string ParseURL(const std::string& url,
+ Replacements* replacements,
+ bool* valid) const;
// If the url has not yet been parsed, ParseURL is invoked.
// NOTE: While this is const, it modifies parsed_, valid_, parsed_url_ and
@@ -184,14 +184,14 @@ class TemplateURLRef {
void ParseHostAndSearchTermKey() const;
// Returns the value for the GOOGLE_BASE_URL term.
- static std::wstring GoogleBaseURLValue();
+ static std::string GoogleBaseURLValue();
// Returns the value for the GOOGLE_BASE_SUGGEST_URL term.
- static std::wstring GoogleBaseSuggestURLValue();
+ static std::string GoogleBaseSuggestURLValue();
// The raw URL. Where as this contains all the terms (such as {searchTerms}),
// parsed_url_ has them all stripped out.
- std::wstring url_;
+ std::string url_;
// indexOffset defined for the Url element.
int index_offset_;
@@ -207,7 +207,7 @@ class TemplateURLRef {
// The parsed URL. All terms have been stripped out of this with
// replacements_ giving the index of the terms to replace.
- mutable std::wstring parsed_url_;
+ mutable std::string parsed_url_;
// Do we support replacement?
mutable bool supports_replacements_;
@@ -224,7 +224,7 @@ class TemplateURLRef {
// For testing. If non-null this is the replacement value for GOOGLE_BASE_URL
// terms.
- static std::wstring* google_base_url_;
+ static std::string* google_base_url_;
};
// Describes the relevant portions of a single OSD document.
@@ -298,7 +298,7 @@ class TemplateURL {
// as your type. If NULL, this url does not support suggestions.
// Be sure and check the resulting TemplateURLRef for SupportsReplacement
// before using.
- void SetSuggestionsURL(const std::wstring& suggestions_url,
+ void SetSuggestionsURL(const std::string& suggestions_url,
int index_offset,
int page_offset);
const TemplateURLRef* suggestions_url() const {
@@ -310,7 +310,7 @@ class TemplateURL {
// Parameterized URL for providing the results. This may be NULL.
// Be sure and check the resulting TemplateURLRef for SupportsReplacement
// before using.
- void SetURL(const std::wstring& url, int index_offset, int page_offset);
+ void SetURL(const std::string& url, int index_offset, int page_offset);
// Returns the TemplateURLRef that may be used for search results. This
// returns NULL if a url element was not specified.
const TemplateURLRef* url() const {
diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc
index cffc48e..f5a3878 100644
--- a/chrome/browser/search_engines/template_url_fetcher.cc
+++ b/chrome/browser/search_engines/template_url_fetcher.cc
@@ -117,7 +117,7 @@ void TemplateURLFetcher::RequestDelegate::OnURLFetchComplete(
// Previous keyword was generated from URL where OSDD was placed and
// it gives wrong result when OSDD is located on third party site that
// has nothing in common with search engine in OSDD.
- GURL keyword_url(WideToUTF16Hack(template_url->url()->url()));
+ GURL keyword_url(template_url->url()->url());
std::wstring new_keyword = TemplateURLModel::GenerateKeyword(
keyword_url, false);
if (!new_keyword.empty())
@@ -127,7 +127,7 @@ void TemplateURLFetcher::RequestDelegate::OnURLFetchComplete(
const TemplateURL* existing_url;
if (keyword_.empty() ||
!model || !model->loaded() ||
- !model->CanReplaceKeyword(keyword_, template_url->url()->url(),
+ !model->CanReplaceKeyword(keyword_, GURL(template_url->url()->url()),
&existing_url)) {
if (autodetected_ || !model || !model->loaded()) {
fetcher_->RequestCompleted(this);
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index a14dfda..b59c8ca31 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -25,10 +25,10 @@
using base::Time;
// String in the URL that is replaced by the search term.
-static const wchar_t kSearchTermParameter[] = L"{searchTerms}";
+static const char kSearchTermParameter[] = "{searchTerms}";
// String in Initializer that is replaced with kSearchTermParameter.
-static const wchar_t kTemplateParameter[] = L"%s";
+static const char kTemplateParameter[] = "%s";
// Term used when generating a search url. Use something obscure so that on
// the rare case the term replaces the URL it's unlikely another keyword would
@@ -110,9 +110,9 @@ void TemplateURLModel::Init(const Initializer* initializers,
DCHECK(initializers[i].content);
size_t template_position =
- std::wstring(initializers[i].url).find(kTemplateParameter);
+ std::string(initializers[i].url).find(kTemplateParameter);
DCHECK(template_position != std::wstring::npos);
- std::wstring osd_url(initializers[i].url);
+ std::string osd_url(initializers[i].url);
osd_url.replace(template_position, arraysize(kTemplateParameter) - 1,
kSearchTermParameter);
@@ -190,16 +190,16 @@ GURL TemplateURLModel::GenerateSearchURL(const TemplateURL* t_url) {
return GURL();
if (!search_ref->SupportsReplacement())
- return GURL(WideToUTF8(search_ref->url()));
+ return GURL(search_ref->url());
- return GURL(WideToUTF8(search_ref->ReplaceSearchTerms(
+ return GURL(search_ref->ReplaceSearchTerms(
*t_url, kReplacementTerm, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- std::wstring())));
+ std::wstring()));
}
bool TemplateURLModel::CanReplaceKeyword(
const std::wstring& keyword,
- const std::wstring& url,
+ const GURL& url,
const TemplateURL** template_url_to_replace) {
DCHECK(!keyword.empty()); // This should only be called for non-empty
// keywords. If we need to support empty kewords
@@ -218,9 +218,8 @@ bool TemplateURLModel::CanReplaceKeyword(
// be replaced. We do this to ensure that if the user assigns a different
// keyword to a generated TemplateURL, we won't regenerate another keyword for
// the same host.
- GURL gurl(WideToUTF8(url));
- if (gurl.is_valid() && !gurl.host().empty())
- return CanReplaceKeywordForHost(gurl.host(), template_url_to_replace);
+ if (url.is_valid() && !url.host().empty())
+ return CanReplaceKeywordForHost(url.host(), template_url_to_replace);
return true;
}
@@ -460,7 +459,7 @@ void TemplateURLModel::IncrementUsageCount(const TemplateURL* url) {
void TemplateURLModel::ResetTemplateURL(const TemplateURL* url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& search_url) {
+ const std::string& search_url) {
DCHECK(url && find(template_urls_.begin(), template_urls_.end(), url) !=
template_urls_.end());
RemoveFromMaps(url);
@@ -805,25 +804,25 @@ void TemplateURLModel::SaveDefaultSearchProviderToPrefs(
RegisterPrefs(prefs);
- const std::wstring search_url =
- (t_url && t_url->url()) ? t_url->url()->url() : std::wstring();
+ const std::string search_url =
+ (t_url && t_url->url()) ? t_url->url()->url() : std::string();
prefs->SetString(prefs::kDefaultSearchProviderSearchURL, search_url);
- const std::wstring suggest_url =
+ const std::string suggest_url =
(t_url && t_url->suggestions_url()) ? t_url->suggestions_url()->url() :
- std::wstring();
+ std::string();
prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, suggest_url);
- const std::wstring name =
- t_url ? t_url->short_name() : std::wstring();
+ const std::string name =
+ t_url ? WideToUTF8(t_url->short_name()) : std::string();
prefs->SetString(prefs::kDefaultSearchProviderName, name);
- const std::wstring id_string =
- t_url ? Int64ToWString(t_url->id()) : std::wstring();
+ const std::string id_string =
+ t_url ? Int64ToString(t_url->id()) : std::string();
prefs->SetString(prefs::kDefaultSearchProviderID, id_string);
- const std::wstring prepopulate_id =
- t_url ? Int64ToWString(t_url->prepopulate_id()) : std::wstring();
+ const std::string prepopulate_id =
+ t_url ? Int64ToString(t_url->prepopulate_id()) : std::string();
prefs->SetString(prefs::kDefaultSearchProviderPrepopulateID, prepopulate_id);
prefs->ScheduleSavePersistentPrefs();
@@ -840,9 +839,9 @@ bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs(
}
RegisterPrefs(prefs);
- std::wstring suggest_url =
+ std::string suggest_url =
prefs->GetString(prefs::kDefaultSearchProviderSuggestURL);
- std::wstring search_url =
+ std::string search_url =
prefs->GetString(prefs::kDefaultSearchProviderSearchURL);
if (suggest_url.empty() && search_url.empty()) {
@@ -851,11 +850,12 @@ bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs(
return true;
}
- std::wstring name = prefs->GetString(prefs::kDefaultSearchProviderName);
+ std::wstring name =
+ UTF8ToWide(prefs->GetString(prefs::kDefaultSearchProviderName));
- std::wstring id_string = prefs->GetString(prefs::kDefaultSearchProviderID);
+ std::string id_string = prefs->GetString(prefs::kDefaultSearchProviderID);
- std::wstring prepopulate_id =
+ std::string prepopulate_id =
prefs->GetString(prefs::kDefaultSearchProviderPrepopulateID);
*default_provider = new TemplateURL();
@@ -863,10 +863,9 @@ bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs(
(*default_provider)->SetURL(search_url, 0, 0);
(*default_provider)->SetSuggestionsURL(suggest_url, 0, 0);
if (!id_string.empty())
- (*default_provider)->set_id(StringToInt64(WideToUTF16Hack(id_string)));
+ (*default_provider)->set_id(StringToInt64(id_string));
if (!prepopulate_id.empty())
- (*default_provider)->set_prepopulate_id(StringToInt(WideToUTF16Hack(
- prepopulate_id)));
+ (*default_provider)->set_prepopulate_id(StringToInt(prepopulate_id));
return true;
}
@@ -1080,8 +1079,8 @@ void TemplateURLModel::RegisterExtensionKeyword(Extension* extension) {
// This URL is not actually used for navigation. It holds the extension's
// ID, as well as forcing the TemplateURL to be treated as a search keyword.
template_url->SetURL(
- UTF8ToWide(chrome::kExtensionScheme) + L"://" +
- UTF8ToWide(extension->id()) + L"/?q={searchTerms}", 0, 0);
+ std::string(chrome::kExtensionScheme) + "://" +
+ extension->id() + "/?q={searchTerms}", 0, 0);
template_url->set_safe_for_autoreplace(false);
Add(template_url);
diff --git a/chrome/browser/search_engines/template_url_model.h b/chrome/browser/search_engines/template_url_model.h
index a08cc15..95a4a8d 100644
--- a/chrome/browser/search_engines/template_url_model.h
+++ b/chrome/browser/search_engines/template_url_model.h
@@ -13,6 +13,7 @@
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/notification_registrar.h"
+class GURL;
class Extension;
class PrefService;
class Profile;
@@ -59,7 +60,7 @@ class TemplateURLModel : public WebDataServiceConsumer,
// Each initializer is mapped to a TemplateURL.
struct Initializer {
const wchar_t* const keyword;
- const wchar_t* const url;
+ const char* const url;
const wchar_t* const content;
};
@@ -92,7 +93,7 @@ class TemplateURLModel : public WebDataServiceConsumer,
// url gives the url of the search query. The url is used to avoid generating
// a TemplateURL for an existing TemplateURL that shares the same host.
bool CanReplaceKeyword(const std::wstring& keyword,
- const std::wstring& url,
+ const GURL& url,
const TemplateURL** template_url_to_replace);
// Returns (in |matches|) all keywords beginning with |prefix|, sorted
@@ -164,7 +165,7 @@ class TemplateURLModel : public WebDataServiceConsumer,
void ResetTemplateURL(const TemplateURL* url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& search_url);
+ const std::string& search_url);
// The default search provider. This may be null.
void SetDefaultSearchProvider(const TemplateURL* url);
diff --git a/chrome/browser/search_engines/template_url_model_unittest.cc b/chrome/browser/search_engines/template_url_model_unittest.cc
index 9865f5c..f393dcb 100644
--- a/chrome/browser/search_engines/template_url_model_unittest.cc
+++ b/chrome/browser/search_engines/template_url_model_unittest.cc
@@ -128,7 +128,7 @@ class TemplateURLModelTest : public testing::Test,
TemplateURL* AddKeywordWithDate(const std::wstring& keyword,
bool autogenerate_keyword,
- const std::wstring& url,
+ const std::string& url,
const std::wstring& short_name,
bool safe_for_autoreplace,
Time created_date) {
@@ -198,9 +198,9 @@ class TemplateURLModelTest : public testing::Test,
return model_->GetAndClearSearchTerm();
}
- void SetGoogleBaseURL(const std::wstring& base_url) const {
+ void SetGoogleBaseURL(const std::string& base_url) const {
delete TemplateURLRef::google_base_url_;
- TemplateURLRef::google_base_url_ = new std::wstring(base_url);
+ TemplateURLRef::google_base_url_ = new std::string(base_url);
}
MessageLoopForUI message_loop_;
@@ -222,7 +222,7 @@ TEST_F(TemplateURLModelTest, AddUpdateRemove) {
const size_t initial_count = model_->GetTemplateURLs().size();
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google.com/foo/bar", 0, 0);
+ t_url->SetURL("http://www.google.com/foo/bar", 0, 0);
t_url->set_keyword(L"keyword");
t_url->set_short_name(L"google");
GURL favicon_url("http://favicon.url");
@@ -230,7 +230,7 @@ TEST_F(TemplateURLModelTest, AddUpdateRemove) {
t_url->set_date_created(Time::FromTimeT(100));
t_url->set_safe_for_autoreplace(true);
model_->Add(t_url);
- ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", std::wstring(), NULL));
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", GURL(), NULL));
VerifyObserverCount(1);
BlockTillServiceProcessesRequests();
// We need to clone as model takes ownership of TemplateURL and will
@@ -246,16 +246,16 @@ TEST_F(TemplateURLModelTest, AddUpdateRemove) {
const TemplateURL* loaded_url = model_->GetTemplateURLForKeyword(L"keyword");
ASSERT_TRUE(loaded_url != NULL);
AssertEquals(cloned_url, *loaded_url);
- ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", std::wstring(), NULL));
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", GURL(), NULL));
// Mutate an element and verify it succeeded.
- model_->ResetTemplateURL(loaded_url, L"a", L"b", L"c");
+ model_->ResetTemplateURL(loaded_url, L"a", L"b", "c");
ASSERT_EQ(L"a", loaded_url->short_name());
ASSERT_EQ(L"b", loaded_url->keyword());
- ASSERT_EQ(L"c", loaded_url->url()->url());
+ ASSERT_EQ("c", loaded_url->url()->url());
ASSERT_FALSE(loaded_url->safe_for_autoreplace());
- ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", std::wstring(), NULL));
- ASSERT_FALSE(model_->CanReplaceKeyword(L"b", std::wstring(), NULL));
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"keyword", GURL(), NULL));
+ ASSERT_FALSE(model_->CanReplaceKeyword(L"b", GURL(), NULL));
cloned_url = *loaded_url;
BlockTillServiceProcessesRequests();
ResetModel(true);
@@ -302,16 +302,16 @@ TEST_F(TemplateURLModelTest, ClearBrowsingData_Keywords) {
EXPECT_EQ(0U, model_->GetTemplateURLs().size());
// Create one with a 0 time.
- AddKeywordWithDate(L"key1", false, L"http://foo1", L"name1", true, Time());
+ AddKeywordWithDate(L"key1", false, "http://foo1", L"name1", true, Time());
// Create one for now and +/- 1 day.
- AddKeywordWithDate(L"key2", false, L"http://foo2", L"name2", true,
+ AddKeywordWithDate(L"key2", false, "http://foo2", L"name2", true,
now - one_day);
- AddKeywordWithDate(L"key3", false, L"http://foo3", L"name3", true, now);
- AddKeywordWithDate(L"key4", false, L"http://foo4", L"name4", true,
+ AddKeywordWithDate(L"key3", false, "http://foo3", L"name3", true, now);
+ AddKeywordWithDate(L"key4", false, "http://foo4", L"name4", true,
now + one_day);
// Try the other three states.
- AddKeywordWithDate(L"key5", false, L"http://foo5", L"name5", false, now);
- AddKeywordWithDate(L"key6", false, L"http://foo6", L"name6", false,
+ AddKeywordWithDate(L"key5", false, "http://foo5", L"name5", false, now);
+ AddKeywordWithDate(L"key6", false, "http://foo6", L"name6", false,
month_ago);
// We just added a few items, validate them.
@@ -352,7 +352,7 @@ TEST_F(TemplateURLModelTest, Reset) {
VerifyLoad();
const size_t initial_count = model_->GetTemplateURLs().size();
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.google.com/foo/bar", 0, 0);
+ t_url->SetURL("http://www.google.com/foo/bar", 0, 0);
t_url->set_keyword(L"keyword");
t_url->set_short_name(L"google");
GURL favicon_url("http://favicon.url");
@@ -366,7 +366,7 @@ TEST_F(TemplateURLModelTest, Reset) {
// Reset the short name, keyword, url and make sure it takes.
const std::wstring new_short_name(L"a");
const std::wstring new_keyword(L"b");
- const std::wstring new_url(L"c");
+ const std::string new_url("c");
model_->ResetTemplateURL(t_url, new_short_name, new_keyword, new_url);
ASSERT_EQ(new_short_name, t_url->short_name());
ASSERT_EQ(new_keyword, t_url->keyword());
@@ -391,7 +391,7 @@ TEST_F(TemplateURLModelTest, DefaultSearchProvider) {
// Add a new TemplateURL.
VerifyLoad();
const size_t initial_count = model_->GetTemplateURLs().size();
- TemplateURL* t_url = AddKeywordWithDate(L"key1", false, L"http://foo1",
+ TemplateURL* t_url = AddKeywordWithDate(L"key1", false, "http://foo1",
L"name1", true, Time());
changed_count_ = 0;
@@ -423,7 +423,7 @@ TEST_F(TemplateURLModelTest, TemplateURLWithNoKeyword) {
const size_t initial_count = model_->GetTemplateURLs().size();
- AddKeywordWithDate(std::wstring(), false, L"http://foo1", L"name1", true,
+ AddKeywordWithDate(std::wstring(), false, "http://foo1", L"name1", true,
Time());
// We just added a few items, validate them.
@@ -445,35 +445,35 @@ TEST_F(TemplateURLModelTest, TemplateURLWithNoKeyword) {
}
TEST_F(TemplateURLModelTest, CantReplaceWithSameKeyword) {
- ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", std::wstring(), NULL));
- TemplateURL* t_url = AddKeywordWithDate(L"foo", false, L"http://foo1",
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", GURL(), NULL));
+ TemplateURL* t_url = AddKeywordWithDate(L"foo", false, "http://foo1",
L"name1", true, Time());
// Can still replace, newly added template url is marked safe to replace.
- ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", L"http://foo2", NULL));
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", GURL("http://foo2"), NULL));
// ResetTemplateURL marks the TemplateURL as unsafe to replace, so it should
// no longer be replaceable.
model_->ResetTemplateURL(t_url, t_url->short_name(), t_url->keyword(),
t_url->url()->url());
- ASSERT_FALSE(model_->CanReplaceKeyword(L"foo", L"http://foo2", NULL));
+ ASSERT_FALSE(model_->CanReplaceKeyword(L"foo", GURL("http://foo2"), NULL));
}
TEST_F(TemplateURLModelTest, CantReplaceWithSameHosts) {
- ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", L"http://foo.com", NULL));
- TemplateURL* t_url = AddKeywordWithDate(L"foo", false, L"http://foo.com",
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"foo", GURL("http://foo.com"), NULL));
+ TemplateURL* t_url = AddKeywordWithDate(L"foo", false, "http://foo.com",
L"name1", true, Time());
// Can still replace, newly added template url is marked safe to replace.
- ASSERT_TRUE(model_->CanReplaceKeyword(L"bar", L"http://foo.com", NULL));
+ ASSERT_TRUE(model_->CanReplaceKeyword(L"bar", GURL("http://foo.com"), NULL));
// ResetTemplateURL marks the TemplateURL as unsafe to replace, so it should
// no longer be replaceable.
model_->ResetTemplateURL(t_url, t_url->short_name(), t_url->keyword(),
t_url->url()->url());
- ASSERT_FALSE(model_->CanReplaceKeyword(L"bar", L"http://foo.com", NULL));
+ ASSERT_FALSE(model_->CanReplaceKeyword(L"bar", GURL("http://foo.com"), NULL));
}
TEST_F(TemplateURLModelTest, HasDefaultSearchProvider) {
@@ -490,8 +490,8 @@ TEST_F(TemplateURLModelTest, DefaultSearchProviderLoadedFromPrefs) {
VerifyLoad();
TemplateURL* template_url = new TemplateURL();
- template_url->SetURL(L"http://url", 0, 0);
- template_url->SetSuggestionsURL(L"http://url2", 0, 0);
+ template_url->SetURL("http://url", 0, 0);
+ template_url->SetSuggestionsURL("http://url2", 0, 0);
template_url->set_short_name(L"a");
template_url->set_safe_for_autoreplace(true);
template_url->set_date_created(Time::FromTimeT(100));
@@ -517,9 +517,9 @@ TEST_F(TemplateURLModelTest, DefaultSearchProviderLoadedFromPrefs) {
const TemplateURL* default_turl = model_->GetDefaultSearchProvider();
ASSERT_TRUE(default_turl);
ASSERT_TRUE(default_turl->url());
- ASSERT_EQ(L"http://url", default_turl->url()->url());
+ ASSERT_EQ("http://url", default_turl->url()->url());
ASSERT_TRUE(default_turl->suggestions_url());
- ASSERT_EQ(L"http://url2", default_turl->suggestions_url()->url());
+ ASSERT_EQ("http://url2", default_turl->suggestions_url()->url());
ASSERT_EQ(L"a", default_turl->short_name());
ASSERT_EQ(id, default_turl->id());
@@ -591,7 +591,7 @@ TEST_F(TemplateURLModelTest, UpdateKeywordSearchTermsForURL) {
{ "http://x/foo?q=b&q=xx", L"" },
};
- AddKeywordWithDate(L"x", false, L"http://x/foo?q={searchTerms}", L"name",
+ AddKeywordWithDate(L"x", false, "http://x/foo?q={searchTerms}", L"name",
false, Time());
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
@@ -612,7 +612,7 @@ TEST_F(TemplateURLModelTest, DontUpdateKeywordSearchForNonReplaceable) {
{ "http://x/foo?y=xx" },
};
- AddKeywordWithDate(L"x", false, L"http://x/foo", L"name", false, Time());
+ AddKeywordWithDate(L"x", false, "http://x/foo", L"name", false, Time());
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
history::URLVisitedDetails details;
@@ -627,9 +627,9 @@ TEST_F(TemplateURLModelTest, ChangeGoogleBaseValue) {
// NOTE: Do not do a VerifyLoad() here as it will load the prepopulate data,
// which also has a {google:baseURL} keyword in it, which will confuse this
// test.
- SetGoogleBaseURL(L"http://google.com/");
+ SetGoogleBaseURL("http://google.com/");
const TemplateURL* t_url = AddKeywordWithDate(std::wstring(), true,
- L"{google:baseURL}?q={searchTerms}", L"name", false, Time());
+ "{google:baseURL}?q={searchTerms}", L"name", false, Time());
ASSERT_EQ(t_url, model_->GetTemplateURLForHost("google.com"));
EXPECT_EQ("google.com", t_url->url()->GetHost());
EXPECT_EQ(L"google.com", t_url->keyword());
@@ -637,7 +637,7 @@ TEST_F(TemplateURLModelTest, ChangeGoogleBaseValue) {
// Change the Google base url.
model_->loaded_ = true; // Hack to make sure we get notified of the base URL
// changing.
- SetGoogleBaseURL(L"http://foo.com/");
+ SetGoogleBaseURL("http://foo.com/");
model_->GoogleBaseURLChanged();
VerifyObserverCount(1);
@@ -646,7 +646,7 @@ TEST_F(TemplateURLModelTest, ChangeGoogleBaseValue) {
EXPECT_TRUE(model_->GetTemplateURLForHost("google.com") == NULL);
EXPECT_EQ("foo.com", t_url->url()->GetHost());
EXPECT_EQ(L"foo.com", t_url->keyword());
- EXPECT_EQ(L"http://foo.com/?q=x", t_url->url()->ReplaceSearchTerms(*t_url,
+ EXPECT_EQ("http://foo.com/?q=x", t_url->url()->ReplaceSearchTerms(*t_url,
L"x", TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
}
@@ -676,15 +676,15 @@ TEST_F(TemplateURLModelTest, GenerateVisitOnKeyword) {
// Create a keyword.
TemplateURL* t_url = AddKeywordWithDate(
- L"keyword", false, L"http://foo.com/foo?query={searchTerms}",
+ L"keyword", false, "http://foo.com/foo?query={searchTerms}",
L"keyword", true, base::Time::Now());
// Add a visit that matches the url of the keyword.
HistoryService* history =
profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
history->AddPage(
- GURL(WideToUTF8(t_url->url()->ReplaceSearchTerms(*t_url, L"blah", 0,
- std::wstring()))),
+ GURL(t_url->url()->ReplaceSearchTerms(*t_url, L"blah", 0,
+ std::wstring())),
NULL, 0, GURL(), PageTransition::KEYWORD, history::RedirectList(),
false);
@@ -716,7 +716,7 @@ TEST_F(TemplateURLModelTest, MergeDeletesUnusedProviders) {
// Create an URL that appears to have been prepopulated but won't be in the
// current data.
TemplateURL* t_url = new TemplateURL();
- t_url->SetURL(L"http://www.unittest.com/", 0, 0);
+ t_url->SetURL("http://www.unittest.com/", 0, 0);
t_url->set_keyword(L"unittest");
t_url->set_short_name(L"unittest");
t_url->set_safe_for_autoreplace(true);
diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc
index bdc2641..06948cb 100644
--- a/chrome/browser/search_engines/template_url_parser.cc
+++ b/chrome/browser/search_engines/template_url_parser.cc
@@ -200,7 +200,7 @@ class ParsingContext {
void DeriveImageFromURL() {
if (derive_image_from_url_ &&
url_->GetFavIconURL().is_empty() && url_->url()) {
- GURL url(WideToUTF8(url_->url()->url())); // More url's please...
+ GURL url(url_->url()->url()); // More url's please...
url_->SetFavIconURL(TemplateURL::GenerateFaviconURL(url));
}
}
@@ -296,7 +296,7 @@ void ParseURL(const xmlChar** atts, ParsingContext* context) {
TemplateURL* turl = context->template_url();
const xmlChar** attributes = atts;
- std::wstring template_url;
+ std::string template_url;
bool is_post = false;
bool is_html_url = false;
bool is_suggest_url = false;
@@ -311,7 +311,7 @@ void ParseURL(const xmlChar** atts, ParsingContext* context) {
is_html_url = (type == kHTMLType);
is_suggest_url = (type == kSuggestionType);
} else if (name == kURLTemplateAttribute) {
- template_url = XMLCharToWide(value);
+ template_url = XMLCharToString(value);
} else if (name == kURLIndexOffsetAttribute) {
index_offset =
std::max(1, StringToInt(WideToUTF16Hack(XMLCharToWide(value))));
@@ -406,7 +406,7 @@ void ProcessURLParams(ParsingContext* context) {
if (!context->parameter_filter() && context->extra_params().empty())
return;
- GURL url(WideToUTF8(t_url_ref->url()));
+ GURL url(t_url_ref->url());
// If there is a parameter filter, parse the existing URL and remove any
// unwanted parameter.
TemplateURLParser::ParameterFilter* filter = context->parameter_filter();
@@ -443,11 +443,11 @@ void ProcessURLParams(ParsingContext* context) {
repl.SetQueryStr(new_query);
url = url.ReplaceComponents(repl);
if (context->is_suggestion()) {
- t_url->SetSuggestionsURL(UTF8ToWide(url.spec()),
+ t_url->SetSuggestionsURL(url.spec(),
t_url_ref->index_offset(),
t_url_ref->page_offset());
} else {
- t_url->SetURL(UTF8ToWide(url.spec()),
+ t_url->SetURL(url.spec(),
t_url_ref->index_offset(),
t_url_ref->page_offset());
}
@@ -527,7 +527,7 @@ void CharactersImpl(void *ctx, const xmlChar *ch, int len) {
bool IsHTTPRef(const TemplateURLRef* ref) {
if (ref == NULL)
return true;
- GURL url(WideToUTF8(ref->url()));
+ GURL url(ref->url());
return (url.is_valid() && (url.SchemeIs(chrome::kHttpScheme) ||
url.SchemeIs(chrome::kHttpsScheme)));
}
@@ -581,7 +581,7 @@ bool TemplateURLParser::Parse(const unsigned char* data, size_t length,
if (context.method() == ParsingContext::POST)
return false;
if (context.suggestion_method() == ParsingContext::POST)
- url->SetSuggestionsURL(L"", 0, 0);
+ url->SetSuggestionsURL("", 0, 0);
if (!url->short_name().empty() && !url->description().empty()) {
// So far so good, make sure the urls are http.
diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc
index e99c68f..14d6203 100644
--- a/chrome/browser/search_engines/template_url_parser_unittest.cc
+++ b/chrome/browser/search_engines/template_url_parser_unittest.cc
@@ -90,7 +90,7 @@ TEST_F(TemplateURLParserTest, TestDictionary) {
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
EXPECT_EQ(template_url_.url()->url(),
- L"http://dictionary.reference.com/browse/{searchTerms}?r=75");
+ "http://dictionary.reference.com/browse/{searchTerms}?r=75");
}
TEST_F(TemplateURLParserTest, TestMSDN) {
@@ -104,7 +104,7 @@ TEST_F(TemplateURLParserTest, TestMSDN) {
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
EXPECT_EQ(template_url_.url()->url(),
- L"http://search.msdn.microsoft.com/search/default.aspx?Query={searchTerms}&brand=msdn&locale=en-US");
+ "http://search.msdn.microsoft.com/search/default.aspx?Query={searchTerms}&brand=msdn&locale=en-US");
}
TEST_F(TemplateURLParserTest, TestWikipedia) {
@@ -118,11 +118,11 @@ TEST_F(TemplateURLParserTest, TestWikipedia) {
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
EXPECT_EQ(template_url_.url()->url(),
- L"http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}");
+ "http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}");
EXPECT_TRUE(template_url_.suggestions_url() != NULL);
EXPECT_TRUE(template_url_.suggestions_url()->SupportsReplacement());
EXPECT_EQ(template_url_.suggestions_url()->url(),
- L"http://en.wikipedia.org/w/api.php?action=opensearch&search={searchTerms}");
+ "http://en.wikipedia.org/w/api.php?action=opensearch&search={searchTerms}");
ASSERT_EQ(2U, template_url_.input_encodings().size());
EXPECT_EQ("UTF-8", template_url_.input_encodings()[0]);
EXPECT_EQ("Shift_JIS", template_url_.input_encodings()[1]);
@@ -166,10 +166,10 @@ TEST_F(TemplateURLParserTest, TestFirefoxEbay) {
EXPECT_EQ(L"eBay", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
- std::wstring exp_url =
- L"http://search.ebay.com/search/search.dll?query={searchTerms}&"
- L"MfcISAPICommand=GetResult&ht=1&srchdesc=n&maxRecordsReturned=300&"
- L"maxRecordsPerPage=50&SortProperty=MetaEndSort";
+ std::string exp_url =
+ "http://search.ebay.com/search/search.dll?query={searchTerms}&"
+ "MfcISAPICommand=GetResult&ht=1&srchdesc=n&maxRecordsReturned=300&"
+ "maxRecordsPerPage=50&SortProperty=MetaEndSort";
EXPECT_EQ(exp_url, template_url_.url()->url());
ASSERT_EQ(1U, template_url_.input_encodings().size());
EXPECT_EQ("ISO-8859-1", template_url_.input_encodings()[0]);
@@ -187,7 +187,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxWebster) {
EXPECT_EQ(L"Webster", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
- EXPECT_EQ(L"http://www.webster.com/cgi-bin/dictionary?va={searchTerms}",
+ EXPECT_EQ("http://www.webster.com/cgi-bin/dictionary?va={searchTerms}",
template_url_.url()->url());
ASSERT_EQ(1U, template_url_.input_encodings().size());
EXPECT_EQ("ISO-8859-1", template_url_.input_encodings()[0]);
@@ -205,10 +205,10 @@ TEST_F(TemplateURLParserTest, TestFirefoxYahoo) {
EXPECT_EQ(L"Yahoo", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
- EXPECT_EQ(L"http://ff.search.yahoo.com/gossip?"
- L"output=fxjson&command={searchTerms}",
+ EXPECT_EQ("http://ff.search.yahoo.com/gossip?"
+ "output=fxjson&command={searchTerms}",
template_url_.suggestions_url()->url());
- EXPECT_EQ(L"http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
+ EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
template_url_.url()->url());
ASSERT_EQ(1U, template_url_.input_encodings().size());
EXPECT_EQ("UTF-8", template_url_.input_encodings()[0]);
@@ -229,7 +229,7 @@ TEST_F(TemplateURLParserTest, TestPostSuggestion) {
EXPECT_TRUE(template_url_.url() != NULL);
EXPECT_TRUE(template_url_.url()->SupportsReplacement());
EXPECT_TRUE(template_url_.suggestions_url() == NULL);
- EXPECT_EQ(L"http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
+ EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8",
template_url_.url()->url());
ASSERT_EQ(1U, template_url_.input_encodings().size());
EXPECT_EQ("UTF-8", template_url_.input_encodings()[0]);
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index 445381a..2c971325 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/common/chrome_switches.h"
@@ -1886,7 +1887,8 @@ const PrepopulatedEngine* engines_CA[] =
// Switzerland
const PrepopulatedEngine* engines_CH[] =
- { &google, &yahoo_ch, &bing_de_CH, &bing_fr_CH, &search_de_CH, &search_fr_CH, };
+ { &google, &yahoo_ch, &bing_de_CH, &bing_fr_CH, &search_de_CH,
+ &search_fr_CH, };
// Chile
const PrepopulatedEngine* engines_CL[] =
@@ -2808,11 +2810,11 @@ void GetPrepopulatedEngines(PrefService* prefs,
for (size_t i = 0; i < num_engines; ++i) {
TemplateURL* new_turl = new TemplateURL();
- new_turl->SetURL(engines[i]->search_url, 0, 0);
+ new_turl->SetURL(WideToUTF8(engines[i]->search_url), 0, 0);
if (engines[i]->favicon_url)
new_turl->SetFavIconURL(GURL(engines[i]->favicon_url));
if (engines[i]->suggest_url)
- new_turl->SetSuggestionsURL(engines[i]->suggest_url, 0, 0);
+ new_turl->SetSuggestionsURL(WideToUTF8(engines[i]->suggest_url), 0, 0);
new_turl->set_short_name(engines[i]->name);
if (engines[i]->keyword == NULL)
new_turl->set_autogenerate_keyword(true);
diff --git a/chrome/browser/search_engines/template_url_table_model.cc b/chrome/browser/search_engines/template_url_table_model.cc
index 3d81695..1192db0 100644
--- a/chrome/browser/search_engines/template_url_table_model.cc
+++ b/chrome/browser/search_engines/template_url_table_model.cc
@@ -82,7 +82,7 @@ class ModelEntry {
if (!fav_icon_url.is_valid()) {
// The favicon url isn't always set. Guess at one here.
if (template_url_.url() && template_url_.url()->IsValid()) {
- GURL url = GURL(WideToUTF16Hack(template_url_.url()->url()));
+ GURL url = GURL(template_url_.url()->url());
if (url.is_valid())
fav_icon_url = TemplateURL::GenerateFaviconURL(url);
}
@@ -271,7 +271,7 @@ void TemplateURLTableModel::Add(int index, TemplateURL* template_url) {
void TemplateURLTableModel::ModifyTemplateURL(int index,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url) {
+ const std::string& url) {
DCHECK(index >= 0 && index <= RowCount());
const TemplateURL* template_url = &GetTemplateURL(index);
template_url_model_->RemoveObserver(this);
diff --git a/chrome/browser/search_engines/template_url_table_model.h b/chrome/browser/search_engines/template_url_table_model.h
index e7a0d23..1909172 100644
--- a/chrome/browser/search_engines/template_url_table_model.h
+++ b/chrome/browser/search_engines/template_url_table_model.h
@@ -53,7 +53,7 @@ class TemplateURLTableModel : public TableModel,
// Update the entry at the specified index.
void ModifyTemplateURL(int index, const std::wstring& title,
- const std::wstring& keyword, const std::wstring& url);
+ const std::wstring& keyword, const std::string& url);
// Reloads the icon at the specified index.
void ReloadIcon(int index);
diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc
index 9f3c248..16eafec 100644
--- a/chrome/browser/search_engines/template_url_unittest.cc
+++ b/chrome/browser/search_engines/template_url_unittest.cc
@@ -17,10 +17,10 @@ class TemplateURLTest : public testing::Test {
TemplateURLRef::google_base_url_ = NULL;
}
- void CheckSuggestBaseURL(const wchar_t* base_url,
- const wchar_t* base_suggest_url) const {
+ void CheckSuggestBaseURL(const char* base_url,
+ const char* base_suggest_url) const {
delete TemplateURLRef::google_base_url_;
- TemplateURLRef::google_base_url_ = new std::wstring(base_url);
+ TemplateURLRef::google_base_url_ = new std::string(base_url);
EXPECT_STREQ(base_suggest_url,
TemplateURLRef::GoogleBaseSuggestURLValue().c_str());
}
@@ -34,22 +34,22 @@ TEST_F(TemplateURLTest, Defaults) {
}
TEST_F(TemplateURLTest, TestValidWithComplete) {
- TemplateURLRef ref(L"{searchTerms}", 0, 0);
+ TemplateURLRef ref("{searchTerms}", 0, 0);
ASSERT_TRUE(ref.IsValid());
}
TEST_F(TemplateURLTest, URLRefTestSearchTerms) {
struct SearchTermsCase {
- const wchar_t* url;
+ const char* url;
const wchar_t* terms;
const char* output;
} search_term_cases[] = {
- { L"http://foo{searchTerms}", L"sea rch/bar", "http://foosea%20rch/bar" },
- { L"http://foo{searchTerms}?boo=abc", L"sea rch/bar",
+ { "http://foo{searchTerms}", L"sea rch/bar", "http://foosea%20rch/bar" },
+ { "http://foo{searchTerms}?boo=abc", L"sea rch/bar",
"http://foosea%20rch/bar?boo=abc" },
- { L"http://foo/?boo={searchTerms}", L"sea rch/bar",
+ { "http://foo/?boo={searchTerms}", L"sea rch/bar",
"http://foo/?boo=sea+rch%2Fbar" },
- { L"http://en.wikipedia.org/{searchTerms}", L"wiki/?",
+ { "http://en.wikipedia.org/{searchTerms}", L"wiki/?",
"http://en.wikipedia.org/wiki/%3F" }
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) {
@@ -59,8 +59,8 @@ TEST_F(TemplateURLTest, URLRefTestSearchTerms) {
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, value.terms,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, value.terms,
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ(value.output, result.spec());
}
@@ -68,45 +68,45 @@ TEST_F(TemplateURLTest, URLRefTestSearchTerms) {
TEST_F(TemplateURLTest, URLRefTestCount) {
TemplateURL t_url;
- TemplateURLRef ref(L"http://foo{searchTerms}{count?}", 0, 0);
+ TemplateURLRef ref("http://foo{searchTerms}{count?}", 0, 0);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://foox/", result.spec());
}
TEST_F(TemplateURLTest, URLRefTestCount2) {
TemplateURL t_url;
- TemplateURLRef ref(L"http://foo{searchTerms}{count}", 0, 0);
+ TemplateURLRef ref("http://foo{searchTerms}{count}", 0, 0);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://foox10/", result.spec());
}
TEST_F(TemplateURLTest, URLRefTestIndices) {
TemplateURL t_url;
- TemplateURLRef ref(L"http://foo{searchTerms}x{startIndex?}y{startPage?}",
+ TemplateURLRef ref("http://foo{searchTerms}x{startIndex?}y{startPage?}",
1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxy/", result.spec());
}
TEST_F(TemplateURLTest, URLRefTestIndices2) {
TemplateURL t_url;
- TemplateURLRef ref(L"http://foo{searchTerms}x{startIndex}y{startPage}", 1, 2);
+ TemplateURLRef ref("http://foo{searchTerms}x{startIndex}y{startPage}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxx1y2/", result.spec());
}
@@ -114,11 +114,11 @@ TEST_F(TemplateURLTest, URLRefTestIndices2) {
TEST_F(TemplateURLTest, URLRefTestEncoding) {
TemplateURL t_url;
TemplateURLRef ref(
- L"http://foo{searchTerms}x{inputEncoding?}y{outputEncoding?}a", 1, 2);
+ "http://foo{searchTerms}x{inputEncoding?}y{outputEncoding?}a", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxutf-8ya/", result.spec());
}
@@ -126,11 +126,11 @@ TEST_F(TemplateURLTest, URLRefTestEncoding) {
TEST_F(TemplateURLTest, InputEncodingBeforeSearchTerm) {
TemplateURL t_url;
TemplateURLRef ref(
- L"http://foox{inputEncoding?}a{searchTerms}y{outputEncoding?}b", 1, 2);
+ "http://foox{inputEncoding?}a{searchTerms}y{outputEncoding?}b", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxutf-8axyb/", result.spec());
}
@@ -138,11 +138,11 @@ TEST_F(TemplateURLTest, InputEncodingBeforeSearchTerm) {
TEST_F(TemplateURLTest, URLRefTestEncoding2) {
TemplateURL t_url;
TemplateURLRef ref(
- L"http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a", 1, 2);
+ "http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxutf-8yutf-8a/", result.spec());
}
@@ -174,7 +174,7 @@ TEST_F(TemplateURLTest, URLRefTermToWide) {
encodings.push_back("big-5");
t_url.set_input_encodings(encodings);
- TemplateURLRef ref(L"http://foo?q={searchTerms}", 1, 2);
+ TemplateURLRef ref("http://foo?q={searchTerms}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
@@ -201,16 +201,16 @@ TEST_F(TemplateURLTest, SetFavIcon) {
TEST_F(TemplateURLTest, DisplayURLToURLRef) {
struct TestData {
- const std::wstring url;
+ const std::string url;
const std::wstring expected_result;
} data[] = {
- { L"http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a",
+ { "http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a",
L"http://foo%sx{inputEncoding}y{outputEncoding}a" },
- { L"http://X",
+ { "http://X",
L"http://X" },
- { L"http://foo{searchTerms",
+ { "http://foo{searchTerms",
L"http://foo{searchTerms" },
- { L"http://foo{searchTerms}{language}",
+ { "http://foo{searchTerms}{language}",
L"http://foo%s{language}" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
@@ -223,32 +223,32 @@ TEST_F(TemplateURLTest, DisplayURLToURLRef) {
TEST_F(TemplateURLTest, ReplaceSearchTerms) {
struct TestData {
- const std::wstring url;
+ const std::string url;
const std::string expected_result;
} data[] = {
- { L"http://foo/{language}{searchTerms}{inputEncoding}",
+ { "http://foo/{language}{searchTerms}{inputEncoding}",
"http://foo/{language}XUTF-8" },
- { L"http://foo/{language}{inputEncoding}{searchTerms}",
+ { "http://foo/{language}{inputEncoding}{searchTerms}",
"http://foo/{language}UTF-8X" },
- { L"http://foo/{searchTerms}{language}{inputEncoding}",
+ { "http://foo/{searchTerms}{language}{inputEncoding}",
"http://foo/X{language}UTF-8" },
- { L"http://foo/{searchTerms}{inputEncoding}{language}",
+ { "http://foo/{searchTerms}{inputEncoding}{language}",
"http://foo/XUTF-8{language}" },
- { L"http://foo/{inputEncoding}{searchTerms}{language}",
+ { "http://foo/{inputEncoding}{searchTerms}{language}",
"http://foo/UTF-8X{language}" },
- { L"http://foo/{inputEncoding}{language}{searchTerms}",
+ { "http://foo/{inputEncoding}{language}{searchTerms}",
"http://foo/UTF-8{language}X" },
- { L"http://foo/{language}a{searchTerms}a{inputEncoding}a",
+ { "http://foo/{language}a{searchTerms}a{inputEncoding}a",
"http://foo/{language}aXaUTF-8a" },
- { L"http://foo/{language}a{inputEncoding}a{searchTerms}a",
+ { "http://foo/{language}a{inputEncoding}a{searchTerms}a",
"http://foo/{language}aUTF-8aXa" },
- { L"http://foo/{searchTerms}a{language}a{inputEncoding}a",
+ { "http://foo/{searchTerms}a{language}a{inputEncoding}a",
"http://foo/Xa{language}aUTF-8a" },
- { L"http://foo/{searchTerms}a{inputEncoding}a{language}a",
+ { "http://foo/{searchTerms}a{inputEncoding}a{language}a",
"http://foo/XaUTF-8a{language}a" },
- { L"http://foo/{inputEncoding}a{searchTerms}a{language}a",
+ { "http://foo/{inputEncoding}a{searchTerms}a{language}a",
"http://foo/UTF-8aXa{language}a" },
- { L"http://foo/{inputEncoding}a{language}a{searchTerms}a",
+ { "http://foo/{inputEncoding}a{language}a{searchTerms}a",
"http://foo/UTF-8a{language}aXa" },
};
TemplateURL turl;
@@ -260,8 +260,8 @@ TEST_F(TemplateURLTest, ReplaceSearchTerms) {
std::string expected_result = data[i].expected_result;
ReplaceSubstringsAfterOffset(&expected_result, 0, "{language}",
g_browser_process->GetApplicationLocale());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result = GURL(ref.ReplaceSearchTerms(turl, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(expected_result, result.spec());
}
@@ -274,21 +274,21 @@ TEST_F(TemplateURLTest, ReplaceArbitrarySearchTerms) {
struct TestData {
const std::string encoding;
const std::wstring search_term;
- const std::wstring url;
+ const std::string url;
const std::string expected_result;
} data[] = {
- { "BIG5", L"\x60BD", L"http://foo/?{searchTerms}{inputEncoding}",
+ { "BIG5", L"\x60BD", "http://foo/?{searchTerms}{inputEncoding}",
"http://foo/?%B1~BIG5" },
- { "UTF-8", L"blah", L"http://foo/?{searchTerms}{inputEncoding}",
+ { "UTF-8", L"blah", "http://foo/?{searchTerms}{inputEncoding}",
"http://foo/?blahUTF-8" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
TemplateURL turl;
turl.add_input_encoding(data[i].encoding);
TemplateURLRef ref(data[i].url, 1, 2);
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl,
+ GURL result = GURL(ref.ReplaceSearchTerms(turl,
data[i].search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- std::wstring())));
+ std::wstring()));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(data[i].expected_result, result.spec());
}
@@ -313,13 +313,13 @@ TEST_F(TemplateURLTest, Suggestions) {
};
TemplateURL turl;
turl.add_input_encoding("UTF-8");
- TemplateURLRef ref(L"http://bar/foo?{google:acceptedSuggestion}"
- L"{google:originalQueryForSuggestion}q={searchTerms}", 1, 2);
+ TemplateURLRef ref("http://bar/foo?{google:acceptedSuggestion}"
+ "{google:originalQueryForSuggestion}q={searchTerms}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl, L"foobar",
- data[i].accepted_suggestion, data[i].original_query_for_suggestion)));
+ GURL result = GURL(ref.ReplaceSearchTerms(turl, L"foobar",
+ data[i].accepted_suggestion, data[i].original_query_for_suggestion));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(data[i].expected_result, result.spec());
}
@@ -331,11 +331,11 @@ TEST_F(TemplateURLTest, RLZ) {
RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
TemplateURL t_url;
- TemplateURLRef ref(L"http://bar/?{google:RLZ}{searchTerms}", 1, 2);
+ TemplateURLRef ref("http://bar/?{google:RLZ}{searchTerms}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"x",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ GURL result(ref.ReplaceSearchTerms(t_url, L"x",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
ASSERT_TRUE(result.is_valid());
std::string expected_url = "http://bar/?";
if (!rlz_string.empty()) {
@@ -348,29 +348,29 @@ TEST_F(TemplateURLTest, RLZ) {
TEST_F(TemplateURLTest, HostAndSearchTermKey) {
struct TestData {
- const std::wstring url;
+ const std::string url;
const std::string host;
const std::string path;
const std::string search_term_key;
} data[] = {
- { L"http://blah/?foo=bar&q={searchTerms}&b=x", "blah", "/", "q"},
+ { "http://blah/?foo=bar&q={searchTerms}&b=x", "blah", "/", "q"},
// No query key should result in empty values.
- { L"http://blah/{searchTerms}", "", "", ""},
+ { "http://blah/{searchTerms}", "", "", ""},
// No term should result in empty values.
- { L"http://blah/", "", "", ""},
+ { "http://blah/", "", "", ""},
// Multiple terms should result in empty values.
- { L"http://blah/?q={searchTerms}&x={searchTerms}", "", "", ""},
+ { "http://blah/?q={searchTerms}&x={searchTerms}", "", "", ""},
// Term in the host shouldn't match.
- { L"http://{searchTerms}", "", "", ""},
+ { "http://{searchTerms}", "", "", ""},
- { L"http://blah/?q={searchTerms}", "blah", "/", "q"},
+ { "http://blah/?q={searchTerms}", "blah", "/", "q"},
// Single term with extra chars in value should match.
- { L"http://blah/?q=stock:{searchTerms}", "blah", "/", "q"},
+ { "http://blah/?q=stock:{searchTerms}", "blah", "/", "q"},
};
TemplateURL t_url;
@@ -384,15 +384,15 @@ TEST_F(TemplateURLTest, HostAndSearchTermKey) {
TEST_F(TemplateURLTest, GoogleBaseSuggestURL) {
static const struct {
- const wchar_t* const base_url;
- const wchar_t* const base_suggest_url;
+ const char* const base_url;
+ const char* const base_suggest_url;
} data[] = {
- { L"http://google.com/", L"http://clients1.google.com/complete/", },
- { L"http://www.google.com/", L"http://clients1.google.com/complete/", },
- { L"http://www.google.co.uk/", L"http://clients1.google.co.uk/complete/", },
- { L"http://www.google.com.by/",
- L"http://clients1.google.com.by/complete/", },
- { L"http://google.com/intl/xx/", L"http://clients1.google.com/complete/", },
+ { "http://google.com/", "http://clients1.google.com/complete/", },
+ { "http://www.google.com/", "http://clients1.google.com/complete/", },
+ { "http://www.google.co.uk/", "http://clients1.google.co.uk/complete/", },
+ { "http://www.google.com.by/",
+ "http://clients1.google.com.by/complete/", },
+ { "http://google.com/intl/xx/", "http://clients1.google.com/complete/", },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i)
@@ -401,7 +401,7 @@ TEST_F(TemplateURLTest, GoogleBaseSuggestURL) {
TEST_F(TemplateURLTest, Keyword) {
TemplateURL t_url;
- t_url.SetURL(L"http://www.google.com/search", 0, 0);
+ t_url.SetURL("http://www.google.com/search", 0, 0);
EXPECT_FALSE(t_url.autogenerate_keyword());
t_url.set_keyword(L"foo");
EXPECT_EQ(L"foo", t_url.keyword());
@@ -414,58 +414,58 @@ TEST_F(TemplateURLTest, Keyword) {
}
TEST_F(TemplateURLTest, ParseParameterKnown) {
- std::wstring parsed_url(L"{searchTerms}");
+ std::string parsed_url("{searchTerms}");
TemplateURLRef url_ref(parsed_url, 0, 0);
TemplateURLRef::Replacements replacements;
EXPECT_TRUE(url_ref.ParseParameter(0, 12, &parsed_url, &replacements));
- EXPECT_EQ(std::wstring(), parsed_url);
+ EXPECT_EQ(std::string(), parsed_url);
ASSERT_EQ(1U, replacements.size());
EXPECT_EQ(static_cast<size_t>(0), replacements[0].index);
EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
}
TEST_F(TemplateURLTest, ParseParameterUnknown) {
- std::wstring parsed_url(L"{}");
+ std::string parsed_url("{}");
TemplateURLRef url_ref(parsed_url, 0, 0);
TemplateURLRef::Replacements replacements;
EXPECT_FALSE(url_ref.ParseParameter(0, 1, &parsed_url, &replacements));
- EXPECT_EQ(L"{}", parsed_url);
+ EXPECT_EQ("{}", parsed_url);
EXPECT_TRUE(replacements.empty());
}
TEST_F(TemplateURLTest, ParseURLEmpty) {
- TemplateURLRef url_ref(L"", 0, 0);
+ TemplateURLRef url_ref("", 0, 0);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ(std::wstring(), url_ref.ParseURL(L"", &replacements, &valid));
+ EXPECT_EQ(std::string(), url_ref.ParseURL("", &replacements, &valid));
EXPECT_TRUE(replacements.empty());
EXPECT_TRUE(valid);
}
TEST_F(TemplateURLTest, ParseURLNoTemplateEnd) {
- TemplateURLRef url_ref(L"{", 0, 0);
+ TemplateURLRef url_ref("{", 0, 0);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ(std::wstring(), url_ref.ParseURL(L"{", &replacements, &valid));
+ EXPECT_EQ(std::string(), url_ref.ParseURL("{", &replacements, &valid));
EXPECT_TRUE(replacements.empty());
EXPECT_FALSE(valid);
}
TEST_F(TemplateURLTest, ParseURLNoKnownParameters) {
- TemplateURLRef url_ref(L"{}", 0, 0);
+ TemplateURLRef url_ref("{}", 0, 0);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ(L"{}", url_ref.ParseURL(L"{}", &replacements, &valid));
+ EXPECT_EQ("{}", url_ref.ParseURL("{}", &replacements, &valid));
EXPECT_TRUE(replacements.empty());
EXPECT_TRUE(valid);
}
TEST_F(TemplateURLTest, ParseURLTwoParameters) {
- TemplateURLRef url_ref(L"{}{{%s}}", 0, 0);
+ TemplateURLRef url_ref("{}{{%s}}", 0, 0);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ(L"{}{}",
- url_ref.ParseURL(L"{}{{searchTerms}}", &replacements, &valid));
+ EXPECT_EQ("{}{}",
+ url_ref.ParseURL("{}{{searchTerms}}", &replacements, &valid));
ASSERT_EQ(1U, replacements.size());
EXPECT_EQ(static_cast<size_t>(3), replacements[0].index);
EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
@@ -473,10 +473,10 @@ TEST_F(TemplateURLTest, ParseURLTwoParameters) {
}
TEST_F(TemplateURLTest, ParseURLNestedParameter) {
- TemplateURLRef url_ref(L"{%s", 0, 0);
+ TemplateURLRef url_ref("{%s", 0, 0);
TemplateURLRef::Replacements replacements;
bool valid = false;
- EXPECT_EQ(L"{", url_ref.ParseURL(L"{{searchTerms}", &replacements, &valid));
+ EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid));
ASSERT_EQ(1U, replacements.size());
EXPECT_EQ(static_cast<size_t>(1), replacements[0].index);
EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 1c0b266..7ac1a3f 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -110,8 +110,7 @@ int SpellCheckHost::GetSpellCheckLanguages(
NULL);
dictionary_language_pref.Init(prefs::kSpellCheckDictionary,
profile->GetPrefs(), NULL);
- std::string dictionary_language =
- WideToASCII(dictionary_language_pref.GetValue());
+ std::string dictionary_language = dictionary_language_pref.GetValue();
// The current dictionary language should be there.
languages->push_back(dictionary_language);
@@ -120,12 +119,11 @@ int SpellCheckHost::GetSpellCheckLanguages(
// from this list to the existing list of spell check languages.
std::vector<std::string> accept_languages;
- if (SpellCheckerPlatform::SpellCheckerAvailable()) {
+ if (SpellCheckerPlatform::SpellCheckerAvailable())
SpellCheckerPlatform::GetAvailableLanguages(&accept_languages);
- } else {
- SplitString(WideToASCII(accept_languages_pref.GetValue()), ',',
- &accept_languages);
- }
+ else
+ SplitString(accept_languages_pref.GetValue(), ',', &accept_languages);
+
for (std::vector<std::string>::const_iterator i = accept_languages.begin();
i != accept_languages.end(); ++i) {
std::string language =
diff --git a/chrome/browser/sync/glue/preference_model_associator_unittest.cc b/chrome/browser/sync/glue/preference_model_associator_unittest.cc
index 44b74d0..032f0ea 100644
--- a/chrome/browser/sync/glue/preference_model_associator_unittest.cc
+++ b/chrome/browser/sync/glue/preference_model_associator_unittest.cc
@@ -61,10 +61,10 @@ class AbstractPreferenceMergeTest : public testing::Test {
class ListPreferenceMergeTest : public AbstractPreferenceMergeTest {
protected:
ListPreferenceMergeTest() :
- server_url0_(L"http://example.com/server0"),
- server_url1_(L"http://example.com/server1"),
- local_url0_(L"http://example.com/local0"),
- local_url1_(L"http://example.com/local1") {}
+ server_url0_("http://example.com/server0"),
+ server_url1_("http://example.com/server1"),
+ local_url0_("http://example.com/local0"),
+ local_url1_("http://example.com/local1") {}
virtual void SetUp() {
AbstractPreferenceMergeTest::SetUp();
@@ -72,10 +72,10 @@ class ListPreferenceMergeTest : public AbstractPreferenceMergeTest {
server_url_list_.Append(Value::CreateStringValue(server_url1_));
}
- std::wstring server_url0_;
- std::wstring server_url1_;
- std::wstring local_url0_;
- std::wstring local_url1_;
+ std::string server_url0_;
+ std::string server_url1_;
+ std::string local_url0_;
+ std::string local_url1_;
ListValue server_url_list_;
};
diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
index c64710d..7757516 100644
--- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
@@ -39,12 +39,12 @@ class ProfileSyncServicePreferenceTest
: public AbstractProfileSyncServiceTest {
protected:
ProfileSyncServicePreferenceTest()
- : example_url0_(L"http://example.com/0"),
- example_url1_(L"http://example.com/1"),
- example_url2_(L"http://example.com/2"),
+ : example_url0_("http://example.com/0"),
+ example_url1_("http://example.com/1"),
+ example_url2_("http://example.com/2"),
not_synced_preference_name_(L"nonsense_pref_name"),
not_synced_preference_default_value_("default"),
- non_default_charset_value_(L"foo") {}
+ non_default_charset_value_("foo") {}
virtual void SetUp() {
profile_.reset(new TestingProfile());
@@ -188,12 +188,12 @@ class ProfileSyncServicePreferenceTest
PreferenceModelAssociator* model_associator_;
PreferenceChangeProcessor* change_processor_;
- std::wstring example_url0_;
- std::wstring example_url1_;
- std::wstring example_url2_;
+ std::string example_url0_;
+ std::string example_url1_;
+ std::string example_url2_;
std::wstring not_synced_preference_name_;
std::string not_synced_preference_default_value_;
- std::wstring non_default_charset_value_;
+ std::string non_default_charset_value_;
};
class AddPreferenceEntriesTask : public Task {
@@ -298,7 +298,7 @@ TEST_F(ProfileSyncServicePreferenceTest, ModelAssociationCloudHasData) {
scoped_ptr<const Value> value(GetSyncedValue(prefs::kHomePage));
ASSERT_TRUE(value.get());
- std::wstring string_value;
+ std::string string_value;
EXPECT_TRUE(static_cast<const StringValue*>(value.get())->
GetAsString(&string_value));
EXPECT_EQ(example_url1_, string_value);
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 9afda35..2cecbc7 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -295,7 +295,7 @@ SyncSetupFlow::~SyncSetupFlow() {
void SyncSetupFlow::GetDialogSize(gfx::Size* size) const {
PrefService* prefs = service_->profile()->GetPrefs();
gfx::Font approximate_web_font = gfx::Font::CreateFont(
- prefs->GetString(prefs::kWebKitSansSerifFontFamily),
+ UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
prefs->GetInteger(prefs::kWebKitDefaultFontSize));
*size = gfx::GetLocalizedContentsSizeForFont(
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, &current_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);
diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc
index 667d43c..c20f487 100644
--- a/chrome/browser/toolbar_model.cc
+++ b/chrome/browser/toolbar_model.cc
@@ -36,8 +36,9 @@ std::wstring ToolbarModel::GetText() const {
NavigationController* navigation_controller = GetNavigationController();
if (navigation_controller) {
- languages = navigation_controller->profile()->GetPrefs()->GetString(
- prefs::kAcceptLanguages);
+ languages = UTF8ToWide(
+ navigation_controller->profile()->GetPrefs()->GetString(
+ prefs::kAcceptLanguages));
NavigationEntry* entry = navigation_controller->GetActiveEntry();
if (!navigation_controller->tab_contents()->ShouldDisplayURL()) {
// Explicitly hide the URL for this tab.
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index da41322..e38c919 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -464,10 +464,10 @@ bool TranslateManager::IsAcceptLanguage(TabContents* tab,
void TranslateManager::InitAcceptLanguages(PrefService* prefs) {
// We have been asked for this profile, build the languages.
- std::wstring accept_langs_str = prefs->GetString(prefs::kAcceptLanguages);
+ std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages);
std::vector<std::string> accept_langs_list;
LanguageSet accept_langs_set;
- SplitString(WideToASCII(accept_langs_str), ',', &accept_langs_list);
+ SplitString(accept_langs_str, ',', &accept_langs_list);
std::vector<std::string>::const_iterator iter;
std::string ui_lang =
GetLanguageCode(g_browser_process->GetApplicationLocale());
diff --git a/chrome/browser/translate/translate_manager2.cc b/chrome/browser/translate/translate_manager2.cc
index 24cc2a6c..7f8cfa9 100644
--- a/chrome/browser/translate/translate_manager2.cc
+++ b/chrome/browser/translate/translate_manager2.cc
@@ -424,7 +424,7 @@ void TranslateManager2::DoTranslatePage(TabContents* tab,
TranslateInfoBarDelegate2* infobar = GetTranslateInfoBarDelegate2(tab);
if (infobar) {
// We don't show the translating infobar if no translate infobar is already
- // showing (that is the case when the translation was triggered by the
+ // showing (that is the case when the translation was triggered by the
// "always translate" for example).
infobar = TranslateInfoBarDelegate2::CreateInstance(
TranslateInfoBarDelegate2::TRANSLATING, TranslateErrors::NONE,
@@ -474,10 +474,10 @@ bool TranslateManager2::IsAcceptLanguage(TabContents* tab,
void TranslateManager2::InitAcceptLanguages(PrefService* prefs) {
// We have been asked for this profile, build the languages.
- std::wstring accept_langs_str = prefs->GetString(prefs::kAcceptLanguages);
+ std::string accept_langs_str = prefs->GetString(prefs::kAcceptLanguages);
std::vector<std::string> accept_langs_list;
LanguageSet accept_langs_set;
- SplitString(WideToASCII(accept_langs_str), ',', &accept_langs_list);
+ SplitString(accept_langs_str, ',', &accept_langs_list);
std::vector<std::string>::const_iterator iter;
std::string ui_lang =
GetLanguageCode(g_browser_process->GetApplicationLocale());
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 8c7deeb..c6caa97 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -115,9 +115,6 @@ static const int kSeparatorStartX = 2;
// Left-padding for the instructional text.
static const int kInstructionsPadding = 6;
-// Color of the instructional text.
-static const SkColor kInstructionsColor = SkColorSetRGB(128, 128, 142);
-
// Tag for the 'Other bookmarks' button.
static const int kOtherFolderButtonTag = 1;
@@ -193,7 +190,7 @@ class BookmarkButton : public views::TextButton {
gfx::Point location(p);
ConvertPointToScreen(this, &location);
*tooltip = CreateToolTipForURLAndTitle(location, url_, text(),
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)));
return !tooltip->empty();
}
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index 6fc5c55..3579c8c 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -277,7 +277,7 @@ void BookmarkEditorView::Init() {
std::wstring url_text;
if (details_.type == EditDetails::EXISTING_NODE) {
std::wstring languages = profile_
- ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
+ ? UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages))
: std::wstring();
// 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
diff --git a/chrome/browser/views/edit_search_engine_dialog.cc b/chrome/browser/views/edit_search_engine_dialog.cc
index c32eaba..78dfcee 100644
--- a/chrome/browser/views/edit_search_engine_dialog.cc
+++ b/chrome/browser/views/edit_search_engine_dialog.cc
@@ -8,6 +8,7 @@
#include "app/resource_bundle.h"
#include "base/i18n/rtl.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/search_engines/edit_search_engine_controller.h"
#include "chrome/browser/search_engines/template_url.h"
#include "googleurl/src/gurl.h"
@@ -86,7 +87,7 @@ bool EditSearchEngineDialog::IsDialogButtonEnabled(
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
return (controller_->IsKeywordValid(keyword_tf_->text()) &&
controller_->IsTitleValid(title_tf_->text()) &&
- controller_->IsURLValid(url_tf_->text()));
+ controller_->IsURLValid(WideToUTF8(url_tf_->text())));
}
return true;
}
@@ -98,7 +99,7 @@ bool EditSearchEngineDialog::Cancel() {
bool EditSearchEngineDialog::Accept() {
controller_->AcceptAddOrEdit(title_tf_->text(), keyword_tf_->text(),
- url_tf_->text());
+ WideToUTF8(url_tf_->text()));
return true;
}
@@ -239,7 +240,7 @@ Textfield* EditSearchEngineDialog::CreateTextfield(const std::wstring& text,
void EditSearchEngineDialog::UpdateImageViews() {
UpdateImageView(keyword_iv_, controller_->IsKeywordValid(keyword_tf_->text()),
IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT);
- UpdateImageView(url_iv_, controller_->IsURLValid(url_tf_->text()),
+ UpdateImageView(url_iv_, controller_->IsURLValid(WideToUTF8(url_tf_->text())),
IDS_SEARCH_ENGINES_INVALID_URL_TT);
UpdateImageView(title_iv_, controller_->IsTitleValid(title_tf_->text()),
IDS_SEARCH_ENGINES_INVALID_TITLE_TT);
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc
index ca0ff9e..666c7d8 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/views/keyword_editor_view.cc
@@ -102,7 +102,7 @@ KeywordEditorView::~KeywordEditorView() {
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/views/keyword_editor_view.h b/chrome/browser/views/keyword_editor_view.h
index 1b925cb3..34cd39b 100644
--- a/chrome/browser/views/keyword_editor_view.h
+++ b/chrome/browser/views/keyword_editor_view.h
@@ -59,7 +59,7 @@ class KeywordEditorView : public views::View,
virtual void OnEditedKeyword(const TemplateURL* template_url,
const std::wstring& title,
const std::wstring& keyword,
- const std::wstring& url);
+ const std::string& url);
// Overridden to invoke Layout.
virtual gfx::Size GetPreferredSize();
diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc
index 6001cc8..762c58d 100644
--- a/chrome/browser/views/options/exceptions_page_view.cc
+++ b/chrome/browser/views/options/exceptions_page_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
@@ -51,7 +52,7 @@ void ExceptionsTableModel::OnPasswordStoreRequestDone(
STLDeleteElements<PasswordRows>(&saved_signons_);
std::wstring languages =
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
for (size_t i = 0; i < result.size(); ++i) {
saved_signons_.push_back(new PasswordRow(
gfx::SortedDisplayURL(result[i]->origin, languages), result[i]));
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc
index df5b832..d120354 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -240,16 +240,18 @@ void FontsPageView::FontSelected(const gfx::Font& const_font, void* params) {
void FontsPageView::SaveChanges() {
// Set Fonts.
if (font_changed_) {
- serif_name_.SetValue(serif_font_display_view_->font_name());
+ serif_name_.SetValue(WideToUTF8(serif_font_display_view_->font_name()));
serif_size_.SetValue(serif_font_size_pixel_);
- sans_serif_name_.SetValue(sans_serif_font_display_view_->font_name());
+ sans_serif_name_.SetValue(
+ WideToUTF8(sans_serif_font_display_view_->font_name()));
sans_serif_size_.SetValue(sans_serif_font_size_pixel_);
- fixed_width_name_.SetValue(fixed_width_font_display_view_->font_name());
+ fixed_width_name_.SetValue(WideToUTF8(
+ fixed_width_font_display_view_->font_name()));
fixed_width_size_.SetValue(fixed_width_font_size_pixel_);
}
// Set Encoding.
if (default_encoding_changed_)
- default_encoding_.SetValue(ASCIIToWide(default_encoding_selected_));
+ default_encoding_.SetValue(default_encoding_selected_);
}
void FontsPageView::InitControlLayout() {
@@ -296,19 +298,19 @@ void FontsPageView::NotifyPrefChanged(const std::wstring* pref_name) {
if (!pref_name || *pref_name == prefs::kWebKitFixedFontFamily) {
fixed_width_font_size_pixel_ = fixed_width_size_.GetValue();
fixed_width_font_display_view_->SetFontType(
- fixed_width_name_.GetValue(),
+ UTF8ToWide(fixed_width_name_.GetValue()),
fixed_width_font_size_pixel_);
}
if (!pref_name || *pref_name == prefs::kWebKitSerifFontFamily) {
serif_font_size_pixel_ = serif_size_.GetValue();
serif_font_display_view_->SetFontType(
- serif_name_.GetValue(),
+ UTF8ToWide(serif_name_.GetValue()),
serif_font_size_pixel_);
}
if (!pref_name || *pref_name == prefs::kWebKitSansSerifFontFamily) {
sans_serif_font_size_pixel_ = sans_serif_size_.GetValue();
sans_serif_font_display_view_->SetFontType(
- sans_serif_name_.GetValue(),
+ UTF8ToWide(sans_serif_name_.GetValue()),
sans_serif_font_size_pixel_);
}
}
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 26878eb..20504c9 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -35,15 +35,12 @@
namespace {
-static const int kStartupRadioGroup = 1;
-static const int kHomePageRadioGroup = 2;
-static const SkColor kDefaultBrowserLabelColor = SkColorSetRGB(0, 135, 0);
-static const SkColor kNotDefaultBrowserLabelColor = SkColorSetRGB(135, 0, 0);
+const int kStartupRadioGroup = 1;
+const int kHomePageRadioGroup = 2;
+const SkColor kDefaultBrowserLabelColor = SkColorSetRGB(0, 135, 0);
+const SkColor kNotDefaultBrowserLabelColor = SkColorSetRGB(135, 0, 0);
-std::wstring GetNewTabUIURLString() {
- return UTF8ToWide(chrome::kChromeUINewTabURL);
-}
-}
+} // namespace
///////////////////////////////////////////////////////////////////////////////
// SearchEngineListModel
@@ -380,7 +377,7 @@ void GeneralPageView::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() != GetNewTabUIURLString();
+ bool homepage_valid = homepage_.GetValue() != chrome::kChromeUINewTabURL;
bool use_new_tab_page_for_homepage =
new_tab_page_is_home_page_.GetValue() || !homepage_valid;
homepage_use_newtab_radio_->SetChecked(use_new_tab_page_for_homepage);
@@ -389,7 +386,7 @@ void GeneralPageView::NotifyPrefChanged(const std::wstring* pref_name) {
homepage_use_url_radio_->SetEnabled(!managed);
if (homepage_valid)
- homepage_use_url_textfield_->SetText(homepage_.GetValue());
+ homepage_use_url_textfield_->SetText(UTF8ToWide(homepage_.GetValue()));
EnableHomepageURLField(!managed && !use_new_tab_page_for_homepage);
}
@@ -750,13 +747,12 @@ void GeneralPageView::UpdateHomepagePrefs() {
URLFixerUpper::FixupURL(
UTF16ToUTF8(homepage_use_url_textfield_->text()), std::string());
bool new_tab_page_is_home_page = homepage_use_newtab_radio_->checked();
- if (!homepage.is_valid() ||
- UTF8ToWide(homepage.spec()) == GetNewTabUIURLString()) {
+ if (!homepage.is_valid() || homepage.spec() == chrome::kChromeUINewTabURL) {
new_tab_page_is_home_page = true;
if (!homepage.has_host())
- homepage_.SetValue(std::wstring());
+ homepage_.SetValue(std::string());
} else {
- homepage_.SetValue(UTF8ToWide(homepage.spec()));
+ homepage_.SetValue(homepage.spec());
}
new_tab_page_is_home_page_.SetValue(new_tab_page_is_home_page);
}
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index 4f7991b..0a2bc589 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.cc
@@ -401,7 +401,7 @@ void LanguagesPageView::InitControlLayout() {
void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) {
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::kApplicationLocale) {
int index = ui_language_model_->GetSelectedLanguageIndex(
@@ -431,10 +431,9 @@ void LanguagesPageView::NotifyPrefChanged(const std::wstring* pref_name) {
// dictionary language in the user profile now correctly stores "fr"
// instead of "fr-FR".
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);
}
@@ -547,15 +546,15 @@ void LanguagesPageView::OnMoveUpLanguage() {
void LanguagesPageView::SaveChanges() {
if (language_order_table_model_.get() && language_table_edited_) {
- accept_languages_.SetValue(ASCIIToWide(
- language_order_table_model_->GetLanguageList()));
+ accept_languages_.SetValue(
+ language_order_table_model_->GetLanguageList());
}
if (ui_language_index_selected_ != -1) {
UserMetricsRecordAction(UserMetricsAction("Options_AppLanguage"),
g_browser_process->local_state());
- app_locale_.SetValue(ASCIIToWide(ui_language_model_->
- GetLocaleFromIndex(ui_language_index_selected_)));
+ app_locale_.SetValue(ui_language_model_->
+ GetLocaleFromIndex(ui_language_index_selected_));
// Remove pref values for spellcheck dictionaries forcefully.
PrefService* prefs = profile()->GetPrefs();
@@ -566,8 +565,8 @@ void LanguagesPageView::SaveChanges() {
if (spellcheck_language_index_selected_ != -1) {
UserMetricsRecordAction(UserMetricsAction("Options_DictionaryLanguage"),
profile()->GetPrefs());
- dictionary_language_.SetValue(ASCIIToWide(dictionary_language_model_->
- GetLocaleFromIndex(spellcheck_language_index_selected_)));
+ dictionary_language_.SetValue(dictionary_language_model_->
+ GetLocaleFromIndex(spellcheck_language_index_selected_));
}
if (enable_spellcheck_checkbox_clicked_)
diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc
index eed3fe1..a339683 100644
--- a/chrome/browser/views/options/passwords_page_view.cc
+++ b/chrome/browser/views/options/passwords_page_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/i18n/rtl.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -112,7 +113,7 @@ void PasswordsTableModel::OnPasswordStoreRequestDone(
STLDeleteElements<PasswordRows>(&saved_signons_);
saved_signons_.resize(result.size(), NULL);
std::wstring languages =
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
for (size_t i = 0; i < result.size(); ++i) {
saved_signons_[i] = new PasswordRow(
gfx::SortedDisplayURL(result[i]->origin, languages), result[i]);
diff --git a/chrome/browser/views/url_picker.cc b/chrome/browser/views/url_picker.cc
index fa5418b..aa749e8 100644
--- a/chrome/browser/views/url_picker.cc
+++ b/chrome/browser/views/url_picker.cc
@@ -219,8 +219,8 @@ bool UrlPicker::AcceleratorPressed(
void UrlPicker::OnSelectionChanged() {
int selection = url_table_->FirstSelectedRow();
if (selection >= 0 && selection < url_table_model_->RowCount()) {
- std::wstring languages =
- profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ std::wstring languages = 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.
diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc
index ac5dae6..930c933 100644
--- a/chrome/browser/web_resource/web_resource_service.cc
+++ b/chrome/browser/web_resource/web_resource_service.cc
@@ -207,8 +207,7 @@ void WebResourceService::Init() {
std::string locale = g_browser_process->GetApplicationLocale();
if (prefs_->HasPrefPath(prefs::kNTPTipsServer)) {
- web_resource_server_ =
- WideToASCII(prefs_->GetString(prefs::kNTPTipsServer));
+ web_resource_server_ = prefs_->GetString(prefs::kNTPTipsServer);
// If we are in the correct locale, initialization is done.
if (EndsWith(web_resource_server_, locale, false))
return;
@@ -218,7 +217,7 @@ void WebResourceService::Init() {
// locale, reset the server and force an immediate update of tips.
web_resource_server_ = kDefaultResourceServer;
web_resource_server_.append(locale);
- prefs_->SetString(prefs::kNTPTipsCacheUpdate, L"");
+ prefs_->SetString(prefs::kNTPTipsCacheUpdate, "");
}
void WebResourceService::EndFetch() {
@@ -270,12 +269,12 @@ void WebResourceService::StartAfterDelay() {
// Check whether we have ever put a value in the web resource cache;
// if so, pull it out and see if it's time to update again.
if (prefs_->HasPrefPath(prefs::kNTPTipsCacheUpdate)) {
- std::wstring last_update_pref =
+ std::string last_update_pref =
prefs_->GetString(prefs::kNTPTipsCacheUpdate);
if (!last_update_pref.empty()) {
int ms_until_update = kCacheUpdateDelay -
static_cast<int>((base::Time::Now() - base::Time::FromDoubleT(
- StringToDouble(WideToASCII(last_update_pref)))).InMilliseconds());
+ StringToDouble(last_update_pref))).InMilliseconds());
delay = ms_until_update > kCacheUpdateDelay ?
kCacheUpdateDelay : (ms_until_update < kStartResourceFetchDelay ?
@@ -293,6 +292,6 @@ void WebResourceService::UpdateResourceCache(const std::string& json_data) {
// Update resource server and cache update time in preferences.
prefs_->SetString(prefs::kNTPTipsCacheUpdate,
- DoubleToWString(base::Time::Now().ToDoubleT()));
- prefs_->SetString(prefs::kNTPTipsServer, ASCIIToWide(web_resource_server_));
+ DoubleToString(base::Time::Now().ToDoubleT()));
+ prefs_->SetString(prefs::kNTPTipsServer, web_resource_server_);
}
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index 02ac222..870d2d7 100644
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -546,7 +546,7 @@ static void BindURLToStatement(const TemplateURL& url, sql::Statement* s) {
url.GetFavIconURL()));
}
if (url.url())
- s->BindString(3, WideToUTF8(url.url()->url()));
+ s->BindString(3, url.url()->url());
else
s->BindString(3, std::string());
s->BindInt(4, url.safe_for_autoreplace() ? 1 : 0);
@@ -561,7 +561,7 @@ static void BindURLToStatement(const TemplateURL& url, sql::Statement* s) {
s->BindString(8, JoinStrings(";", url.input_encodings()));
s->BindInt(9, url.show_in_default_list() ? 1 : 0);
if (url.suggestions_url())
- s->BindString(10, WideToUTF8(url.suggestions_url()->url()));
+ s->BindString(10, url.suggestions_url()->url());
else
s->BindString(10, std::string());
s->BindInt(11, url.prepopulate_id());
@@ -629,7 +629,7 @@ bool WebDatabase::GetKeywords(std::vector<TemplateURL*>* urls) {
template_url->SetFavIconURL(GURL(tmp));
tmp = s.ColumnString(4);
- template_url->SetURL(UTF8ToWide(tmp), 0, 0);
+ template_url->SetURL(tmp, 0, 0);
template_url->set_safe_for_autoreplace(s.ColumnInt(5) == 1);
@@ -648,7 +648,7 @@ bool WebDatabase::GetKeywords(std::vector<TemplateURL*>* urls) {
template_url->set_show_in_default_list(s.ColumnInt(10) == 1);
tmp = s.ColumnString(11);
- template_url->SetSuggestionsURL(UTF8ToWide(tmp), 0, 0);
+ template_url->SetSuggestionsURL(tmp, 0, 0);
template_url->set_prepopulate_id(s.ColumnInt(12));
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc
index 0b9af58..3d3d1cf9 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -177,7 +177,7 @@ TEST_F(WebDatabaseTest, Keywords) {
GURL favicon_url("http://favicon.url/");
GURL originating_url("http://google.com/");
template_url.SetFavIconURL(favicon_url);
- template_url.SetURL(L"http://url/", 0, 0);
+ template_url.SetURL("http://url/", 0, 0);
template_url.set_safe_for_autoreplace(true);
template_url.set_show_in_default_list(true);
template_url.set_originating_url(originating_url);
@@ -253,10 +253,10 @@ TEST_F(WebDatabaseTest, UpdateKeyword) {
GURL favicon_url("http://favicon.url/");
GURL originating_url("http://originating.url/");
template_url.SetFavIconURL(favicon_url);
- template_url.SetURL(L"http://url/", 0, 0);
+ template_url.SetURL("http://url/", 0, 0);
template_url.set_safe_for_autoreplace(true);
template_url.set_show_in_default_list(true);
- template_url.SetSuggestionsURL(L"url2", 0, 0);
+ template_url.SetSuggestionsURL("url2", 0, 0);
SetID(1, &template_url);
EXPECT_TRUE(db.AddKeyword(template_url));
@@ -312,7 +312,7 @@ TEST_F(WebDatabaseTest, KeywordWithNoFavicon) {
TemplateURL template_url;
template_url.set_short_name(L"short_name");
template_url.set_keyword(L"keyword");
- template_url.SetURL(L"http://url/", 0, 0);
+ template_url.SetURL("http://url/", 0, 0);
template_url.set_safe_for_autoreplace(true);
SetID(-100, &template_url);