| 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 "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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // |fill_into_edit| if the user has typed an URL with a scheme and the | 269 // |fill_into_edit| if the user has typed an URL with a scheme and the |
| 270 // last character typed is a slash. That slash is removed by the | 270 // last character typed is a slash. That slash is removed by the |
| 271 // FormatURLWithOffsets call above. | 271 // FormatURLWithOffsets call above. |
| 272 if (inline_autocomplete_offset < match.fill_into_edit.length()) { | 272 if (inline_autocomplete_offset < match.fill_into_edit.length()) { |
| 273 match.inline_autocompletion = | 273 match.inline_autocompletion = |
| 274 match.fill_into_edit.substr(inline_autocomplete_offset); | 274 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 275 } | 275 } |
| 276 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 276 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || |
| 277 !PreventInlineAutocomplete(autocomplete_input_); | 277 !PreventInlineAutocomplete(autocomplete_input_); |
| 278 } | 278 } |
| 279 match.EnsureUWYTIsAllowedToBeDefault( |
| 280 autocomplete_input_.canonicalized_url(), |
| 281 TemplateURLServiceFactory::GetForProfile(profile_)); |
| 279 | 282 |
| 280 // Format the description autocomplete presentation. | 283 // Format the description autocomplete presentation. |
| 281 match.description = info.title(); | 284 match.description = info.title(); |
| 282 match.description_class = SpansFromTermMatch( | 285 match.description_class = SpansFromTermMatch( |
| 283 history_match.title_matches(), match.description.length(), false); | 286 history_match.title_matches(), match.description.length(), false); |
| 284 | 287 |
| 285 match.RecordAdditionalInfo("typed count", info.typed_count()); | 288 match.RecordAdditionalInfo("typed count", info.typed_count()); |
| 286 match.RecordAdditionalInfo("visit count", info.visit_count()); | 289 match.RecordAdditionalInfo("visit count", info.visit_count()); |
| 287 match.RecordAdditionalInfo("last visit", info.last_visit()); | 290 match.RecordAdditionalInfo("last visit", info.last_visit()); |
| 288 | 291 |
| 289 return match; | 292 return match; |
| 290 } | 293 } |
| 291 | 294 |
| 292 history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() { | 295 history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() { |
| 293 if (index_for_testing_.get()) | 296 if (index_for_testing_.get()) |
| 294 return index_for_testing_.get(); | 297 return index_for_testing_.get(); |
| 295 | 298 |
| 296 HistoryService* const history_service = | 299 HistoryService* const history_service = |
| 297 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 300 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 298 if (!history_service) | 301 if (!history_service) |
| 299 return NULL; | 302 return NULL; |
| 300 | 303 |
| 301 return history_service->InMemoryIndex(); | 304 return history_service->InMemoryIndex(); |
| 302 } | 305 } |
| OLD | NEW |