diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 16:23:17 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-04 16:23:17 +0000 |
commit | e14e05c948c2ff602fcc6a1137c5c61d112cb38f (patch) | |
tree | 80e11edbf6becb56143a2696005bc6d6bc9cde49 /chrome/browser/history/history.cc | |
parent | 4a842345af02ac3ae84015683383539a84f66d8c (diff) | |
download | chromium_src-e14e05c948c2ff602fcc6a1137c5c61d112cb38f.zip chromium_src-e14e05c948c2ff602fcc6a1137c5c61d112cb38f.tar.gz chromium_src-e14e05c948c2ff602fcc6a1137c5c61d112cb38f.tar.bz2 |
Makes the in memory db update keyword search terms.
BUG=61518
TEST=none
Review URL: http://codereview.chromium.org/4449002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/history.cc')
-rw-r--r-- | chrome/browser/history/history.cc | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 278df31..3a5ae85 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -145,6 +145,8 @@ HistoryService::HistoryService(Profile* profile) needs_top_sites_migration_(false) { registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, Source<Profile>(profile_)); + registrar_.Add(this, NotificationType::TEMPLATE_URL_REMOVED, + Source<Profile>(profile_)); } HistoryService::~HistoryService() { @@ -611,30 +613,37 @@ HistoryService::Handle HistoryService::QueryMostVisitedURLs( void HistoryService::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::HISTORY_URLS_DELETED) { - NOTREACHED(); - return; - } + switch (type.value) { + case NotificationType::HISTORY_URLS_DELETED: { + // Update the visited link system for deleted URLs. We will update the + // visited link system for added URLs as soon as we get the add + // notification (we don't have to wait for the backend, which allows us to + // be faster to update the state). + // + // For deleted URLs, we don't typically know what will be deleted since + // delete notifications are by time. We would also like to be more + // respectful of privacy and never tell the user something is gone when it + // isn't. Therefore, we update the delete URLs after the fact. + if (!profile_) + return; // No profile, probably unit testing. + Details<history::URLsDeletedDetails> deleted_details(details); + VisitedLinkMaster* visited_links = profile_->GetVisitedLinkMaster(); + if (!visited_links) + return; // Nobody to update. + if (deleted_details->all_history) + visited_links->DeleteAllURLs(); + else // Delete individual ones. + visited_links->DeleteURLs(deleted_details->urls); + break; + } - // Update the visited link system for deleted URLs. We will update the - // visited link system for added URLs as soon as we get the add - // notification (we don't have to wait for the backend, which allows us to - // be faster to update the state). - // - // For deleted URLs, we don't typically know what will be deleted since - // delete notifications are by time. We would also like to be more - // respectful of privacy and never tell the user something is gone when it - // isn't. Therefore, we update the delete URLs after the fact. - if (!profile_) - return; // No profile, probably unit testing. - Details<history::URLsDeletedDetails> deleted_details(details); - VisitedLinkMaster* visited_links = profile_->GetVisitedLinkMaster(); - if (!visited_links) - return; // Nobody to update. - if (deleted_details->all_history) - visited_links->DeleteAllURLs(); - else // Delete individual ones. - visited_links->DeleteURLs(deleted_details->urls); + case NotificationType::TEMPLATE_URL_REMOVED: + DeleteAllSearchTermsForKeyword(*(Details<TemplateURLID>(details).ptr())); + break; + + default: + NOTREACHED(); + } } bool HistoryService::Init(const FilePath& history_dir, |