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

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

Issue 2507793002: [NTP] Propagate OfflineId from C++ for Downloads. (Closed)
Patch Set: bauerb@ comments. 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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "components/ntp_snippets/category.h" 15 #include "components/ntp_snippets/category.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace ntp_snippets { 18 namespace ntp_snippets {
19 19
20 // DownloadSuggestionExtra contains additional data which is only available for 20 // DownloadSuggestionExtra contains additional data which is only available for
21 // download suggestions. 21 // download suggestions.
22 struct DownloadSuggestionExtra { 22 struct DownloadSuggestionExtra {
23 DownloadSuggestionExtra(); // = default, in .cc
Bernhard Bauer 2016/11/16 17:44:35 I don't think you need to specify how the implemen
vitaliii 2016/11/16 18:15:22 Done.
24 ~DownloadSuggestionExtra(); // = default, in .cc
25
23 // The file path of the downloaded file once download completes. 26 // The file path of the downloaded file once download completes.
24 base::FilePath target_file_path; 27 base::FilePath target_file_path;
25 // The effective MIME type of downloaded content. 28 // The effective MIME type of downloaded content.
26 std::string mime_type; 29 std::string mime_type;
30 // Underlying offline page identifier.
31 int64_t offline_page_id;
Bernhard Bauer 2016/11/16 17:44:35 Maybe initialize this to 0 now?
vitaliii 2016/11/16 18:15:22 Done.
27 // Whether or not the download suggestion is a downloaded asset. 32 // Whether or not the download suggestion is a downloaded asset.
33 // When this is true, |offline_page_id| is ignored, otherwise
34 // |target_file_path| and |mime_type| are ignored.
28 bool is_download_asset = false; 35 bool is_download_asset = false;
29 }; 36 };
30 37
31 // Contains additional data which is only available for recent tab suggestions. 38 // Contains additional data which is only available for recent tab suggestions.
32 struct RecentTabSuggestionExtra { 39 struct RecentTabSuggestionExtra {
33 // Corresponding tab identifier. 40 // Corresponding tab identifier.
34 std::string tab_id; 41 std::string tab_id;
35 // Underlying offline page identifier. 42 // Underlying offline page identifier.
36 std::string offline_page_id; 43 int64_t offline_page_id;
37 }; 44 };
38 45
39 // A content suggestion for the new tab page, which can be an article or an 46 // A content suggestion for the new tab page, which can be an article or an
40 // offline page, for example. 47 // offline page, for example.
41 class ContentSuggestion { 48 class ContentSuggestion {
42 public: 49 public:
43 class ID { 50 class ID {
44 public: 51 public:
45 ID(Category category, const std::string& id_within_category) 52 ID(Category category, const std::string& id_within_category)
46 : category_(category), id_within_category_(id_within_category) {} 53 : category_(category), id_within_category_(id_within_category) {}
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_; 151 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra_;
145 152
146 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion); 153 DISALLOW_COPY_AND_ASSIGN(ContentSuggestion);
147 }; 154 };
148 155
149 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id); 156 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id);
150 157
151 } // namespace ntp_snippets 158 } // namespace ntp_snippets
152 159
153 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_ 160 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698