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