OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |