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

Side by Side Diff: components/ntp_snippets/ntp_snippet.h

Issue 2276383002: Support server-provided category names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Move "ignored" comment. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 18 matching lines...) Expand all
29 const GURL& amp_url) 29 const GURL& amp_url)
30 : url(url), publisher_name(publisher_name), amp_url(amp_url) {} 30 : url(url), publisher_name(publisher_name), amp_url(amp_url) {}
31 GURL url; 31 GURL url;
32 std::string publisher_name; 32 std::string publisher_name;
33 GURL amp_url; 33 GURL amp_url;
34 }; 34 };
35 35
36 class NTPSnippet { 36 class NTPSnippet {
37 public: 37 public:
38 using PtrVector = std::vector<std::unique_ptr<NTPSnippet>>; 38 using PtrVector = std::vector<std::unique_ptr<NTPSnippet>>;
39 using CategoryMap = std::map<Category, PtrVector, Category::CompareByID>;
40 39
41 // Creates a new snippet with the given |id|. 40 // Creates a new snippet with the given |id|.
42 // Public for testing only - create snippets using the Create* methods below. 41 // Public for testing only - create snippets using the Create* methods below.
43 // TODO(treib): Make this private and add a CreateSnippetForTest? 42 // TODO(treib): Make this private and add a CreateSnippetForTest?
44 NTPSnippet(const std::string& id); 43 NTPSnippet(const std::string& id);
45 44
46 ~NTPSnippet(); 45 ~NTPSnippet();
47 46
48 // Creates an NTPSnippet from a dictionary, as returned by Chrome Reader. 47 // Creates an NTPSnippet from a dictionary, as returned by Chrome Reader.
49 // Returns a null pointer if the dictionary doesn't correspond to a valid 48 // Returns a null pointer if the dictionary doesn't correspond to a valid
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 size_t best_source_index_; 146 size_t best_source_index_;
148 147
149 std::vector<SnippetSource> sources_; 148 std::vector<SnippetSource> sources_;
150 149
151 DISALLOW_COPY_AND_ASSIGN(NTPSnippet); 150 DISALLOW_COPY_AND_ASSIGN(NTPSnippet);
152 }; 151 };
153 152
154 } // namespace ntp_snippets 153 } // namespace ntp_snippets
155 154
156 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 155 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_fetcher.h » ('j') | components/ntp_snippets/ntp_snippets_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698