OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/ntp_snippets/breaking_news/breaking_news_suggestions_provid
er.h" |
| 6 |
| 7 #include "components/ntp_snippets/breaking_news/content_suggestions_gcm_app_hand
ler.h" |
| 8 #include "components/ntp_snippets/category.h" |
| 9 #include "components/ntp_snippets/pref_names.h" |
| 10 #include "components/strings/grit/components_strings.h" |
| 11 |
| 12 namespace ntp_snippets { |
| 13 |
| 14 BreakingNewsSuggestionsProvider::BreakingNewsSuggestionsProvider( |
| 15 ContentSuggestionsProvider::Observer* observer, |
| 16 std::unique_ptr<ContentSuggestionsGCMAppHandler> gcm_app_handler) |
| 17 : ContentSuggestionsProvider(observer), |
| 18 gcm_app_handler_(std::move(gcm_app_handler)), |
| 19 provided_category_( |
| 20 Category::FromKnownCategory(KnownCategories::BREAKING_NEWS)) {} |
| 21 |
| 22 BreakingNewsSuggestionsProvider::~BreakingNewsSuggestionsProvider() { |
| 23 gcm_app_handler_->StopListening(); |
| 24 } |
| 25 |
| 26 //////////////////////////////////////////////////////////////////////////////// |
| 27 // Private methods |
| 28 |
| 29 CategoryStatus BreakingNewsSuggestionsProvider::GetCategoryStatus( |
| 30 Category category) { |
| 31 DCHECK_EQ(category, provided_category_); |
| 32 return category_status_; |
| 33 } |
| 34 |
| 35 CategoryInfo BreakingNewsSuggestionsProvider::GetCategoryInfo( |
| 36 Category category) { |
| 37 // TODO(mamir): needs to be corrected, just a placeholer |
| 38 return CategoryInfo(base::string16(), |
| 39 ContentSuggestionsCardLayout::MINIMAL_CARD, |
| 40 ContentSuggestionsAdditionalAction::VIEW_ALL, |
| 41 /*show_if_empty=*/false, base::string16()); |
| 42 } |
| 43 |
| 44 void BreakingNewsSuggestionsProvider::DismissSuggestion( |
| 45 const ContentSuggestion::ID& suggestion_id) {} |
| 46 |
| 47 void BreakingNewsSuggestionsProvider::FetchSuggestionImage( |
| 48 const ContentSuggestion::ID& suggestion_id, |
| 49 const ImageFetchedCallback& callback) {} |
| 50 |
| 51 void BreakingNewsSuggestionsProvider::Fetch( |
| 52 const Category& category, |
| 53 const std::set<std::string>& known_suggestion_ids, |
| 54 const FetchDoneCallback& callback) {} |
| 55 |
| 56 void BreakingNewsSuggestionsProvider::ClearHistory( |
| 57 base::Time begin, |
| 58 base::Time end, |
| 59 const base::Callback<bool(const GURL& url)>& filter) {} |
| 60 |
| 61 void BreakingNewsSuggestionsProvider::ClearCachedSuggestions( |
| 62 Category category) { |
| 63 DCHECK_EQ(category, provided_category_); |
| 64 // Ignored. |
| 65 } |
| 66 |
| 67 void BreakingNewsSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
| 68 Category category, |
| 69 const DismissedSuggestionsCallback& callback) {} |
| 70 |
| 71 void BreakingNewsSuggestionsProvider::ClearDismissedSuggestionsForDebugging( |
| 72 Category category) {} |
| 73 |
| 74 } // namespace ntp_snippets |
OLD | NEW |