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

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: Marc's 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
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('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/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // TODO(pke): Get more reasonable data from the OfflinePageModel here. 122 // TODO(pke): Get more reasonable data from the OfflinePageModel here.
123 suggestion.set_title(base::UTF8ToUTF16(item.url.spec())); 123 suggestion.set_title(base::UTF8ToUTF16(item.url.spec()));
124 suggestion.set_snippet_text(base::string16()); 124 suggestion.set_snippet_text(base::string16());
125 suggestion.set_publish_date(item.creation_time); 125 suggestion.set_publish_date(item.creation_time);
126 suggestion.set_publisher_name(base::UTF8ToUTF16(item.url.host())); 126 suggestion.set_publisher_name(base::UTF8ToUTF16(item.url.host()));
127 suggestions.emplace_back(std::move(suggestion)); 127 suggestions.emplace_back(std::move(suggestion));
128 if (suggestions.size() == kMaxSuggestionsCount) 128 if (suggestions.size() == kMaxSuggestionsCount)
129 break; 129 break;
130 } 130 }
131 131
132 observer_->OnNewSuggestions(provided_category_, std::move(suggestions)); 132 observer_->OnNewSuggestions(this, provided_category_, std::move(suggestions));
133 } 133 }
134 134
135 void OfflinePageSuggestionsProvider::NotifyStatusChanged( 135 void OfflinePageSuggestionsProvider::NotifyStatusChanged(
136 CategoryStatus new_status) { 136 CategoryStatus new_status) {
137 if (category_status_ == new_status) 137 if (category_status_ == new_status)
138 return; 138 return;
139 category_status_ = new_status; 139 category_status_ = new_status;
140 140
141 if (!observer_) 141 if (!observer_)
142 return; 142 return;
143 observer_->OnCategoryStatusChanged(provided_category_, new_status); 143 observer_->OnCategoryStatusChanged(this, provided_category_, new_status);
144 } 144 }
145 145
146 } // namespace ntp_snippets 146 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698