Index: chrome/browser/autocomplete/history_contents_provider.cc |
diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc |
index 5b14a3be4568f0d19351b4f2c77c1991974e14e8..dafe073635187d536ff527a7a415f6b89a0c1642 100644 |
--- a/chrome/browser/autocomplete/history_contents_provider.cc |
+++ b/chrome/browser/autocomplete/history_contents_provider.cc |
@@ -151,6 +151,36 @@ void HistoryContentsProvider::Stop() { |
have_results_ = false; |
} |
+void HistoryContentsProvider::DeleteMatch(const AutocompleteMatch& match) { |
+ DCHECK(done_); |
+ DCHECK(match.deletable); |
+ DCHECK(profile_); |
+ |
+ // Delete the match from the history DB. |
+ HistoryService* const history_service = |
+ profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
+ |
+ GURL selected_url(match.destination_url); |
+ if (!history_service || !selected_url.is_valid()) { |
brettw
2010/12/15 22:24:11
This code is copied and pasted from the HistoryURL
msw
2010/12/16 01:38:26
How about using base class HistoryProvider?
|
+ NOTREACHED() << "Can't delete requested URL"; |
+ return; |
+ } |
+ history_service->DeleteURL(selected_url); |
+ |
+ // 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) { |
+ found = true; |
+ matches_.erase(i); |
+ break; |
+ } |
+ } |
+ DCHECK(found) << "Asked to delete a URL that isn't in our set of matches"; |
+ |
+ listener_->OnProviderUpdate(true); |
+} |
+ |
HistoryContentsProvider::~HistoryContentsProvider() { |
} |
@@ -222,7 +252,7 @@ AutocompleteMatch HistoryContentsProvider::ResultToMatch( |
int score) { |
// TODO(sky): if matched title highlight matching words in title. |
// Also show star in popup. |
- AutocompleteMatch match(this, score, false, MatchInTitle(result) ? |
+ AutocompleteMatch match(this, score, true, MatchInTitle(result) ? |
AutocompleteMatch::HISTORY_TITLE : AutocompleteMatch::HISTORY_BODY); |
match.contents = StringForURLDisplay(result.url(), true, trim_http_); |
match.fill_into_edit = |