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_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_provider.cc')
-rw-r--r-- | chrome/browser/autocomplete/history_provider.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/autocomplete/history_provider.cc b/chrome/browser/autocomplete/history_provider.cc index 9fe0754..8140aea 100644 --- a/chrome/browser/autocomplete/history_provider.cc +++ b/chrome/browser/autocomplete/history_provider.cc @@ -31,17 +31,16 @@ void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) { profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); // Delete the match from the history DB. - GURL selected_url(match.destination_url); - if (!history_service || !selected_url.is_valid()) { - NOTREACHED() << "Can't delete requested URL"; - return; - } - history_service->DeleteURL(selected_url); + DCHECK(history_service); + DCHECK(match.destination_url.is_valid()); + history_service->DeleteURL(match.destination_url); + DeleteMatchFromMatches(match); +} - // Delete the match from the current set of matches. +void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) { bool found = false; for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) { - if (i->destination_url == selected_url && i->type == match.type) { + if (i->destination_url == match.destination_url && i->type == match.type) { found = true; if (i->is_history_what_you_typed_match || i->starred) { // We can't get rid of What-You-Typed or Bookmarked matches, |