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

Side by Side Diff: components/ntp_snippets/ios/reading_list_suggestions_provider.cc

Issue 2755113002: Create ReadingListSuggestionsProvider (Closed)
Patch Set: Created 3 years, 9 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
(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/ios/reading_list_suggestions_provider.h"
6
7 #include <vector>
8
9 #include "base/bind.h"
10 #include "base/threading/thread_task_runner_handle.h"
11 #include "components/ntp_snippets/category.h"
12 #include "components/reading_list/ios/reading_list_entry.h"
13 #include "components/reading_list/ios/reading_list_model.h"
14 #include "components/strings/grit/components_strings.h"
15 #include "ui/base/l10n/l10n_util.h"
16
17 namespace ntp_snippets {
18
19 ReadingListSuggestionsProvider::ReadingListSuggestionsProvider(
20 ContentSuggestionsProvider::Observer* observer,
21 ReadingListModel* reading_list_model)
22 : ContentSuggestionsProvider(observer),
23 category_status_(CategoryStatus::AVAILABLE_LOADING),
24 provided_category_(
25 Category::FromKnownCategory(KnownCategories::READING_LIST)),
26 reading_list_model_(reading_list_model) {
27 observer->OnCategoryStatusChanged(this, provided_category_, category_status_);
28 if (reading_list_model_->loaded()) {
29 FetchReadingListInternal();
30 }
Marc Treib 2017/03/17 14:44:01 Do we need to register as a ReadingListObserver or
gambard 2017/03/20 08:32:39 Done.
31 }
32
33 CategoryStatus ReadingListSuggestionsProvider::GetCategoryStatus(
34 Category category) {
35 DCHECK_EQ(category, provided_category_);
36 return category_status_;
37 };
38
39 CategoryInfo ReadingListSuggestionsProvider::GetCategoryInfo(
40 Category category) {
41 DCHECK_EQ(category, provided_category_);
42
43 return CategoryInfo(l10n_util::GetStringUTF16(
44 IDS_NTP_READING_LIST_SUGGESTIONS_SECTION_HEADER),
45 ContentSuggestionsCardLayout::FULL_CARD,
46 /*has_fetch_action=*/false,
47 /*has_view_all_action=*/true,
48 /*show_if_empty=*/false,
49 l10n_util::GetStringUTF16(
50 IDS_NTP_READING_LIST_SUGGESTIONS_SECTION_EMPTY));
51 };
52
53 void ReadingListSuggestionsProvider::DismissSuggestion(
54 const ContentSuggestion::ID& suggestion_id){};
Marc Treib 2017/03/17 14:44:01 This should probably get implemented? (doesn't hav
gambard 2017/03/20 08:32:39 Done.
55 void ReadingListSuggestionsProvider::FetchSuggestionImage(
56 const ContentSuggestion::ID& suggestion_id,
57 const ImageFetchedCallback& callback){};
Marc Treib 2017/03/17 14:44:01 Also here
gambard 2017/03/20 08:32:40 Done.
58
59 void ReadingListSuggestionsProvider::Fetch(
60 const Category& category,
61 const std::set<std::string>& known_suggestion_ids,
62 const FetchDoneCallback& callback) {
63 LOG(DFATAL) << "ReadingListSuggestionsProvider has no |Fetch| functionality!";
64 base::ThreadTaskRunnerHandle::Get()->PostTask(
65 FROM_HERE,
66 base::Bind(
67 callback,
68 Status(
69 StatusCode::PERMANENT_ERROR,
70 "ReadingListSuggestionsProvider has no |Fetch| functionality!"),
71 base::Passed(std::vector<ContentSuggestion>())));
72 };
73
74 void ReadingListSuggestionsProvider::ClearHistory(
75 base::Time begin,
76 base::Time end,
77 const base::Callback<bool(const GURL& url)>& filter){};
Marc Treib 2017/03/17 14:44:01 Also here
gambard 2017/03/20 08:32:39 Done.
78
79 void ReadingListSuggestionsProvider::ClearCachedSuggestions(Category category) {
80 DCHECK_EQ(category, provided_category_);
81 // Ignored.
82 };
83
84 void ReadingListSuggestionsProvider::GetDismissedSuggestionsForDebugging(
85 Category category,
86 const DismissedSuggestionsCallback& callback){};
87 void ReadingListSuggestionsProvider::ClearDismissedSuggestionsForDebugging(
88 Category category){};
Marc Treib 2017/03/17 14:44:01 And here :)
gambard 2017/03/20 08:32:39 Done.
89
90 void ReadingListSuggestionsProvider::ReadingListModelLoaded(
91 const ReadingListModel* model) {
92 FetchReadingListInternal();
Marc Treib 2017/03/17 14:44:00 nit: DCHECK_EQ(reading_list_model_, model); (thoug
gambard 2017/03/20 08:32:39 I don't know :) It looks like a standard iOS deleg
93 }
94
95 void ReadingListSuggestionsProvider::FetchReadingListInternal() {}
96
97 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698