| 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 28 matching lines...) Expand all Loading... |
| 39 // Used to help investigate bug 464926. NOTE: This value is defined multiple | 39 // Used to help investigate bug 464926. NOTE: This value is defined multiple |
| 40 // places in the codebase due to layering issues. DO NOT change the value here | 40 // places in the codebase due to layering issues. DO NOT change the value here |
| 41 // without changing it in all other places that it is defined in the codebase | 41 // without changing it in all other places that it is defined in the codebase |
| 42 // (search for |kBug464926CrashKey|). | 42 // (search for |kBug464926CrashKey|). |
| 43 const char kBug464926CrashKey[] = "bug-464926-info"; | 43 const char kBug464926CrashKey[] = "bug-464926-info"; |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 bool HistoryQuickProvider::disabled_ = false; | 47 bool HistoryQuickProvider::disabled_ = false; |
| 48 | 48 |
| 49 HistoryQuickProvider::HistoryQuickProvider( | 49 HistoryQuickProvider::HistoryQuickProvider(AutocompleteProviderClient* client) |
| 50 AutocompleteProviderClient* client, | |
| 51 InMemoryURLIndex* in_memory_url_index) | |
| 52 : HistoryProvider(AutocompleteProvider::TYPE_HISTORY_QUICK, client), | 50 : HistoryProvider(AutocompleteProvider::TYPE_HISTORY_QUICK, client), |
| 53 languages_(client->GetAcceptLanguages()), | 51 languages_(client->GetAcceptLanguages()), |
| 54 in_memory_url_index_(in_memory_url_index) { | 52 in_memory_url_index_(client->GetInMemoryURLIndex()) { |
| 55 } | 53 } |
| 56 | 54 |
| 57 void HistoryQuickProvider::Start(const AutocompleteInput& input, | 55 void HistoryQuickProvider::Start(const AutocompleteInput& input, |
| 58 bool minimal_changes) { | 56 bool minimal_changes) { |
| 59 matches_.clear(); | 57 matches_.clear(); |
| 60 if (disabled_ || input.from_omnibox_focus()) | 58 if (disabled_ || input.from_omnibox_focus()) |
| 61 return; | 59 return; |
| 62 | 60 |
| 63 // Don't bother with INVALID and FORCED_QUERY. | 61 // Don't bother with INVALID and FORCED_QUERY. |
| 64 if ((input.type() == metrics::OmniboxInputType::INVALID) || | 62 if ((input.type() == metrics::OmniboxInputType::INVALID) || |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 match.description = info.title(); | 270 match.description = info.title(); |
| 273 match.description_class = SpansFromTermMatch( | 271 match.description_class = SpansFromTermMatch( |
| 274 history_match.title_matches, match.description.length(), false); | 272 history_match.title_matches, match.description.length(), false); |
| 275 | 273 |
| 276 match.RecordAdditionalInfo("typed count", info.typed_count()); | 274 match.RecordAdditionalInfo("typed count", info.typed_count()); |
| 277 match.RecordAdditionalInfo("visit count", info.visit_count()); | 275 match.RecordAdditionalInfo("visit count", info.visit_count()); |
| 278 match.RecordAdditionalInfo("last visit", info.last_visit()); | 276 match.RecordAdditionalInfo("last visit", info.last_visit()); |
| 279 | 277 |
| 280 return match; | 278 return match; |
| 281 } | 279 } |
| OLD | NEW |