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

Unified Diff: chrome/browser/history/most_visited_urls_provider.cc

Issue 27047003: Precache tracking database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@precache
Patch Set: General fixes, added tests, and moved PrecacheManager into component Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/most_visited_urls_provider.cc
diff --git a/chrome/browser/history/most_visited_urls_provider.cc b/chrome/browser/history/most_visited_urls_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c5a1eea3118d31d2e0b0332907caa4a637dec150
--- /dev/null
+++ b/chrome/browser/history/most_visited_urls_provider.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
bengr 2013/10/23 19:03:36 2012 -> 2013. Remove the '(c)' too.
sclittle 2013/10/24 22:11:38 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/history/most_visited_urls_provider.h"
+
+#include "base/bind.h"
+#include "chrome/browser/history/top_sites.h"
+
+namespace history {
+
+MostVisitedURLsProvider::MostVisitedURLsProvider(TopSites* top_sites)
bengr 2013/10/23 19:03:36 Can this be a const reference?
sclittle 2013/10/24 22:11:38 Unfortunately, no. We need a non-const TopSites in
+ : top_sites_(top_sites) {}
+MostVisitedURLsProvider::~MostVisitedURLsProvider() {}
+
+void MostVisitedURLsProvider::GetInterestingURLs(
+ const base::Callback<void(const std::list<GURL>&)>& callback) {
+ top_sites_->GetMostVisitedURLs(
+ base::Bind(&MostVisitedURLsProvider::OnMostVisitedURLsReceived,
+ AsWeakPtr(), callback));
+}
+
+void MostVisitedURLsProvider::OnMostVisitedURLsReceived(
+ base::Callback<void(const std::list<GURL>&)> callback,
bengr 2013/10/23 19:03:36 typedef this in the interface.
sclittle 2013/10/24 22:11:38 Done.
+ const MostVisitedURLList& most_visited_urls) {
+ std::list<GURL> urls;
+ for (MostVisitedURLList::const_iterator it = most_visited_urls.begin();
+ it != most_visited_urls.end(); ++it) {
+ urls.push_back(it->url);
+ }
+ callback.Run(urls);
+}
+
+} // namespace history

Powered by Google App Engine
This is Rietveld 408576698