| OLD | NEW |
| 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_quick_provider.h" | 5 #include "components/omnibox/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/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 kBug464926CrashKey, | 247 kBug464926CrashKey, |
| 248 info.url().spec().substr(0, 30) + " " + | 248 info.url().spec().substr(0, 30) + " " + |
| 249 base::UTF16ToUTF8(autocomplete_input_.text()).substr(0, 20) + " " + | 249 base::UTF16ToUTF8(autocomplete_input_.text()).substr(0, 20) + " " + |
| 250 base::SizeTToString(history_match.url_matches.size()) + " " + | 250 base::SizeTToString(history_match.url_matches.size()) + " " + |
| 251 base::SizeTToString(offsets.size())); | 251 base::SizeTToString(offsets.size())); |
| 252 CHECK(!new_matches.empty()); | 252 CHECK(!new_matches.empty()); |
| 253 size_t inline_autocomplete_offset = new_matches[0].offset + | 253 size_t inline_autocomplete_offset = new_matches[0].offset + |
| 254 new_matches[0].length; | 254 new_matches[0].length; |
| 255 // |inline_autocomplete_offset| may be beyond the end of the | 255 // |inline_autocomplete_offset| may be beyond the end of the |
| 256 // |fill_into_edit| if the user has typed an URL with a scheme and the | 256 // |fill_into_edit| if the user has typed an URL with a scheme and the |
| 257 // last character typed is a slash. That slash is removed by the | 257 // last character typed is a slash. That slash may be removed by the |
| 258 // FormatURLWithOffsets call above. | 258 // FormatURLWithOffsets call above. |
| 259 if (inline_autocomplete_offset < match.fill_into_edit.length()) { | 259 if (inline_autocomplete_offset < match.fill_into_edit.length()) { |
| 260 match.inline_autocompletion = | 260 match.inline_autocompletion = |
| 261 match.fill_into_edit.substr(inline_autocomplete_offset); | 261 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 262 match.StripLoneSlashOnInlineAutocompletion(); |
| 262 } | 263 } |
| 263 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 264 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || |
| 264 !PreventInlineAutocomplete(autocomplete_input_); | 265 !PreventInlineAutocomplete(autocomplete_input_); |
| 265 } | 266 } |
| 266 match.EnsureUWYTIsAllowedToBeDefault(autocomplete_input_.canonicalized_url(), | 267 match.EnsureUWYTIsAllowedToBeDefault(autocomplete_input_.canonicalized_url(), |
| 267 client()->GetTemplateURLService()); | 268 client()->GetTemplateURLService()); |
| 268 | 269 |
| 269 // Format the description autocomplete presentation. | 270 // Format the description autocomplete presentation. |
| 270 match.description = info.title(); | 271 match.description = info.title(); |
| 271 match.description_class = SpansFromTermMatch( | 272 match.description_class = SpansFromTermMatch( |
| 272 history_match.title_matches, match.description.length(), false); | 273 history_match.title_matches, match.description.length(), false); |
| 273 | 274 |
| 274 match.RecordAdditionalInfo("typed count", info.typed_count()); | 275 match.RecordAdditionalInfo("typed count", info.typed_count()); |
| 275 match.RecordAdditionalInfo("visit count", info.visit_count()); | 276 match.RecordAdditionalInfo("visit count", info.visit_count()); |
| 276 match.RecordAdditionalInfo("last visit", info.last_visit()); | 277 match.RecordAdditionalInfo("last visit", info.last_visit()); |
| 277 | 278 |
| 278 return match; | 279 return match; |
| 279 } | 280 } |
| OLD | NEW |