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

Side by Side Diff: components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc

Issue 2223073002: Add per-section clearing and dismissed suggestions to snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non-Debug builds Created 4 years, 4 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
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/bookmarks/bookmark_suggestions_provider.h" 5 #include "components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 //////////////////////////////////////////////////////////////////////////////// 55 ////////////////////////////////////////////////////////////////////////////////
56 // Private methods 56 // Private methods
57 57
58 std::vector<Category> BookmarkSuggestionsProvider::GetProvidedCategories() { 58 std::vector<Category> BookmarkSuggestionsProvider::GetProvidedCategories() {
59 return std::vector<Category>({provided_category_}); 59 return std::vector<Category>({provided_category_});
60 } 60 }
61 61
62 CategoryStatus BookmarkSuggestionsProvider::GetCategoryStatus( 62 CategoryStatus BookmarkSuggestionsProvider::GetCategoryStatus(
63 Category category) { 63 Category category) {
64 DCHECK_EQ(category, provided_category_);
64 return category_status_; 65 return category_status_;
65 } 66 }
66 67
67 void BookmarkSuggestionsProvider::DismissSuggestion( 68 void BookmarkSuggestionsProvider::DismissSuggestion(
68 const std::string& suggestion_id) { 69 const std::string& suggestion_id) {
69 // TODO(jkrcal): Implement blacklisting bookmarks until they are next visited. 70 // TODO(jkrcal): Implement blacklisting bookmarks until they are next visited.
70 // Then also implement ClearDismissedSuggestionsForDebugging. 71 // Then also implement ClearDismissedSuggestionsForDebugging.
71 } 72 }
72 73
73 void BookmarkSuggestionsProvider::FetchSuggestionImage( 74 void BookmarkSuggestionsProvider::FetchSuggestionImage(
74 const std::string& suggestion_id, 75 const std::string& suggestion_id,
75 const ImageFetchedCallback& callback) { 76 const ImageFetchedCallback& callback) {
76 base::ThreadTaskRunnerHandle::Get()->PostTask( 77 base::ThreadTaskRunnerHandle::Get()->PostTask(
77 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image())); 78 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image()));
78 } 79 }
79 80
80 void BookmarkSuggestionsProvider::ClearCachedSuggestionsForDebugging() { 81 void BookmarkSuggestionsProvider::ClearCachedSuggestionsForDebugging(
82 Category category) {
83 DCHECK_EQ(category, provided_category_);
81 // Ignored. 84 // Ignored.
82 } 85 }
83 86
84 void BookmarkSuggestionsProvider::ClearDismissedSuggestionsForDebugging() { 87 std::vector<ContentSuggestion>
85 // TODO(jkrcal): Implement when discarded suggestions are supported. 88 BookmarkSuggestionsProvider::GetDismissedSuggestionsForDebugging(
89 Category category) {
90 DCHECK_EQ(category, provided_category_);
91 // TODO(pke): Implement when discarded suggestions are supported.
92 return std::vector<ContentSuggestion>();
93 }
94
95 void BookmarkSuggestionsProvider::ClearDismissedSuggestionsForDebugging(
96 Category category) {
97 DCHECK_EQ(category, provided_category_);
98 // TODO(pke): Implement when discarded suggestions are supported.
86 } 99 }
87 100
88 void BookmarkSuggestionsProvider::BookmarkModelLoaded( 101 void BookmarkSuggestionsProvider::BookmarkModelLoaded(
89 bookmarks::BookmarkModel* model, 102 bookmarks::BookmarkModel* model,
90 bool ids_reassigned) { 103 bool ids_reassigned) {
91 DCHECK_EQ(bookmark_model_, model); 104 DCHECK_EQ(bookmark_model_, model);
92 if (fetch_requested_) { 105 if (fetch_requested_) {
93 fetch_requested_ = false; 106 fetch_requested_ = false;
94 FetchBookmarksInternal(); 107 FetchBookmarksInternal();
95 } 108 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 167
155 void BookmarkSuggestionsProvider::NotifyStatusChanged( 168 void BookmarkSuggestionsProvider::NotifyStatusChanged(
156 CategoryStatus new_status) { 169 CategoryStatus new_status) {
157 if (category_status_ == new_status) 170 if (category_status_ == new_status)
158 return; 171 return;
159 category_status_ = new_status; 172 category_status_ = new_status;
160 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 173 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
161 } 174 }
162 175
163 } // namespace ntp_snippets 176 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698