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

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

Issue 2232783002: Support action button to fetch more content suggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippetsbridge
Patch Set: Indent comments 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/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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus( 63 CategoryStatus OfflinePageSuggestionsProvider::GetCategoryStatus(
64 Category category) { 64 Category category) {
65 DCHECK_EQ(category, provided_category_); 65 DCHECK_EQ(category, provided_category_);
66 return category_status_; 66 return category_status_;
67 } 67 }
68 68
69 CategoryInfo OfflinePageSuggestionsProvider::GetCategoryInfo( 69 CategoryInfo OfflinePageSuggestionsProvider::GetCategoryInfo(
70 Category category) { 70 Category category) {
71 // TODO(pke): Use the proper string once it's agreed on. 71 // TODO(pke): Use the proper string once it's agreed on.
72 return CategoryInfo(base::ASCIIToUTF16("Offline pages"), 72 return CategoryInfo(base::ASCIIToUTF16("Offline pages"),
73 ContentSuggestionsCardLayout::MINIMAL_CARD); 73 ContentSuggestionsCardLayout::MINIMAL_CARD,
74 /* has_more_button */ false);
74 } 75 }
75 76
76 void OfflinePageSuggestionsProvider::DismissSuggestion( 77 void OfflinePageSuggestionsProvider::DismissSuggestion(
77 const std::string& suggestion_id) { 78 const std::string& suggestion_id) {
78 std::string offline_page_id = GetWithinCategoryIDFromUniqueID(suggestion_id); 79 std::string offline_page_id = GetWithinCategoryIDFromUniqueID(suggestion_id);
79 dismissed_ids_.insert(offline_page_id); 80 dismissed_ids_.insert(offline_page_id);
80 StoreDismissedIDsToPrefs(); 81 StoreDismissedIDsToPrefs();
81 } 82 }
82 83
83 void OfflinePageSuggestionsProvider::FetchSuggestionImage( 84 void OfflinePageSuggestionsProvider::FetchSuggestionImage(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 void OfflinePageSuggestionsProvider::StoreDismissedIDsToPrefs() { 205 void OfflinePageSuggestionsProvider::StoreDismissedIDsToPrefs() {
205 base::ListValue list; 206 base::ListValue list;
206 for (const std::string& dismissed_id : dismissed_ids_) 207 for (const std::string& dismissed_id : dismissed_ids_)
207 list.AppendString(dismissed_id); 208 list.AppendString(dismissed_id);
208 pref_service_->Set(prefs::kDismissedOfflinePageSuggestions, list); 209 pref_service_->Set(prefs::kDismissedOfflinePageSuggestions, list);
209 } 210 }
210 211
211 } // namespace ntp_snippets 212 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698