Index: components/omnibox/browser/autocomplete_match.cc |
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc |
index dd0eaf01265b6dce6010bbc47f060bcefefea2a8..49ffb8f518373ea12757029a76bc7ff6c6d83566 100644 |
--- a/components/omnibox/browser/autocomplete_match.cc |
+++ b/components/omnibox/browser/autocomplete_match.cc |
@@ -493,32 +493,14 @@ base::string16 AutocompleteMatch::FormatUrlForSuggestionDisplay( |
const GURL& url, |
bool trim_scheme, |
size_t* offset_for_adjustment) { |
- std::vector<size_t> offsets; |
- if (offset_for_adjustment) |
- offsets.push_back(*offset_for_adjustment); |
- base::string16 result = |
- FormatUrlForSuggestionDisplayWithOffsets(url, trim_scheme, &offsets); |
- if (offset_for_adjustment) |
- *offset_for_adjustment = offsets[0]; |
- return result; |
-} |
- |
-// static |
-base::string16 AutocompleteMatch::FormatUrlForSuggestionDisplayWithOffsets( |
Justin Donnelly
2017/06/27 15:28:45
I think we should keep this function. If it makes
tommycli
2017/07/07 19:27:10
Acknowledged.
|
- const GURL& url, |
- bool trim_scheme, |
- std::vector<size_t>* offsets_for_adjustment) { |
base::OffsetAdjuster::Adjustments adjustments; |
- const base::string16& format_url_return_value = |
- FormatUrlForSuggestionDisplayWithAdjustments(url, trim_scheme, |
- &adjustments); |
- base::OffsetAdjuster::AdjustOffsets(adjustments, offsets_for_adjustment); |
- if (offsets_for_adjustment) { |
- std::for_each( |
- offsets_for_adjustment->begin(), offsets_for_adjustment->end(), |
- base::LimitOffset<std::string>(format_url_return_value.length())); |
+ base::string16 result = FormatUrlForSuggestionDisplayWithAdjustments( |
+ url, trim_scheme, &adjustments); |
+ if (offset_for_adjustment) { |
+ base::OffsetAdjuster::AdjustOffset(adjustments, offset_for_adjustment, |
+ result.length()); |
} |
- return format_url_return_value; |
+ return result; |
} |
// static |