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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher.h

Issue 2325473003: Support server-provided category names. (Closed)
Patch Set: Created 4 years, 3 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_snippets/ntp_snippet.h ('k') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_fetcher.h
diff --git a/components/ntp_snippets/ntp_snippets_fetcher.h b/components/ntp_snippets/ntp_snippets_fetcher.h
index f0800cd5699b5550f56d5533cf03c9fbe18fc545..856fc9885ac5e6baf63cf825c10381361b0f48c4 100644
--- a/components/ntp_snippets/ntp_snippets_fetcher.h
+++ b/components/ntp_snippets/ntp_snippets_fetcher.h
@@ -47,7 +47,19 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
using ParseJSONCallback = base::Callback<
void(const std::string&, const SuccessCallback&, const ErrorCallback&)>;
- using OptionalSnippets = base::Optional<NTPSnippet::CategoryMap>;
+ struct FetchedCategory {
+ Category category;
+ base::string16 localized_title; // Ignored for non-server categories.
+ NTPSnippet::PtrVector snippets;
+
+ FetchedCategory(Category c);
+ FetchedCategory(FetchedCategory&&); // = default, in .cc
+ ~FetchedCategory(); // = default, in .cc
+ FetchedCategory& operator=(FetchedCategory&&); // = default, in .cc
+ };
+ using FetchedCategoriesVector = std::vector<FetchedCategory>;
+ using OptionalSnippets = base::Optional<FetchedCategoriesVector>;
+
// |snippets| contains parsed snippets if a fetch succeeded. If problems
// occur, |snippets| contains no value (no actual vector in base::Optional).
// Error details can be retrieved using last_status().
@@ -186,7 +198,7 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
void OnURLFetchComplete(const net::URLFetcher* source) override;
bool JsonToSnippets(const base::Value& parsed,
- NTPSnippet::CategoryMap* snippets);
+ FetchedCategoriesVector* categories);
void OnJsonParsed(std::unique_ptr<base::Value> parsed);
void OnJsonError(const std::string& error);
void FetchFinished(OptionalSnippets snippets,
« no previous file with comments | « components/ntp_snippets/ntp_snippet.h ('k') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698