From a2fedb1e1311bc6acffabebc03e8dbca761b385e Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Tue, 25 Jan 2011 15:23:36 +0000 Subject: Remove wstring from autocomplete. Recommit of r72380. BUG=23581 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6306011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72492 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/autocomplete/history_quick_provider.cc | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'chrome/browser/autocomplete/history_quick_provider.cc') diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index 0392f1e..9f8fbaa 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -52,7 +52,7 @@ void HistoryQuickProvider::Start(const AutocompleteInput& input, // NOTE: This purposefully doesn't take input.desired_tld() into account; if // it did, then holding "ctrl" would change all the results from the // HistoryQuickProvider provider, not just the What You Typed Result. - const std::wstring fixed_text(FixupUserInput(input)); + const string16 fixed_text(FixupUserInput(input)); if (fixed_text.empty()) { // Conceivably fixup could result in an empty string (although I don't // have cases where this happens offhand). We can't do anything with @@ -76,7 +76,7 @@ void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {} void HistoryQuickProvider::DoAutocomplete() { // Get the matching URLs from the DB. - string16 term_string(WideToUTF16(autocomplete_input_.text())); + string16 term_string = autocomplete_input_.text(); term_string = UnescapeURLComponent(term_string, UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); history::InMemoryURLIndex::String16Vector terms( @@ -114,34 +114,33 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( match_type == WHAT_YOU_TYPED ? std::string() : languages_; match.fill_into_edit = AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(), - UTF16ToWide(net::FormatUrl(info.url(), languages, format_types, - UnescapeRule::SPACES, NULL, NULL, - &inline_autocomplete_offset))); + net::FormatUrl(info.url(), languages, format_types, + UnescapeRule::SPACES, NULL, NULL, + &inline_autocomplete_offset)); if (!autocomplete_input_.prevent_inline_autocomplete()) match.inline_autocomplete_offset = inline_autocomplete_offset; - DCHECK((match.inline_autocomplete_offset == std::wstring::npos) || + DCHECK((match.inline_autocomplete_offset == string16::npos) || (match.inline_autocomplete_offset <= match.fill_into_edit.length())); size_t match_start = history_match.input_location; - match.contents = - UTF16ToWide(net::FormatUrl(info.url(), languages, format_types, - UnescapeRule::SPACES, NULL, NULL, - &match_start)); - if ((match_start != std::wstring::npos) && - (inline_autocomplete_offset != std::wstring::npos) && + match.contents = net::FormatUrl(info.url(), languages, format_types, + UnescapeRule::SPACES, NULL, NULL, + &match_start); + if ((match_start != string16::npos) && + (inline_autocomplete_offset != string16::npos) && (inline_autocomplete_offset != match_start)) { DCHECK(inline_autocomplete_offset > match_start); AutocompleteMatch::ClassifyLocationInString(match_start, inline_autocomplete_offset - match_start, match.contents.length(), ACMatchClassification::URL, &match.contents_class); } else { - AutocompleteMatch::ClassifyLocationInString(std::wstring::npos, 0, + AutocompleteMatch::ClassifyLocationInString(string16::npos, 0, match.contents.length(), ACMatchClassification::URL, &match.contents_class); } - match.description = UTF16ToWide(info.title()); + match.description = info.title(); AutocompleteMatch::ClassifyMatchInString(autocomplete_input_.text(), - UTF16ToWide(info.title()), + info.title(), ACMatchClassification::NONE, &match.description_class); -- cgit v1.1