| 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/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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible. | 229 // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible. |
| 230 if (inline_autocomplete_offset != base::string16::npos) { | 230 if (inline_autocomplete_offset != base::string16::npos) { |
| 231 // |inline_autocomplete_offset| may be beyond the end of the | 231 // |inline_autocomplete_offset| may be beyond the end of the |
| 232 // |match.fill_into_edit| if the user has typed an URL with a scheme and the | 232 // |match.fill_into_edit| if the user has typed an URL with a scheme and the |
| 233 // last character typed is a slash. That slash is removed by the | 233 // last character typed is a slash. That slash is removed by the |
| 234 // FormatURLWithAdjustments call above. | 234 // FormatURLWithAdjustments call above. |
| 235 if (inline_autocomplete_offset < match.fill_into_edit.length()) { | 235 if (inline_autocomplete_offset < match.fill_into_edit.length()) { |
| 236 match.inline_autocompletion = | 236 match.inline_autocompletion = |
| 237 match.fill_into_edit.substr(inline_autocomplete_offset); | 237 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 238 } | 238 } |
| 239 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 239 match.allowed_to_be_default_match = |
| 240 !PreventInlineAutocomplete(autocomplete_input_); | 240 match.typed_count > 0 && |
| 241 (match.inline_autocompletion.empty() || |
| 242 !PreventInlineAutocomplete(autocomplete_input_)); |
| 241 } | 243 } |
| 242 match.EnsureUWYTIsAllowedToBeDefault(autocomplete_input_, | 244 match.EnsureUWYTIsAllowedToBeDefault(autocomplete_input_, |
| 243 client()->GetTemplateURLService()); | 245 client()->GetTemplateURLService()); |
| 244 | 246 |
| 245 // Format the description autocomplete presentation. | 247 // Format the description autocomplete presentation. |
| 246 match.description = info.title(); | 248 match.description = info.title(); |
| 247 match.description_class = SpansFromTermMatch( | 249 match.description_class = SpansFromTermMatch( |
| 248 history_match.title_matches, match.description.length(), false); | 250 history_match.title_matches, match.description.length(), false); |
| 249 | 251 |
| 250 match.RecordAdditionalInfo("typed count", info.typed_count()); | 252 match.RecordAdditionalInfo("typed count", info.typed_count()); |
| 251 match.RecordAdditionalInfo("visit count", info.visit_count()); | 253 match.RecordAdditionalInfo("visit count", info.visit_count()); |
| 252 match.RecordAdditionalInfo("last visit", info.last_visit()); | 254 match.RecordAdditionalInfo("last visit", info.last_visit()); |
| 253 | 255 |
| 254 return match; | 256 return match; |
| 255 } | 257 } |
| OLD | NEW |