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

Unified Diff: components/ntp_snippets/remote/ntp_snippet.h

Issue 2526313002: [NTP Snippets] NTPSnippet cleanup: Make ctor take all IDs at once (Closed)
Patch Set: review Created 4 years, 1 month 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 | « no previous file | components/ntp_snippets/remote/ntp_snippet.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/remote/ntp_snippet.h
diff --git a/components/ntp_snippets/remote/ntp_snippet.h b/components/ntp_snippets/remote/ntp_snippet.h
index b82402c5c41da4c4cf878a7db68824f8206c4044..4525f309d37e242533fc64bdfd1d543df3c4d358 100644
--- a/components/ntp_snippets/remote/ntp_snippet.h
+++ b/components/ntp_snippets/remote/ntp_snippet.h
@@ -30,10 +30,6 @@ class NTPSnippet {
public:
using PtrVector = std::vector<std::unique_ptr<NTPSnippet>>;
- // Public only so that MakeUnique will work. Don't use directly, call one of
- // the CreateFrom* methods below instead.
- // TODO(treib): Make the constructor take the vector of IDs and remove AddIDs.
- NTPSnippet(const std::string& id, int remote_category_id);
~NTPSnippet();
// Creates an NTPSnippet from a dictionary, as returned by Chrome Reader.
@@ -121,7 +117,11 @@ class NTPSnippet {
static std::string TimeToJsonString(const base::Time& time);
private:
- void AddIDs(const std::vector<std::string>& ids);
+ NTPSnippet(const std::vector<std::string>& ids, int remote_category_id);
+
+ // base::MakeUnique doesn't work if the ctor is private.
+ static std::unique_ptr<NTPSnippet> MakeUnique(
+ const std::vector<std::string>& ids, int remote_category_id);
// The first ID in the vector is the primary id.
std::vector<std::string> ids_;
« no previous file with comments | « no previous file | components/ntp_snippets/remote/ntp_snippet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698