diff options
Diffstat (limited to 'chrome/browser/history/history_backend.cc')
-rw-r--r-- | chrome/browser/history/history_backend.cc | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 3913d1d..07f18ed 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -32,6 +32,7 @@ #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/history_publisher.h" #include "chrome/browser/history/in_memory_history_backend.h" +#include "chrome/browser/history/page_collector.h" #include "chrome/browser/history/page_usage_data.h" #include "chrome/browser/history/select_favicon_frames.h" #include "chrome/browser/history/top_sites.h" @@ -550,6 +551,9 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) { last_ids.second); } + if (page_collector_) + page_collector_->AddPageURL(request.url, request.time); + ScheduleCommit(); } @@ -611,6 +615,9 @@ void HistoryBackend::InitImpl(const std::string& languages) { // Create the history publisher which needs to be passed on to the thumbnail // database for publishing history. + // TODO(shess): HistoryPublisher is being deprecated. I am still + // trying to track down who depends on it, meanwhile talk to me + // before removing interactions with it. http://crbug.com/294306 history_publisher_.reset(new HistoryPublisher()); if (!history_publisher_->Init()) { // The init may fail when there are no indexers wanting our history. @@ -618,6 +625,12 @@ void HistoryBackend::InitImpl(const std::string& languages) { history_publisher_.reset(); } + // Collects page data for history_publisher_. + if (history_publisher_.get()) { + page_collector_.reset(new PageCollector()); + page_collector_->Init(history_publisher_.get()); + } + // Thumbnail database. // TODO(shess): "thumbnail database" these days only stores // favicons. Thumbnails are stored in "top sites". Consider @@ -665,8 +678,7 @@ void HistoryBackend::InitImpl(const std::string& languages) { // *sigh*, this can all be cleaned up when that migration code is removed. // The main DB initialization should intuitively be first (not that it // actually matters) and the expirer should be set last. - expirer_.SetDatabases(db_.get(), archived_db_.get(), - thumbnail_db_.get()); + expirer_.SetDatabases(db_.get(), archived_db_.get(), thumbnail_db_.get()); // Open the long-running transaction. db_->BeginTransaction(); @@ -853,6 +865,12 @@ void HistoryBackend::AddPagesWithDetails(const URLRows& urls, } } + // TODO(shess): I'm not sure this case needs to exist anymore. + if (page_collector_) { + page_collector_->AddPageData(i->url(), i->last_visit(), + i->title(), string16()); + } + // Sync code manages the visits itself. if (visit_source != SOURCE_SYNCED) { // Make up a visit to correspond to the last visit to the page. @@ -890,11 +908,13 @@ bool HistoryBackend::IsExpiredVisitTime(const base::Time& time) { return time < expirer_.GetCurrentArchiveTime(); } -void HistoryBackend::SetPageTitle(const GURL& url, - const string16& title) { +void HistoryBackend::SetPageTitle(const GURL& url, const string16& title) { if (!db_) return; + if (page_collector_) + page_collector_->AddPageTitle(url, title); + // Search for recent redirects which should get the same title. We make a // dummy list containing the exact URL visited if there are no redirects so // the processing below can be the same. @@ -1665,6 +1685,12 @@ void HistoryBackend::DeleteFTSIndexDatabases() { num_databases_deleted); } +void HistoryBackend::SetPageContents(const GURL& url, + const string16& contents) { + if (page_collector_) + page_collector_->AddPageContents(url, contents); +} + void HistoryBackend::GetFavicons( const std::vector<GURL>& icon_urls, int icon_types, |