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

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

Issue 2802973004: ReadingListProvider returns empty image (Closed)
Patch Set: Fix include Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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/reading_list/reading_list_suggestions_provider .h" 5 #include "components/ntp_snippets/reading_list/reading_list_suggestions_provider .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "components/ntp_snippets/category.h" 14 #include "components/ntp_snippets/category.h"
15 #include "components/ntp_snippets/reading_list/reading_list_distillation_state_u til.h" 15 #include "components/ntp_snippets/reading_list/reading_list_distillation_state_u til.h"
16 #include "components/reading_list/core/reading_list_entry.h" 16 #include "components/reading_list/core/reading_list_entry.h"
17 #include "components/reading_list/core/reading_list_model.h" 17 #include "components/reading_list/core/reading_list_model.h"
18 #include "components/strings/grit/components_strings.h" 18 #include "components/strings/grit/components_strings.h"
19 #include "components/url_formatter/url_formatter.h" 19 #include "components/url_formatter/url_formatter.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/gfx/image/image.h"
21 22
22 namespace ntp_snippets { 23 namespace ntp_snippets {
23 24
24 namespace { 25 namespace {
25 // Max number of entries to return. 26 // Max number of entries to return.
26 const int kMaxEntries = 3; 27 const int kMaxEntries = 3;
27 28
28 bool CompareEntries(const ReadingListEntry* lhs, const ReadingListEntry* rhs) { 29 bool CompareEntries(const ReadingListEntry* lhs, const ReadingListEntry* rhs) {
29 return lhs->UpdateTime() > rhs->UpdateTime(); 30 return lhs->UpdateTime() > rhs->UpdateTime();
30 } 31 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 69 }
69 70
70 void ReadingListSuggestionsProvider::DismissSuggestion( 71 void ReadingListSuggestionsProvider::DismissSuggestion(
71 const ContentSuggestion::ID& suggestion_id) { 72 const ContentSuggestion::ID& suggestion_id) {
72 // TODO(crbug.com/702241): Implement this method. 73 // TODO(crbug.com/702241): Implement this method.
73 } 74 }
74 75
75 void ReadingListSuggestionsProvider::FetchSuggestionImage( 76 void ReadingListSuggestionsProvider::FetchSuggestionImage(
76 const ContentSuggestion::ID& suggestion_id, 77 const ContentSuggestion::ID& suggestion_id,
77 const ImageFetchedCallback& callback) { 78 const ImageFetchedCallback& callback) {
78 // TODO(crbug.com/702241): Implement this method. 79 base::ThreadTaskRunnerHandle::Get()->PostTask(
80 FROM_HERE, base::Bind(callback, gfx::Image()));
79 } 81 }
80 82
81 void ReadingListSuggestionsProvider::Fetch( 83 void ReadingListSuggestionsProvider::Fetch(
82 const Category& category, 84 const Category& category,
83 const std::set<std::string>& known_suggestion_ids, 85 const std::set<std::string>& known_suggestion_ids,
84 const FetchDoneCallback& callback) { 86 const FetchDoneCallback& callback) {
85 LOG(DFATAL) << "ReadingListSuggestionsProvider has no |Fetch| functionality!"; 87 LOG(DFATAL) << "ReadingListSuggestionsProvider has no |Fetch| functionality!";
86 base::ThreadTaskRunnerHandle::Get()->PostTask( 88 base::ThreadTaskRunnerHandle::Get()->PostTask(
87 FROM_HERE, 89 FROM_HERE,
88 base::Bind(callback, 90 base::Bind(callback,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void ReadingListSuggestionsProvider::NotifyStatusChanged( 202 void ReadingListSuggestionsProvider::NotifyStatusChanged(
201 CategoryStatus new_status) { 203 CategoryStatus new_status) {
202 if (category_status_ == new_status) { 204 if (category_status_ == new_status) {
203 return; 205 return;
204 } 206 }
205 category_status_ = new_status; 207 category_status_ = new_status;
206 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 208 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
207 } 209 }
208 210
209 } // namespace ntp_snippets 211 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698