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

Side by Side Diff: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc

Issue 2207493002: Add CategoryInfo for meta information of content suggestions Categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK against empty base::Optional<CategoryInfo> in SnippetsInternals Created 4 years, 4 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 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 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h" 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 std::vector<Category> OfflinePageSuggestionsProvider::GetProvidedCategories() { 46 std::vector<Category> OfflinePageSuggestionsProvider::GetProvidedCategories() {
47 return std::vector<Category>({provided_category_}); 47 return std::vector<Category>({provided_category_});
48 } 48 }
49 49
50 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus( 50 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus(
51 Category category) { 51 Category category) {
52 DCHECK_EQ(category, provided_category_); 52 DCHECK_EQ(category, provided_category_);
53 return category_status_; 53 return category_status_;
54 } 54 }
55 55
56 CategoryInfo OfflinePageSuggestionsProvider::GetCategoryInfo(
57 Category category) {
58 // TODO(pke): Use the proper string once it's agreed on.
59 return CategoryInfo(base::ASCIIToUTF16("Offline pages"),
60 ContentSuggestionsCardLayout::MINIMAL_CARD);
61 }
62
56 void OfflinePageSuggestionsProvider::DismissSuggestion( 63 void OfflinePageSuggestionsProvider::DismissSuggestion(
57 const std::string& suggestion_id) { 64 const std::string& suggestion_id) {
58 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, 65 // TODO(pke): Implement some "dont show on NTP anymore" behaviour,
59 // then also implement ClearDismissedSuggestionsForDebugging. 66 // then also implement ClearDismissedSuggestionsForDebugging.
60 } 67 }
61 68
62 void OfflinePageSuggestionsProvider::FetchSuggestionImage( 69 void OfflinePageSuggestionsProvider::FetchSuggestionImage(
63 const std::string& suggestion_id, 70 const std::string& suggestion_id,
64 const ImageFetchedCallback& callback) { 71 const ImageFetchedCallback& callback) {
65 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available 72 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void OfflinePageSuggestionsProvider::NotifyStatusChanged( 150 void OfflinePageSuggestionsProvider::NotifyStatusChanged(
144 CategoryStatus new_status) { 151 CategoryStatus new_status) {
145 if (category_status_ == new_status) 152 if (category_status_ == new_status)
146 return; 153 return;
147 category_status_ = new_status; 154 category_status_ = new_status;
148 155
149 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 156 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
150 } 157 }
151 158
152 } // namespace ntp_snippets 159 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h ('k') | components/ntp_snippets_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698