Index: components/ntp_snippets/content_suggestion.cc |
diff --git a/components/ntp_snippets/content_suggestion.cc b/components/ntp_snippets/content_suggestion.cc |
index 0fa4f0cd9dde852a8d368ad0476df7c59c1faadf..0090688da13e2db33847e2a7ab72f532a65166d4 100644 |
--- a/components/ntp_snippets/content_suggestion.cc |
+++ b/components/ntp_snippets/content_suggestion.cc |
@@ -6,12 +6,30 @@ |
namespace ntp_snippets { |
+namespace { |
+ |
+// Helper function to combine ID and provider_type into a common ID to make it |
+// unique. |
+std::string CombineID(ContentSuggestionsProviderType provider_type, |
+ std::string original_id) { |
Marc Treib
2016/06/30 10:36:53
const std::string&
Philipp Keck
2016/06/30 17:14:07
Done.
|
+ return std::to_string(int(provider_type)) + ":" + original_id; |
Marc Treib
2016/06/30 10:36:53
Hm, base::StringPrintf would be the common way to
Philipp Keck
2016/06/30 17:14:07
Done.
|
+} |
+ |
+} |
tschumann
2016/06/30 10:55:18
shouldn't the closing namespace be commented like
Philipp Keck
2016/06/30 17:14:07
Done.
|
+ |
ContentSuggestion::ContentSuggestion( |
const std::string& id, |
- const ContentSuggestionsProviderType provider, |
+ const ContentSuggestionsProviderType provider_type, |
const ContentSuggestionCategory category, |
const GURL& url) |
- : id_(id), provider_(provider), category_(category), url_(url), score_(0) {} |
+ : id_(CombineID(provider_type, id)), |
+ category_(category), |
+ url_(url), |
+ score_(0) {} |
+ |
+ContentSuggestion::ContentSuggestion(ContentSuggestion&&) = default; |
+ |
+ContentSuggestion& ContentSuggestion::operator=(ContentSuggestion&&) = default; |
ContentSuggestion::~ContentSuggestion() {} |