diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 14:06:21 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 14:06:21 +0000 |
commit | 38a5aafb705cd127c55b3a30baa5152d52195c7c (patch) | |
tree | 894264305b2d942c2ad639c9c65bfd4d7ccd267f /chrome/browser/autocomplete/history_quick_provider.cc | |
parent | ed5e6138e9a6485b5a74431c148661aa541cd501 (diff) | |
download | chromium_src-38a5aafb705cd127c55b3a30baa5152d52195c7c.zip chromium_src-38a5aafb705cd127c55b3a30baa5152d52195c7c.tar.gz chromium_src-38a5aafb705cd127c55b3a30baa5152d52195c7c.tar.bz2 |
HQP Refactoring (in Preparation for SQLite Cache)
1. Move ownership of the InMemoryURLIndex from the InMemoryHistoryBackend to the HistoryBackend where it truly belongs.
2. Encapsulate the private, persistent data for the InMemoryURLIndex in a new class, URLIndexPrivateData.
3. Handle (by notification) URL visits, updates and deletes. Refactor use of NOTIFICATION_HISTORY_URLS_DELETED to provide the deleted URLRow so that row ID is available.
4. Correctly handle the adding and removing of page title words when a URL change is detected.
5. Move most of the support types, including the new URLIndexPrivateData class, into a new file, in_memory_url_index_types.h.
6. Replace static class member functions with non-friend, non-class functions for better flexibility.
7. Move convenience types out from InMemoryURLIndex class up into history namespace.
8. Rename convenience types to generalize their intent.
9. Other small cleanups.
BUG=96731,92718
TEST=Unit tests updated.
TBR=atwilson,brettw
Review URL: http://codereview.chromium.org/8120004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/history_quick_provider.cc')
-rw-r--r-- | chrome/browser/autocomplete/history_quick_provider.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index ae42585..8b53a02 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -16,6 +16,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/in_memory_url_index.h" +#include "chrome/browser/history/in_memory_url_index_types.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -81,8 +82,7 @@ void HistoryQuickProvider::Start(const AutocompleteInput& input, } } -// HistoryQuickProvider matches are currently not deletable. -// TODO(mrossetti): Determine when a match should be deletable. +// TODO(mrossetti): Implement this function. (Will happen in next CL.) void HistoryQuickProvider::DeleteMatch(const AutocompleteMatch& match) {} void HistoryQuickProvider::DoAutocomplete() { @@ -90,8 +90,8 @@ void HistoryQuickProvider::DoAutocomplete() { string16 term_string = autocomplete_input_.text(); term_string = net::UnescapeURLComponent(term_string, UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); - history::InMemoryURLIndex::String16Vector terms( - InMemoryURLIndex::WordVectorFromString16(term_string, false)); + history::String16Vector terms( + history::String16VectorFromString16(term_string, false)); ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(terms); if (matches.empty()) return; @@ -131,13 +131,12 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( // Format the URL autocomplete presentation. std::vector<size_t> offsets = - InMemoryURLIndex::OffsetsFromTermMatches(history_match.url_matches); + history::OffsetsFromTermMatches(history_match.url_matches); match.contents = net::FormatUrlWithOffsets(info.url(), languages_, net::kFormatUrlOmitAll, UnescapeRule::SPACES, NULL, NULL, &offsets); history::TermMatches new_matches = - InMemoryURLIndex::ReplaceOffsetsInTermMatches(history_match.url_matches, - offsets); + ReplaceOffsetsInTermMatches(history_match.url_matches, offsets); match.contents_class = SpansFromTermMatch(new_matches, match.contents.length(), true); match.fill_into_edit = match.contents; @@ -170,7 +169,8 @@ history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() { return history_service->InMemoryIndex(); } -void HistoryQuickProvider::SetIndexForTesting( +// TODO(mrossetti): This will be inlined in the next CL. +void HistoryQuickProvider::set_index( history::InMemoryURLIndex* index) { DCHECK(index); index_for_testing_.reset(index); |