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

Side by Side Diff: components/omnibox/browser/history_quick_provider.cc

Issue 2963883002: Omnibox UI Experiments: Refactor HTTPS trimming into UrlFormatter. (Closed)
Patch Set: update comment Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/browser/history_quick_provider.h" 5 #include "components/omnibox/browser/history_quick_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 AutocompleteMatchType::HISTORY_TITLE : 194 AutocompleteMatchType::HISTORY_TITLE :
195 AutocompleteMatchType::HISTORY_URL); 195 AutocompleteMatchType::HISTORY_URL);
196 match.typed_count = info.typed_count(); 196 match.typed_count = info.typed_count();
197 match.destination_url = info.url(); 197 match.destination_url = info.url();
198 DCHECK(match.destination_url.is_valid()); 198 DCHECK(match.destination_url.is_valid());
199 size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset( 199 size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset(
200 autocomplete_input_.text(), FixupUserInput(autocomplete_input_).second, 200 autocomplete_input_.text(), FixupUserInput(autocomplete_input_).second,
201 false, base::UTF8ToUTF16(info.url().spec())); 201 false, base::UTF8ToUTF16(info.url().spec()));
202 202
203 base::OffsetAdjuster::Adjustments adjustments; 203 base::OffsetAdjuster::Adjustments adjustments;
204 match.contents = 204 auto format_types = AutocompleteMatch::GetFormatForSuggestionDisplay(
205 AutocompleteMatch::FormatUrlForSuggestionDisplayWithAdjustments( 205 !history_match.match_in_scheme);
206 info.url(), !history_match.match_in_scheme, &adjustments); 206 match.contents = url_formatter::FormatUrlWithAdjustments(
207 info.url(), format_types, net::UnescapeRule::SPACES, nullptr, nullptr,
208 &adjustments);
207 match.fill_into_edit = 209 match.fill_into_edit =
208 AutocompleteInput::FormattedStringWithEquivalentMeaning( 210 AutocompleteInput::FormattedStringWithEquivalentMeaning(
209 info.url(), match.contents, client()->GetSchemeClassifier()); 211 info.url(), match.contents, client()->GetSchemeClassifier());
210 std::vector<size_t> offsets = 212 std::vector<size_t> offsets =
211 OffsetsFromTermMatches(history_match.url_matches); 213 OffsetsFromTermMatches(history_match.url_matches);
212 // In addition to knowing how |offsets| is transformed, we need to know how 214 // In addition to knowing how |offsets| is transformed, we need to know how
213 // |inline_autocomplete_offset| is transformed. We add it to the end of 215 // |inline_autocomplete_offset| is transformed. We add it to the end of
214 // |offsets|, compute how everything is transformed, then remove it from the 216 // |offsets|, compute how everything is transformed, then remove it from the
215 // end. 217 // end.
216 offsets.push_back(inline_autocomplete_offset); 218 offsets.push_back(inline_autocomplete_offset);
(...skipping 25 matching lines...) Expand all
242 match.description = info.title(); 244 match.description = info.title();
243 match.description_class = SpansFromTermMatch( 245 match.description_class = SpansFromTermMatch(
244 history_match.title_matches, match.description.length(), false); 246 history_match.title_matches, match.description.length(), false);
245 247
246 match.RecordAdditionalInfo("typed count", info.typed_count()); 248 match.RecordAdditionalInfo("typed count", info.typed_count());
247 match.RecordAdditionalInfo("visit count", info.visit_count()); 249 match.RecordAdditionalInfo("visit count", info.visit_count());
248 match.RecordAdditionalInfo("last visit", info.last_visit()); 250 match.RecordAdditionalInfo("last visit", info.last_visit());
249 251
250 return match; 252 return match;
251 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698