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

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

Issue 2421463002: FetchMore functionality backend (Closed)
Patch Set: NTBR. Rebasing a lot. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_CONTENT_SUGGESTION_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "components/ntp_snippets/category.h" 13 #include "components/ntp_snippets/category.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace ntp_snippets { 16 namespace ntp_snippets {
17 17
18 class NTPSnippet;
19
18 // A content suggestion for the new tab page, which can be an article or an 20 // A content suggestion for the new tab page, which can be an article or an
19 // offline page, for example. 21 // offline page, for example.
20 class ContentSuggestion { 22 class ContentSuggestion {
21 public: 23 public:
22 class ID { 24 class ID {
23 public: 25 public:
24 ID(Category category, const std::string& id_within_category) 26 ID(Category category, const std::string& id_within_category)
25 : category_(category), id_within_category_(id_within_category) {} 27 : category_(category), id_within_category_(id_within_category) {}
26 28
27 Category category() const { return category_; } 29 Category category() const { return category_; }
(...skipping 14 matching lines...) Expand all
42 44
43 // Creates a new ContentSuggestion. The caller must ensure that the |id| 45 // Creates a new ContentSuggestion. The caller must ensure that the |id|
44 // passed in here is unique application-wide. 46 // passed in here is unique application-wide.
45 ContentSuggestion(const ID& id, const GURL& url); 47 ContentSuggestion(const ID& id, const GURL& url);
46 ContentSuggestion(Category category, 48 ContentSuggestion(Category category,
47 const std::string& id_within_category, 49 const std::string& id_within_category,
48 const GURL& url); 50 const GURL& url);
49 ContentSuggestion(ContentSuggestion&&); 51 ContentSuggestion(ContentSuggestion&&);
50 ContentSuggestion& operator=(ContentSuggestion&&); 52 ContentSuggestion& operator=(ContentSuggestion&&);
51 53
54 static ContentSuggestion FromSnippet(Category category,
vitaliii 2016/11/01 23:29:57 Can this be a constructor instead?
fhorschig 2016/11/02 05:05:27 Yes. This deprecated code was dropped in CL 244616
55 const NTPSnippet* snippet);
56
52 ~ContentSuggestion(); 57 ~ContentSuggestion();
53 58
54 // An ID for identifying the suggestion. The ID is unique application-wide. 59 // An ID for identifying the suggestion. The ID is unique application-wide.
55 const ID& id() const { return id_; } 60 const ID& id() const { return id_; }
56 61
57 // The normal content URL where the content referenced by the suggestion can 62 // The normal content URL where the content referenced by the suggestion can
58 // be accessed. 63 // be accessed.
59 const GURL& url() const { return url_; } 64 const GURL& url() const { return url_; }
60 65
61 // If available, this contains an URL to an AMP version of the same content. 66 // If available, this contains an URL to an AMP version of the same content.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 float score_; 109 float score_;
105 110
106 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); 111 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion);
107 }; 112 };
108 113
109 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); 114 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id);
110 115
111 } // namespace ntp_snippets 116 } // namespace ntp_snippets
112 117
113 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ 118 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698