Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9356)

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 115885: Hoist TrimHttpPrefix() so we only have one copy, not one per provider.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/search_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/search_provider.cc
===================================================================
--- chrome/browser/autocomplete/search_provider.cc (revision 17014)
+++ chrome/browser/autocomplete/search_provider.cc (working copy)
@@ -748,9 +748,8 @@
AutocompleteMatch::NAVSUGGEST);
match.destination_url = navigation.url;
match.contents = StringForURLDisplay(navigation.url, true);
- // TODO(kochi): Consider moving HistoryURLProvider::TrimHttpPrefix() to some
- // public utility function.
- if (!url_util::FindAndCompareScheme(WideToUTF8(input_text), "http", NULL))
+ if (!url_util::FindAndCompareScheme(WideToUTF8(input_text),
+ chrome::kHttpScheme, NULL))
TrimHttpPrefix(&match.contents);
AutocompleteMatch::ClassifyMatchInString(input_text, match.contents,
ACMatchClassification::URL,
@@ -772,24 +771,3 @@
return match;
}
-
-// TODO(kochi): This is duplicate from HistoryURLProvider.
-// static
-size_t SearchProvider::TrimHttpPrefix(std::wstring* url) {
- url_parse::Component scheme;
- if (!url_util::FindAndCompareScheme(WideToUTF8(*url), chrome::kHttpScheme,
- &scheme))
- return 0; // Not "http".
-
- // Erase scheme plus up to two slashes.
- size_t prefix_len = scheme.end() + 1; // "http:"
- const size_t after_slashes = std::min(url->length(),
- static_cast<size_t>(scheme.end() + 3));
- while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/'))
- ++prefix_len;
- if (prefix_len == url->length())
- url->clear();
- else
- url->erase(url->begin(), url->begin() + prefix_len);
- return prefix_len;
-}
« no previous file with comments | « chrome/browser/autocomplete/search_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698