summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/history_backend.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 19:57:15 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-04 19:57:15 +0000
commit7492bc1fe1f20ffde4fcd29b09846d77f5e83566 (patch)
tree3df1729c9b3804a221d0492fa6c5b2e60608c488 /chrome/browser/history/history_backend.cc
parenta4c556ae70400553865761691f2c88c5c57cfe90 (diff)
downloadchromium_src-7492bc1fe1f20ffde4fcd29b09846d77f5e83566.zip
chromium_src-7492bc1fe1f20ffde4fcd29b09846d77f5e83566.tar.gz
chromium_src-7492bc1fe1f20ffde4fcd29b09846d77f5e83566.tar.bz2
Add the ability to delete a single search term out of local search history.
This will be needed by a couple of different omnibox features. BUG=151044 TEST=none R=brettw@chromium.org Review URL: https://codereview.chromium.org/46663011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history_backend.cc')
-rw-r--r--chrome/browser/history/history_backend.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index e899fb5..6dd4c7c 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1166,22 +1166,18 @@ void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url,
return;
// Get the ID for this URL.
- URLRow url_row;
- if (!db_->GetRowForURL(url, &url_row)) {
+ URLID url_id = db_->GetRowForURL(url, NULL);
+ if (!url_id) {
// There is a small possibility the url was deleted before the keyword
// was added. Ignore the request.
return;
}
- db_->SetKeywordSearchTermsForURL(url_row.id(), keyword_id, term);
+ db_->SetKeywordSearchTermsForURL(url_id, keyword_id, term);
- // details is deleted by BroadcastNotifications.
- KeywordSearchTermDetails* details = new KeywordSearchTermDetails;
- details->url = url;
- details->keyword_id = keyword_id;
- details->term = term;
BroadcastNotifications(
- chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, details);
+ chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED,
+ new KeywordSearchUpdatedDetails(url, keyword_id, term));
ScheduleCommit();
}
@@ -1210,6 +1206,21 @@ void HistoryBackend::GetMostRecentKeywordSearchTerms(
request->ForwardResult(request->handle(), &request->value);
}
+void HistoryBackend::DeleteKeywordSearchTermForURL(const GURL& url) {
+ if (!db_)
+ return;
+
+ URLID url_id = db_->GetRowForURL(url, NULL);
+ if (!url_id)
+ return;
+ db_->DeleteKeywordSearchTermForURL(url_id);
+
+ BroadcastNotifications(
+ chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_DELETED,
+ new KeywordSearchDeletedDetails(url));
+ ScheduleCommit();
+}
+
// Downloads -------------------------------------------------------------------
void HistoryBackend::GetNextDownloadId(uint32* next_id) {