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

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

Issue 2513393002: [NTP] Cleanup: offline pages related tests. (Closed)
Patch Set: Created 4 years 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/offline_pages/recent_tab_suggestions_provider. h" 5 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider. h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void RecentTabSuggestionsProvider::ClearCachedSuggestions(Category category) { 136 void RecentTabSuggestionsProvider::ClearCachedSuggestions(Category category) {
137 // Ignored. 137 // Ignored.
138 } 138 }
139 139
140 void RecentTabSuggestionsProvider::GetDismissedSuggestionsForDebugging( 140 void RecentTabSuggestionsProvider::GetDismissedSuggestionsForDebugging(
141 Category category, 141 Category category,
142 const DismissedSuggestionsCallback& callback) { 142 const DismissedSuggestionsCallback& callback) {
143 DCHECK_EQ(provided_category_, category); 143 DCHECK_EQ(provided_category_, category);
144 144
145 // TODO(vitaliii): Query all pages instead by using an empty query. 145 // Even not related to recent tab offline pages are queried here, so that
Marc Treib 2016/11/21 12:27:53 Also here: IMO this is hard to parse, maybe "Offli
vitaliii 2016/11/21 14:56:46 Done. I did it similarly to your comment in Downlo
146 // they can be returned in case there are problems with dismissing.
147 OfflinePageModelQueryBuilder query_builder;
146 offline_page_model_->GetPagesMatchingQuery( 148 offline_page_model_->GetPagesMatchingQuery(
147 BuildRecentTabsQuery(offline_page_model_), 149 query_builder.Build(offline_page_model_->GetPolicyController()),
148 base::Bind(&RecentTabSuggestionsProvider:: 150 base::Bind(&RecentTabSuggestionsProvider::
149 GetPagesMatchingQueryCallbackForGetDismissedSuggestions, 151 GetPagesMatchingQueryCallbackForGetDismissedSuggestions,
150 weak_ptr_factory_.GetWeakPtr(), callback)); 152 weak_ptr_factory_.GetWeakPtr(), callback));
151 } 153 }
152 154
153 void RecentTabSuggestionsProvider::ClearDismissedSuggestionsForDebugging( 155 void RecentTabSuggestionsProvider::ClearDismissedSuggestionsForDebugging(
154 Category category) { 156 Category category) {
155 DCHECK_EQ(provided_category_, category); 157 DCHECK_EQ(provided_category_, category);
156 StoreDismissedIDsToPrefs(std::set<std::string>()); 158 StoreDismissedIDsToPrefs(std::set<std::string>());
157 FetchRecentTabs(); 159 FetchRecentTabs();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 298 }
297 299
298 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( 300 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs(
299 const std::set<std::string>& dismissed_ids) { 301 const std::set<std::string>& dismissed_ids) {
300 prefs::StoreDismissedIDsToPrefs(pref_service_, 302 prefs::StoreDismissedIDsToPrefs(pref_service_,
301 prefs::kDismissedRecentOfflineTabSuggestions, 303 prefs::kDismissedRecentOfflineTabSuggestions,
302 dismissed_ids); 304 dismissed_ids);
303 } 305 }
304 306
305 } // namespace ntp_snippets 307 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698