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

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

Issue 2194203002: Make ContentSuggestionsService recognize new/removed categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renaming
Patch Set: Put the status-change notification back in RegisterProvider() 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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 9
10 using offline_pages::MultipleOfflinePageItemResult; 10 using offline_pages::MultipleOfflinePageItemResult;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // TODO(pke): Get more reasonable data from the OfflinePageModel here. 121 // TODO(pke): Get more reasonable data from the OfflinePageModel here.
122 suggestion.set_title(item.url.spec()); 122 suggestion.set_title(item.url.spec());
123 suggestion.set_snippet_text(std::string()); 123 suggestion.set_snippet_text(std::string());
124 suggestion.set_publish_date(item.creation_time); 124 suggestion.set_publish_date(item.creation_time);
125 suggestion.set_publisher_name(item.url.host()); 125 suggestion.set_publisher_name(item.url.host());
126 suggestions.emplace_back(std::move(suggestion)); 126 suggestions.emplace_back(std::move(suggestion));
127 if (suggestions.size() == kMaxSuggestionsCount) 127 if (suggestions.size() == kMaxSuggestionsCount)
128 break; 128 break;
129 } 129 }
130 130
131 observer_->OnNewSuggestions(provided_category_, std::move(suggestions)); 131 observer_->OnNewSuggestions(this, provided_category_, std::move(suggestions));
132 } 132 }
133 133
134 void OfflinePageSuggestionsProvider::NotifyStatusChanged( 134 void OfflinePageSuggestionsProvider::NotifyStatusChanged(
135 CategoryStatus new_status) { 135 CategoryStatus new_status) {
136 if (category_status_ == new_status) 136 if (category_status_ == new_status)
137 return; 137 return;
138 category_status_ = new_status; 138 category_status_ = new_status;
139 139
140 if (!observer_) 140 if (!observer_)
141 return; 141 return;
142 observer_->OnCategoryStatusChanged(provided_category_, new_status); 142 observer_->OnCategoryStatusChanged(this, provided_category_, new_status);
143 } 143 }
144 144
145 } // namespace ntp_snippets 145 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698