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

Side by Side Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 19197005: Omnibox: Change |inline_autocomplete_offset| to |inline_autocompletion| (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix issue with using a reference in a place we shouldn't Created 7 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 | Annotate | Revision Log
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 "chrome/browser/autocomplete/history_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(), 265 AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(),
266 net::FormatUrlWithOffsets(info.url(), languages_, format_types, 266 net::FormatUrlWithOffsets(info.url(), languages_, format_types,
267 net::UnescapeRule::SPACES, NULL, NULL, &offsets)); 267 net::UnescapeRule::SPACES, NULL, NULL, &offsets));
268 history::TermMatches new_matches = 268 history::TermMatches new_matches =
269 ReplaceOffsetsInTermMatches(history_match.url_matches, offsets); 269 ReplaceOffsetsInTermMatches(history_match.url_matches, offsets);
270 match.contents = net::FormatUrl(info.url(), languages_, format_types, 270 match.contents = net::FormatUrl(info.url(), languages_, format_types,
271 net::UnescapeRule::SPACES, NULL, NULL, NULL); 271 net::UnescapeRule::SPACES, NULL, NULL, NULL);
272 match.contents_class = 272 match.contents_class =
273 SpansFromTermMatch(new_matches, match.contents.length(), true); 273 SpansFromTermMatch(new_matches, match.contents.length(), true);
274 274
275 if (!history_match.can_inline) { 275 if (history_match.can_inline) {
276 match.inline_autocomplete_offset = string16::npos;
277 } else {
278 DCHECK(!new_matches.empty()); 276 DCHECK(!new_matches.empty());
279 match.inline_autocomplete_offset = new_matches[0].offset + 277 size_t inline_autocomplete_offset = new_matches[0].offset +
280 new_matches[0].length; 278 new_matches[0].length;
281 // The following will happen if the user has typed an URL with a scheme 279 // The following will happen if the user has typed an URL with a scheme
282 // and the last character typed is a slash because that slash is removed 280 // and the last character typed is a slash because that slash is removed
283 // by the FormatURLWithOffsets call above. 281 // by the FormatURLWithOffsets call above.
284 if (match.inline_autocomplete_offset > match.fill_into_edit.length()) 282 if (inline_autocomplete_offset > match.fill_into_edit.length())
Peter Kasting 2013/07/16 18:09:05 Nit: How about just: if (inline_autocomplete_
Mark P 2013/07/16 18:53:23 Good idea. Don't know how I missed seeing that si
285 match.inline_autocomplete_offset = match.fill_into_edit.length(); 283 inline_autocomplete_offset = match.fill_into_edit.length();
284 match.inline_autocompletion =
285 match.fill_into_edit.substr(inline_autocomplete_offset);
286 } 286 }
287 287
288 // Format the description autocomplete presentation. 288 // Format the description autocomplete presentation.
289 match.description = info.title(); 289 match.description = info.title();
290 match.description_class = SpansFromTermMatch( 290 match.description_class = SpansFromTermMatch(
291 history_match.title_matches, match.description.length(), false); 291 history_match.title_matches, match.description.length(), false);
292 292
293 match.RecordAdditionalInfo("typed count", info.typed_count()); 293 match.RecordAdditionalInfo("typed count", info.typed_count());
294 match.RecordAdditionalInfo("visit count", info.visit_count()); 294 match.RecordAdditionalInfo("visit count", info.visit_count());
295 match.RecordAdditionalInfo("last visit", info.last_visit()); 295 match.RecordAdditionalInfo("last visit", info.last_visit());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 do { 333 do {
334 offset += matches[i].length; 334 offset += matches[i].length;
335 ++i; 335 ++i;
336 } while ((i < match_count) && (offset == matches[i].offset)); 336 } while ((i < match_count) && (offset == matches[i].offset));
337 if (offset < text_length) 337 if (offset < text_length)
338 spans.push_back(ACMatchClassification(offset, url_style)); 338 spans.push_back(ACMatchClassification(offset, url_style));
339 } 339 }
340 340
341 return spans; 341 return spans;
342 } 342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698