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

Side by Side Diff: components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc

Issue 2473483006: Adds a Fetch() method to the ContentSuggestionService which asks any provider to provide more conte… (Closed)
Patch Set: comments by Markus. Created 4 years, 1 month 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
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/physical_web_pages/physical_web_page_suggestio ns_provider.h" 5 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio ns_provider.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
12 #include "grit/components_strings.h" 14 #include "grit/components_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
15 17
16 namespace ntp_snippets { 18 namespace ntp_snippets {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 86 }
85 87
86 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage( 88 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage(
87 const ContentSuggestion::ID& suggestion_id, 89 const ContentSuggestion::ID& suggestion_id,
88 const ImageFetchedCallback& callback) { 90 const ImageFetchedCallback& callback) {
89 // TODO(vitaliii): Implement. 91 // TODO(vitaliii): Implement.
90 base::ThreadTaskRunnerHandle::Get()->PostTask( 92 base::ThreadTaskRunnerHandle::Get()->PostTask(
91 FROM_HERE, base::Bind(callback, gfx::Image())); 93 FROM_HERE, base::Bind(callback, gfx::Image()));
92 } 94 }
93 95
96 void PhysicalWebPageSuggestionsProvider::Fetch(
97 const Category& category,
98 const std::set<std::string>& known_suggestion_ids,
99 FetchingCallback callback) {
100 NOTREACHED();
101 base::ThreadTaskRunnerHandle::Get()->PostTask(
102 FROM_HERE,
103 base::Bind(callback, base::Passed(std::vector<ContentSuggestion>())));
104 }
105
94 void PhysicalWebPageSuggestionsProvider::ClearHistory( 106 void PhysicalWebPageSuggestionsProvider::ClearHistory(
95 base::Time begin, 107 base::Time begin,
96 base::Time end, 108 base::Time end,
97 const base::Callback<bool(const GURL& url)>& filter) { 109 const base::Callback<bool(const GURL& url)>& filter) {
98 ClearDismissedSuggestionsForDebugging(provided_category_); 110 ClearDismissedSuggestionsForDebugging(provided_category_);
99 } 111 }
100 112
101 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions( 113 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions(
102 Category category) { 114 Category category) {
103 // Ignored 115 // Ignored
(...skipping 16 matching lines...) Expand all
120 132
121 // Updates the |category_status_| and notifies the |observer_|, if necessary. 133 // Updates the |category_status_| and notifies the |observer_|, if necessary.
122 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged( 134 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged(
123 CategoryStatus new_status) { 135 CategoryStatus new_status) {
124 if (category_status_ == new_status) return; 136 if (category_status_ == new_status) return;
125 category_status_ = new_status; 137 category_status_ = new_status;
126 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 138 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
127 } 139 }
128 140
129 } // namespace ntp_snippets 141 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698