From 34cdd0557b61c9c98aa0510cadfcd814a8156b44 Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Mon, 13 Apr 2009 19:00:29 +0000 Subject: This CL adds some UI to remove most-visited thumbnails from the New Tab Page. The URL of removed thumbnails is added to a blacklist, which is a user pref. I had to modify the VisitSegmentDatabase::QuerySegmentUsage not to return a fixed number of items, as now we may filter the ones we get back. Note: this adds between 20 and 30ms to the first NTP load on my machine (a 3 to 5% increase). BUG=685 TEST=Open the NTP. Click the 'Edit thumbnails' link. Remove some thumbnails. Press Done. Edit again, use the "Restore removed" link. Review URL: http://codereview.chromium.org/67037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13611 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/history/visitsegment_database.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'chrome/browser/history/visitsegment_database.cc') diff --git a/chrome/browser/history/visitsegment_database.cc b/chrome/browser/history/visitsegment_database.cc index 6bab4972..8d9c362 100644 --- a/chrome/browser/history/visitsegment_database.cc +++ b/chrome/browser/history/visitsegment_database.cc @@ -232,6 +232,7 @@ bool VisitSegmentDatabase::IncreaseSegmentVisitCount(SegmentID segment_id, void VisitSegmentDatabase::QuerySegmentUsage( const Time& from_time, + int max_result_count, std::vector* results) { // This function gathers the highest-ranked segments in two queries. // The first gathers scores for all segments. @@ -241,9 +242,6 @@ void VisitSegmentDatabase::QuerySegmentUsage( // used to lock results into position. But the rest of our code currently // does as well. - // How many results we return, as promised in the header file. - const size_t kResultCount = 9; - // Gather all the segment scores: SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), "SELECT segment_id, time_slot, visit_count " @@ -296,8 +294,8 @@ void VisitSegmentDatabase::QuerySegmentUsage( // Limit to the top kResultCount results. sort(results->begin(), results->end(), PageUsageData::Predicate); - if (results->size() > kResultCount) - results->resize(kResultCount); + if (static_cast(results->size()) > max_result_count) + results->resize(max_result_count); // Now fetch the details about the entries we care about. SQLITE_UNIQUE_STATEMENT(statement2, GetStatementCache(), -- cgit v1.1