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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 snippet->best_source().url); 808 snippet->best_source().url);
809 suggestion.set_amp_url(snippet->best_source().amp_url); 809 suggestion.set_amp_url(snippet->best_source().amp_url);
810 suggestion.set_title(base::UTF8ToUTF16(snippet->title())); 810 suggestion.set_title(base::UTF8ToUTF16(snippet->title()));
811 suggestion.set_snippet_text(base::UTF8ToUTF16(snippet->snippet())); 811 suggestion.set_snippet_text(base::UTF8ToUTF16(snippet->snippet()));
812 suggestion.set_publish_date(snippet->publish_date()); 812 suggestion.set_publish_date(snippet->publish_date());
813 suggestion.set_publisher_name( 813 suggestion.set_publisher_name(
814 base::UTF8ToUTF16(snippet->best_source().publisher_name)); 814 base::UTF8ToUTF16(snippet->best_source().publisher_name));
815 suggestion.set_score(snippet->score()); 815 suggestion.set_score(snippet->score());
816 result.emplace_back(std::move(suggestion)); 816 result.emplace_back(std::move(suggestion));
817 } 817 }
818 observer_->OnNewSuggestions(provided_category_, std::move(result)); 818 observer_->OnNewSuggestions(this, provided_category_, std::move(result));
819 } 819 }
820 820
821 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { 821 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) {
822 if (status == category_status_) 822 if (status == category_status_)
823 return; 823 return;
824 824
825 category_status_ = status; 825 category_status_ = status;
826 if (observer_) { 826 if (observer_) {
827 observer_->OnCategoryStatusChanged(provided_category_, category_status_); 827 observer_->OnCategoryStatusChanged(this, provided_category_,
828 category_status_);
828 } 829 }
829 } 830 }
830 831
831 } // namespace ntp_snippets 832 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698