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

Unified Diff: components/ntp_tiles/popular_sites.h

Issue 2192783002: Parse PopularSites JSON by callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@json
Patch Set: Created 4 years, 5 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
« no previous file with comments | « components/ntp_tiles/DEPS ('k') | components/ntp_tiles/popular_sites.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_tiles/popular_sites.h
diff --git a/components/ntp_tiles/popular_sites.h b/components/ntp_tiles/popular_sites.h
index 6be324843a0cd24639b5e47fac7ad2b4d484f39d..537c7d93f24a4da07a5f193370d9fb348a05d38b 100644
--- a/components/ntp_tiles/popular_sites.h
+++ b/components/ntp_tiles/popular_sites.h
@@ -38,6 +38,11 @@ class TemplateURLService;
namespace ntp_tiles {
+using ParseJSONCallback = base::Callback<void(
+ const std::string& unsafe_json,
+ const base::Callback<void(std::unique_ptr<base::Value>)>& success_callback,
+ const base::Callback<void(const std::string&)>& error_callback)>;
+
// Downloads and provides a list of suggested popular sites, for display on
// the NTP when there are not enough personalized suggestions. Caches the
// downloaded file on disk to avoid re-downloading on every startup.
@@ -66,7 +71,8 @@ class PopularSites : public net::URLFetcherDelegate {
const TemplateURLService* template_url_service,
variations::VariationsService* variations_service,
net::URLRequestContextGetter* download_context,
- const base::FilePath& directory);
+ const base::FilePath& directory,
+ ParseJSONCallback parse_json);
// Starts the process of retrieving popular sites. When they are available,
// invokes |callback| with the result, on the same thread as the caller. Never
@@ -115,6 +121,7 @@ class PopularSites : public net::URLFetcherDelegate {
variations::VariationsService* const variations_;
net::URLRequestContextGetter* const download_context_;
base::FilePath const local_path_;
+ ParseJSONCallback parse_json_;
// Set by StartFetch() and called after fetch completes.
FinishedCallback callback_;
« no previous file with comments | « components/ntp_tiles/DEPS ('k') | components/ntp_tiles/popular_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698