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

Side by Side Diff: components/ntp_snippets/remote/ntp_snippets_service.cc

Issue 2378323002: 📰 Show the Sign In promo as a separate card from the section (Closed)
Patch Set: ready for review Created 4 years, 2 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/remote/ntp_snippets_service.h" 5 #include "components/ntp_snippets/remote/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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 std::vector<Category> categories_to_erase; 775 std::vector<Category> categories_to_erase;
776 776
777 // Empty the ARTICLES category and remove all others, since they may or may 777 // Empty the ARTICLES category and remove all others, since they may or may
778 // not be personalized. 778 // not be personalized.
779 for (const auto& item : categories_) { 779 for (const auto& item : categories_) {
780 Category category = item.first; 780 Category category = item.first;
781 781
782 ClearCachedSuggestions(category); 782 ClearCachedSuggestions(category);
783 ClearDismissedSuggestionsForDebugging(category); 783 ClearDismissedSuggestionsForDebugging(category);
784 784
785 if (category == articles_category_) { 785 UpdateCategoryStatus(category, CategoryStatus::NOT_PROVIDED);
786 // Temporarily enter an "explicitly disabled" state, so that any open UIs 786
787 // will clear the suggestions too. 787 // Remove the category entirely; it may or may not reappear.
788 CategoryContent& content = categories_[category]; 788 if (category != articles_category_)
789 if (content.status != CategoryStatus::CATEGORY_EXPLICITLY_DISABLED) {
dgn 2016/09/30 11:35:32 That removed entirely the section, and made the NT
790 CategoryStatus old_category_status = content.status;
791 UpdateCategoryStatus(category,
792 CategoryStatus::CATEGORY_EXPLICITLY_DISABLED);
793 UpdateCategoryStatus(category, old_category_status);
794 }
795 } else {
796 // Remove other categories entirely; they may or may not reappear.
797 UpdateCategoryStatus(category, CategoryStatus::NOT_PROVIDED);
798 categories_to_erase.push_back(category); 789 categories_to_erase.push_back(category);
799 }
800 } 790 }
801 791
802 for (Category category : categories_to_erase) { 792 for (Category category : categories_to_erase) {
803 categories_.erase(category); 793 categories_.erase(category);
804 } 794 }
805 } 795 }
806 796
807 void NTPSnippetsService::OnSnippetImageFetchedFromDatabase( 797 void NTPSnippetsService::OnSnippetImageFetchedFromDatabase(
808 const ImageFetchedCallback& callback, 798 const ImageFetchedCallback& callback,
809 const ContentSuggestion::ID& suggestion_id, 799 const ContentSuggestion::ID& suggestion_id,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 } 1062 }
1073 1063
1074 NTPSnippetsService::CategoryContent::CategoryContent() = default; 1064 NTPSnippetsService::CategoryContent::CategoryContent() = default;
1075 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) = 1065 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) =
1076 default; 1066 default;
1077 NTPSnippetsService::CategoryContent::~CategoryContent() = default; 1067 NTPSnippetsService::CategoryContent::~CategoryContent() = default;
1078 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent:: 1068 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent::
1079 operator=(CategoryContent&&) = default; 1069 operator=(CategoryContent&&) = default;
1080 1070
1081 } // namespace ntp_snippets 1071 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698