Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 1924773002: TopSites: filter out non-WebSafe URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@topsites_cleanup
Patch Set: comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 db_->GetVisibleVisitCountToHost(url, &result->count, 1349 db_->GetVisibleVisitCountToHost(url, &result->count,
1350 &result->first_visit); 1350 &result->first_visit);
1351 } 1351 }
1352 1352
1353 void HistoryBackend::QueryMostVisitedURLs(int result_count, 1353 void HistoryBackend::QueryMostVisitedURLs(int result_count,
1354 int days_back, 1354 int days_back,
1355 MostVisitedURLList* result) { 1355 MostVisitedURLList* result) {
1356 if (!db_) 1356 if (!db_)
1357 return; 1357 return;
1358 1358
1359 auto url_filter = backend_client_
1360 ? base::Bind(&HistoryBackendClient::IsWebSafe,
1361 base::Unretained(backend_client_.get()))
1362 : base::Callback<bool(const GURL&)>();
1359 std::vector<std::unique_ptr<PageUsageData>> data = db_->QuerySegmentUsage( 1363 std::vector<std::unique_ptr<PageUsageData>> data = db_->QuerySegmentUsage(
1360 base::Time::Now() - base::TimeDelta::FromDays(days_back), result_count); 1364 base::Time::Now() - base::TimeDelta::FromDays(days_back), result_count,
1365 url_filter);
1361 1366
1362 for (const std::unique_ptr<PageUsageData>& current_data : data) { 1367 for (const std::unique_ptr<PageUsageData>& current_data : data) {
1363 RedirectList redirects; 1368 RedirectList redirects;
1364 QueryRedirectsFrom(current_data->GetURL(), &redirects); 1369 QueryRedirectsFrom(current_data->GetURL(), &redirects);
1365 MostVisitedURL url = MakeMostVisitedURL(*current_data, redirects); 1370 MostVisitedURL url = MakeMostVisitedURL(*current_data, redirects);
1366 result->push_back(url); 1371 result->push_back(url);
1367 } 1372 }
1368 } 1373 }
1369 1374
1370 void HistoryBackend::GetRedirectsFromSpecificVisit(VisitID cur_visit, 1375 void HistoryBackend::GetRedirectsFromSpecificVisit(VisitID cur_visit,
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 // transaction is currently open. 2629 // transaction is currently open.
2625 db_->CommitTransaction(); 2630 db_->CommitTransaction();
2626 db_->Vacuum(); 2631 db_->Vacuum();
2627 db_->BeginTransaction(); 2632 db_->BeginTransaction();
2628 db_->GetStartDate(&first_recorded_time_); 2633 db_->GetStartDate(&first_recorded_time_);
2629 2634
2630 return true; 2635 return true;
2631 } 2636 }
2632 2637
2633 } // namespace history 2638 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/chrome_history_backend_client.cc ('k') | components/history/core/browser/history_backend_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698