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

Side by Side Diff: components/omnibox/bookmark_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/bookmark_provider.h" 5 #include "components/omnibox/bookmark_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 match.contents_class = 199 match.contents_class =
200 ClassificationsFromMatch(new_url_match_positions, 200 ClassificationsFromMatch(new_url_match_positions,
201 match.contents.size(), 201 match.contents.size(),
202 true); 202 true);
203 match.fill_into_edit = 203 match.fill_into_edit =
204 AutocompleteInput::FormattedStringWithEquivalentMeaning( 204 AutocompleteInput::FormattedStringWithEquivalentMeaning(
205 url, match.contents, client_->GetSchemeClassifier()); 205 url, match.contents, client_->GetSchemeClassifier());
206 if (inline_autocomplete_offset != base::string16::npos) { 206 if (inline_autocomplete_offset != base::string16::npos) {
207 // |inline_autocomplete_offset| may be beyond the end of the 207 // |inline_autocomplete_offset| may be beyond the end of the
208 // |fill_into_edit| if the user has typed an URL with a scheme and the 208 // |fill_into_edit| if the user has typed an URL with a scheme and the
209 // last character typed is a slash. That slash is removed by the 209 // last character typed is a slash. That slash may be removed by the
210 // FormatURLWithOffsets call above. 210 // FormatURLWithOffsets call above.
211 if (inline_autocomplete_offset < match.fill_into_edit.length()) { 211 if (inline_autocomplete_offset < match.fill_into_edit.length()) {
Peter Kasting 2015/07/01 22:01:36 Nit: Other than the builtin provider, every other
212 match.inline_autocompletion = 212 match.inline_autocompletion =
213 match.fill_into_edit.substr(inline_autocomplete_offset); 213 match.fill_into_edit.substr(inline_autocomplete_offset);
214 match.StripLoneSlashOnInlineAutocompletion();
214 } 215 }
215 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || 216 match.allowed_to_be_default_match = match.inline_autocompletion.empty() ||
216 !HistoryProvider::PreventInlineAutocomplete(input); 217 !HistoryProvider::PreventInlineAutocomplete(input);
217 } 218 }
218 match.description = title; 219 match.description = title;
219 match.description_class = 220 match.description_class =
220 ClassificationsFromMatch(bookmark_match.title_match_positions, 221 ClassificationsFromMatch(bookmark_match.title_match_positions,
221 match.description.size(), 222 match.description.size(),
222 false); 223 false);
223 224
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 i != positions.end(); 336 i != positions.end();
336 ++i) { 337 ++i) {
337 AutocompleteMatch::ACMatchClassifications new_class; 338 AutocompleteMatch::ACMatchClassifications new_class;
338 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, 339 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first,
339 text_length, url_style, &new_class); 340 text_length, url_style, &new_class);
340 classifications = AutocompleteMatch::MergeClassifications( 341 classifications = AutocompleteMatch::MergeClassifications(
341 classifications, new_class); 342 classifications, new_class);
342 } 343 }
343 return classifications; 344 return classifications;
344 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698