diff options
Diffstat (limited to 'chrome/browser/history/history_backend.cc')
| -rw-r--r-- | chrome/browser/history/history_backend.cc | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index fb8e3d3..0bf6045 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -581,12 +581,9 @@ void HistoryBackend::InitImpl(const std::string& languages) { // Thumbnail database. thumbnail_db_.reset(new ThumbnailDatabase()); - if (history::TopSites::IsEnabled()) { - // TODO(sky): once we reenable top sites this needs to be fixed. - // if (!db_->needs_version_18_migration()) { + if (history::TopSites::IsEnabled() && !db_->GetNeedsThumbnailMigration()) { // No convertion needed - use new filename right away. - // thumbnail_name = GetFaviconsFileName(); - // } + thumbnail_name = GetFaviconsFileName(); } if (thumbnail_db_->Init(thumbnail_name, history_publisher_.get()) != sql::INIT_OK) { @@ -599,12 +596,9 @@ void HistoryBackend::InitImpl(const std::string& languages) { thumbnail_db_.reset(); } - if (history::TopSites::IsEnabled()) { - // TODO(sky): fix when reenabling top sites migration. - // if (db_->needs_version_18_migration()) { - // VLOG(1) << "Starting TopSites migration"; - // delegate_->StartTopSitesMigration(); - // } + if (history::TopSites::IsEnabled() && db_->GetNeedsThumbnailMigration()) { + VLOG(1) << "Starting TopSites migration"; + delegate_->StartTopSitesMigration(); } // Archived database. @@ -1041,6 +1035,14 @@ void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url, } db_->SetKeywordSearchTermsForURL(url_row.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(NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED, + details); ScheduleCommit(); } @@ -1341,6 +1343,16 @@ void HistoryBackend::QueryMostVisitedURLs( } MostVisitedURLList* result = &request->value; + QueryMostVisitedURLsImpl(result_count, days_back, result); + request->ForwardResult(QueryMostVisitedURLsRequest::TupleType( + request->handle(), *result)); +} + +void HistoryBackend::QueryMostVisitedURLsImpl(int result_count, + int days_back, + MostVisitedURLList* result) { + if (!db_.get()) + return; ScopedVector<PageUsageData> data; db_->QuerySegmentUsage(base::Time::Now() - @@ -1354,9 +1366,6 @@ void HistoryBackend::QueryMostVisitedURLs( MostVisitedURL url = MakeMostVisitedURL(*current_data, redirects); result->push_back(url); } - - request->ForwardResult(QueryMostVisitedURLsRequest::TupleType( - request->handle(), *result)); } void HistoryBackend::GetRedirectsFromSpecificVisit( @@ -1516,6 +1525,19 @@ void HistoryBackend::GetPageThumbnailDirectly( } } +void HistoryBackend::MigrateThumbnailsDatabase() { + // If there is no History DB, we can't record that the migration was done. + // It will be recorded on the next run. + if (db_.get()) { + // If there is no thumbnail DB, we can still record a successful migration. + if (thumbnail_db_.get()) { + thumbnail_db_->RenameAndDropThumbnails(GetThumbnailFileName(), + GetFaviconsFileName()); + } + db_->ThumbnailMigrationDone(); + } +} + bool HistoryBackend::GetThumbnailFromOlderRedirect( const GURL& page_url, std::vector<unsigned char>* data) { @@ -2149,17 +2171,4 @@ BookmarkService* HistoryBackend::GetBookmarkService() { return bookmark_service_; } -void HistoryBackend::MigrateThumbnailsDatabase() { - // If there is no History DB, we can't record that the migration was done. - // It will be recorded on the next run. - if (db_.get()) { - // If there is no thumbnail DB, we can still record a successful migration. - if (thumbnail_db_.get()) { - thumbnail_db_->RenameAndDropThumbnails(GetThumbnailFileName(), - GetFaviconsFileName()); - } - db_->MigrationToTopSitesDone(); - } -} - } // namespace history |
