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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
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 return category_status_; | 52 return category_status_; |
53 } | 53 } |
54 | 54 |
| 55 CategoryInfo OfflinePageSuggestionsProvider::GetCategoryInfo( |
| 56 Category category) { |
| 57 // TODO(pke): Use the proper string once it's agreed on. |
| 58 return CategoryInfo(base::ASCIIToUTF16("Offline pages"), |
| 59 ContentSuggestionsCardLayout::MINIMAL_CARD); |
| 60 } |
| 61 |
55 void OfflinePageSuggestionsProvider::DismissSuggestion( | 62 void OfflinePageSuggestionsProvider::DismissSuggestion( |
56 const std::string& suggestion_id) { | 63 const std::string& suggestion_id) { |
57 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, | 64 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, |
58 // then also implement ClearDismissedSuggestionsForDebugging. | 65 // then also implement ClearDismissedSuggestionsForDebugging. |
59 } | 66 } |
60 | 67 |
61 void OfflinePageSuggestionsProvider::FetchSuggestionImage( | 68 void OfflinePageSuggestionsProvider::FetchSuggestionImage( |
62 const std::string& suggestion_id, | 69 const std::string& suggestion_id, |
63 const ImageFetchedCallback& callback) { | 70 const ImageFetchedCallback& callback) { |
64 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available | 71 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void OfflinePageSuggestionsProvider::NotifyStatusChanged( | 137 void OfflinePageSuggestionsProvider::NotifyStatusChanged( |
131 CategoryStatus new_status) { | 138 CategoryStatus new_status) { |
132 if (category_status_ == new_status) | 139 if (category_status_ == new_status) |
133 return; | 140 return; |
134 category_status_ = new_status; | 141 category_status_ = new_status; |
135 | 142 |
136 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 143 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
137 } | 144 } |
138 | 145 |
139 } // namespace ntp_snippets | 146 } // namespace ntp_snippets |
OLD | NEW |