OLD | NEW |
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/bookmarks/bookmark_suggestions_provider.h" | 5 #include "components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Category category) { | 144 Category category) { |
145 DCHECK_EQ(category, provided_category_); | 145 DCHECK_EQ(category, provided_category_); |
146 return category_status_; | 146 return category_status_; |
147 } | 147 } |
148 | 148 |
149 CategoryInfo BookmarkSuggestionsProvider::GetCategoryInfo(Category category) { | 149 CategoryInfo BookmarkSuggestionsProvider::GetCategoryInfo(Category category) { |
150 return CategoryInfo( | 150 return CategoryInfo( |
151 l10n_util::GetStringUTF16(IDS_NTP_BOOKMARK_SUGGESTIONS_SECTION_HEADER), | 151 l10n_util::GetStringUTF16(IDS_NTP_BOOKMARK_SUGGESTIONS_SECTION_HEADER), |
152 ContentSuggestionsCardLayout::MINIMAL_CARD, | 152 ContentSuggestionsCardLayout::MINIMAL_CARD, |
153 /* has_more_button */ true, | 153 /* has_more_button */ true, |
154 /* show_if_empty */ false); | 154 /* show_if_empty */ true); |
| 155 // TODO(treib): Setting show_if_empty to true is a temporary hack, see |
| 156 // crbug.com/640568. |
155 } | 157 } |
156 | 158 |
157 void BookmarkSuggestionsProvider::DismissSuggestion( | 159 void BookmarkSuggestionsProvider::DismissSuggestion( |
158 const std::string& suggestion_id) { | 160 const std::string& suggestion_id) { |
159 DCHECK(bookmark_model_->loaded()); | 161 DCHECK(bookmark_model_->loaded()); |
160 GURL url(GetWithinCategoryIDFromUniqueID(suggestion_id)); | 162 GURL url(GetWithinCategoryIDFromUniqueID(suggestion_id)); |
161 MarkBookmarksDismissed(bookmark_model_, url); | 163 MarkBookmarksDismissed(bookmark_model_, url); |
162 } | 164 } |
163 | 165 |
164 void BookmarkSuggestionsProvider::FetchSuggestionImage( | 166 void BookmarkSuggestionsProvider::FetchSuggestionImage( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 289 |
288 void BookmarkSuggestionsProvider::NotifyStatusChanged( | 290 void BookmarkSuggestionsProvider::NotifyStatusChanged( |
289 CategoryStatus new_status) { | 291 CategoryStatus new_status) { |
290 if (category_status_ == new_status) | 292 if (category_status_ == new_status) |
291 return; | 293 return; |
292 category_status_ = new_status; | 294 category_status_ = new_status; |
293 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 295 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
294 } | 296 } |
295 | 297 |
296 } // namespace ntp_snippets | 298 } // namespace ntp_snippets |
OLD | NEW |