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

Side by Side Diff: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc

Issue 2223963002: Revert of Add per-section clearing and dismissed suggestions to snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h ('k') | 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 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/offline_pages/offline_page_suggestions_provide r.h" 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 //////////////////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////////////////
44 // Private methods 44 // Private methods
45 45
46 std::vector<Category> OfflinePageSuggestionsProvider::GetProvidedCategories() { 46 std::vector<Category> OfflinePageSuggestionsProvider::GetProvidedCategories() {
47 return std::vector<Category>({provided_category_}); 47 return std::vector<Category>({provided_category_});
48 } 48 }
49 49
50 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus( 50 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus(
51 Category category) { 51 Category category) {
52 DCHECK_EQ(category, provided_category_);
53 return category_status_; 52 return category_status_;
54 } 53 }
55 54
56 void OfflinePageSuggestionsProvider::DismissSuggestion( 55 void OfflinePageSuggestionsProvider::DismissSuggestion(
57 const std::string& suggestion_id) { 56 const std::string& suggestion_id) {
58 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, 57 // TODO(pke): Implement some "dont show on NTP anymore" behaviour,
59 // then also implement ClearDismissedSuggestionsForDebugging. 58 // then also implement ClearDismissedSuggestionsForDebugging.
60 } 59 }
61 60
62 void OfflinePageSuggestionsProvider::FetchSuggestionImage( 61 void OfflinePageSuggestionsProvider::FetchSuggestionImage(
63 const std::string& suggestion_id, 62 const std::string& suggestion_id,
64 const ImageFetchedCallback& callback) { 63 const ImageFetchedCallback& callback) {
65 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available 64 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available
66 // there. 65 // there.
67 base::ThreadTaskRunnerHandle::Get()->PostTask( 66 base::ThreadTaskRunnerHandle::Get()->PostTask(
68 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image())); 67 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image()));
69 } 68 }
70 69
71 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging( 70 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging() {
72 Category category) {
73 DCHECK_EQ(category, provided_category_);
74 // Ignored. 71 // Ignored.
75 } 72 }
76 73
77 std::vector<ContentSuggestion> 74 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging() {
78 OfflinePageSuggestionsProvider::GetDismissedSuggestionsForDebugging(
79 Category category) {
80 DCHECK_EQ(category, provided_category_);
81 // TODO(pke): Implement when dismissed suggestions are supported.
82 return std::vector<ContentSuggestion>();
83 }
84
85 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging(
86 Category category) {
87 DCHECK_EQ(category, provided_category_);
88 // TODO(pke): Implement when dismissed suggestions are supported. 75 // TODO(pke): Implement when dismissed suggestions are supported.
89 } 76 }
90 77
91 void OfflinePageSuggestionsProvider::OfflinePageModelLoaded( 78 void OfflinePageSuggestionsProvider::OfflinePageModelLoaded(
92 OfflinePageModel* model) { 79 OfflinePageModel* model) {
93 DCHECK_EQ(offline_page_model_, model); 80 DCHECK_EQ(offline_page_model_, model);
94 } 81 }
95 82
96 void OfflinePageSuggestionsProvider::OfflinePageModelChanged( 83 void OfflinePageSuggestionsProvider::OfflinePageModelChanged(
97 OfflinePageModel* model) { 84 OfflinePageModel* model) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void OfflinePageSuggestionsProvider::NotifyStatusChanged( 130 void OfflinePageSuggestionsProvider::NotifyStatusChanged(
144 CategoryStatus new_status) { 131 CategoryStatus new_status) {
145 if (category_status_ == new_status) 132 if (category_status_ == new_status)
146 return; 133 return;
147 category_status_ = new_status; 134 category_status_ = new_status;
148 135
149 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 136 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
150 } 137 }
151 138
152 } // namespace ntp_snippets 139 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698