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

Side by Side Diff: components/omnibox/history_url_provider.cc

Issue 1215233003: Reland - Omnibox - Mark As Duplicates URLs that only differ by a trailing slash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move const Created 5 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/history_url_provider.h" 5 #include "components/omnibox/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 std::string() : params.languages; 1169 std::string() : params.languages;
1170 const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll & 1170 const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll &
1171 ~((params.trim_http && !history_match.match_in_scheme) ? 1171 ~((params.trim_http && !history_match.match_in_scheme) ?
1172 0 : net::kFormatUrlOmitHTTP); 1172 0 : net::kFormatUrlOmitHTTP);
1173 match.fill_into_edit = 1173 match.fill_into_edit =
1174 AutocompleteInput::FormattedStringWithEquivalentMeaning( 1174 AutocompleteInput::FormattedStringWithEquivalentMeaning(
1175 info.url(), net::FormatUrl(info.url(), languages, format_types, 1175 info.url(), net::FormatUrl(info.url(), languages, format_types,
1176 net::UnescapeRule::SPACES, NULL, NULL, 1176 net::UnescapeRule::SPACES, NULL, NULL,
1177 &inline_autocomplete_offset), 1177 &inline_autocomplete_offset),
1178 client()->GetSchemeClassifier()); 1178 client()->GetSchemeClassifier());
1179 if (!params.prevent_inline_autocomplete && 1179 if (inline_autocomplete_offset != base::string16::npos) {
Peter Kasting 2015/07/01 22:01:36 What makes this safe to remove?
1180 (inline_autocomplete_offset != base::string16::npos)) {
1181 DCHECK(inline_autocomplete_offset <= match.fill_into_edit.length()); 1180 DCHECK(inline_autocomplete_offset <= match.fill_into_edit.length());
1182 match.inline_autocompletion = 1181 match.inline_autocompletion =
1183 match.fill_into_edit.substr(inline_autocomplete_offset); 1182 match.fill_into_edit.substr(inline_autocomplete_offset);
1183 match.StripLoneSlashOnInlineAutocompletion();
1184 } 1184 }
1185 // The latter part of the test effectively asks "is the inline completion
1186 // empty?" (i.e., is this match effectively the what-you-typed match?).
1187 match.allowed_to_be_default_match = !params.prevent_inline_autocomplete || 1185 match.allowed_to_be_default_match = !params.prevent_inline_autocomplete ||
1188 ((inline_autocomplete_offset != base::string16::npos) && 1186 ((inline_autocomplete_offset != base::string16::npos) &&
1189 (inline_autocomplete_offset >= match.fill_into_edit.length())); 1187 match.inline_autocompletion.empty());
1190 1188
1191 size_t match_start = history_match.input_location; 1189 size_t match_start = history_match.input_location;
1192 match.contents = net::FormatUrl(info.url(), languages, 1190 match.contents = net::FormatUrl(info.url(), languages,
1193 format_types, net::UnescapeRule::SPACES, NULL, NULL, &match_start); 1191 format_types, net::UnescapeRule::SPACES, NULL, NULL, &match_start);
1194 if ((match_start != base::string16::npos) && 1192 if ((match_start != base::string16::npos) &&
1195 (inline_autocomplete_offset != base::string16::npos) && 1193 (inline_autocomplete_offset != base::string16::npos) &&
1196 (inline_autocomplete_offset != match_start)) { 1194 (inline_autocomplete_offset != match_start)) {
1197 DCHECK(inline_autocomplete_offset > match_start); 1195 DCHECK(inline_autocomplete_offset > match_start);
1198 AutocompleteMatch::ClassifyLocationInString(match_start, 1196 AutocompleteMatch::ClassifyLocationInString(match_start,
1199 inline_autocomplete_offset - match_start, match.contents.length(), 1197 inline_autocomplete_offset - match_start, match.contents.length(),
1200 ACMatchClassification::URL, &match.contents_class); 1198 ACMatchClassification::URL, &match.contents_class);
1201 } else { 1199 } else {
1202 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1200 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1203 match.contents.length(), ACMatchClassification::URL, 1201 match.contents.length(), ACMatchClassification::URL,
1204 &match.contents_class); 1202 &match.contents_class);
1205 } 1203 }
1206 match.description = info.title(); 1204 match.description = info.title();
1207 match.description_class = 1205 match.description_class =
1208 ClassifyDescription(params.input.text(), match.description); 1206 ClassifyDescription(params.input.text(), match.description);
1209 RecordAdditionalInfoFromUrlRow(info, &match); 1207 RecordAdditionalInfoFromUrlRow(info, &match);
1210 return match; 1208 return match;
1211 } 1209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698