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

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

Issue 2940973002: Omnibox UI Experiments: Implement scheme-trimming for suggested URLs. (Closed)
Patch Set: fix Created 3 years, 6 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 history_match.url_matches.empty() ? 193 history_match.url_matches.empty() ?
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 // Format the URL autocomplete presentation.
204 const url_formatter::FormatUrlTypes format_types =
205 url_formatter::kFormatUrlOmitAll &
206 ~(!history_match.match_in_scheme ? 0 : url_formatter::kFormatUrlOmitHTTP);
207 base::OffsetAdjuster::Adjustments adjustments; 203 base::OffsetAdjuster::Adjustments adjustments;
208 match.contents = url_formatter::FormatUrlWithAdjustments( 204 match.contents =
209 info.url(), format_types, net::UnescapeRule::SPACES, nullptr, 205 AutocompleteMatch::FormatUrlForSuggestionDisplayWithAdjustments(
210 nullptr, &adjustments); 206 info.url(), !history_match.match_in_scheme, &adjustments);
211 match.fill_into_edit = 207 match.fill_into_edit =
212 AutocompleteInput::FormattedStringWithEquivalentMeaning( 208 AutocompleteInput::FormattedStringWithEquivalentMeaning(
213 info.url(), match.contents, client()->GetSchemeClassifier()); 209 info.url(), match.contents, client()->GetSchemeClassifier());
214 std::vector<size_t> offsets = 210 std::vector<size_t> offsets =
215 OffsetsFromTermMatches(history_match.url_matches); 211 OffsetsFromTermMatches(history_match.url_matches);
216 // In addition to knowing how |offsets| is transformed, we need to know how 212 // In addition to knowing how |offsets| is transformed, we need to know how
217 // |inline_autocomplete_offset| is transformed. We add it to the end of 213 // |inline_autocomplete_offset| is transformed. We add it to the end of
218 // |offsets|, compute how everything is transformed, then remove it from the 214 // |offsets|, compute how everything is transformed, then remove it from the
219 // end. 215 // end.
220 offsets.push_back(inline_autocomplete_offset); 216 offsets.push_back(inline_autocomplete_offset);
(...skipping 25 matching lines...) Expand all
246 match.description = info.title(); 242 match.description = info.title();
247 match.description_class = SpansFromTermMatch( 243 match.description_class = SpansFromTermMatch(
248 history_match.title_matches, match.description.length(), false); 244 history_match.title_matches, match.description.length(), false);
249 245
250 match.RecordAdditionalInfo("typed count", info.typed_count()); 246 match.RecordAdditionalInfo("typed count", info.typed_count());
251 match.RecordAdditionalInfo("visit count", info.visit_count()); 247 match.RecordAdditionalInfo("visit count", info.visit_count());
252 match.RecordAdditionalInfo("last visit", info.last_visit()); 248 match.RecordAdditionalInfo("last visit", info.last_visit());
253 249
254 return match; 250 return match;
255 } 251 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/clipboard_url_provider.cc ('k') | components/omnibox/browser/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698