summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-24 02:33:20 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-24 02:33:20 +0000
commit5c88980fa29b793fbce68c9d89849ed1ed13321e (patch)
tree08e5ae1eacf26b769a56197b0a70ecfc9616ad88 /chrome/browser/autocomplete
parent8cd74da71a1d6ac754b3408c41ee40a41204e726 (diff)
downloadchromium_src-5c88980fa29b793fbce68c9d89849ed1ed13321e.zip
chromium_src-5c88980fa29b793fbce68c9d89849ed1ed13321e.tar.gz
chromium_src-5c88980fa29b793fbce68c9d89849ed1ed13321e.tar.bz2
Revert 111378 - HQP Refactoring (in Preparation for SQLite Cache)
(See crbug.com/105340 for reverting reason and how to reproduce the issue locally) 1. Move ownership of the InMemoryURLIndex from the InMemoryHistoryBackend to the HistoryService, where it truly belongs. 2. 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. 3. Correctly handle the adding and removing of page title words when a URL change is detected. 4. Other small cleanups. BUG=96731, 92718 TEST=Unit tests updated. TBR=atwilson (for profile_sync_service_typed_url_unittest.cc) Previously reviewed as: http://codereview.chromium.org/8384024/ Review URL: http://codereview.chromium.org/8451009 TBR=mrossetti@chromium.org Review URL: http://codereview.chromium.org/8662035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/history_provider.cc4
-rw-r--r--chrome/browser/autocomplete/history_provider.h4
-rw-r--r--chrome/browser/autocomplete/history_quick_provider.cc1
-rw-r--r--chrome/browser/autocomplete/history_quick_provider_unittest.cc10
4 files changed, 8 insertions, 11 deletions
diff --git a/chrome/browser/autocomplete/history_provider.cc b/chrome/browser/autocomplete/history_provider.cc
index 8140aea..b6fb001 100644
--- a/chrome/browser/autocomplete/history_provider.cc
+++ b/chrome/browser/autocomplete/history_provider.cc
@@ -34,10 +34,8 @@ void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) {
DCHECK(history_service);
DCHECK(match.destination_url.is_valid());
history_service->DeleteURL(match.destination_url);
- DeleteMatchFromMatches(match);
-}
-void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) {
+ // Delete the match from the current set of matches.
bool found = false;
for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) {
if (i->destination_url == match.destination_url && i->type == match.type) {
diff --git a/chrome/browser/autocomplete/history_provider.h b/chrome/browser/autocomplete/history_provider.h
index cb081c3..7b145a2 100644
--- a/chrome/browser/autocomplete/history_provider.h
+++ b/chrome/browser/autocomplete/history_provider.h
@@ -46,10 +46,6 @@ class HistoryProvider : public AutocompleteProvider {
// |input.prevent_inline_autocomplete()| is true, or the input text contains
// trailing whitespace.
bool PreventInlineAutocomplete(const AutocompleteInput& input);
-
- // Finds and removes the match from the current collection of matches and
- // backing data.
- void DeleteMatchFromMatches(const AutocompleteMatch& match);
};
#endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc
index 42c5005..15c53b8 100644
--- a/chrome/browser/autocomplete/history_quick_provider.cc
+++ b/chrome/browser/autocomplete/history_quick_provider.cc
@@ -29,6 +29,7 @@
#include "net/base/escape.h"
#include "net/base/net_util.h"
+using history::InMemoryURLIndex;
using history::ScoredHistoryMatch;
using history::ScoredHistoryMatches;
diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
index 92b8852..26ae72e 100644
--- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
@@ -142,11 +142,14 @@ void HistoryQuickProviderTest::OnProviderUpdate(bool updated_matches) {
}
void HistoryQuickProviderTest::FillData() {
+ history::URLDatabase* db = history_service_->InMemoryDatabase();
+ ASSERT_TRUE(db != NULL);
+
history::InMemoryURLIndex* index =
- new history::InMemoryURLIndex(profile_.get(), FilePath());
+ new history::InMemoryURLIndex(FilePath());
PrefService* prefs = profile_->GetPrefs();
std::string languages(prefs->GetString(prefs::kAcceptLanguages));
- index->Init(languages);
+ index->Init(db, languages);
for (size_t i = 0; i < arraysize(quick_test_db); ++i) {
const TestURLInfo& cur = quick_test_db[i];
const GURL current_url(cur.url);
@@ -158,8 +161,7 @@ void HistoryQuickProviderTest::FillData() {
url_info.set_typed_count(cur.typed_count);
url_info.set_last_visit(visit_time);
url_info.set_hidden(false);
- url_info.set_id(i);
- index->UpdateURL(url_info);
+ index->UpdateURL(i, url_info);
}
provider_->set_index(index);