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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 time < end_of_list_last_visit_date_) { | 224 time < end_of_list_last_visit_date_) { |
225 // The last visit date has not changed or the change is irrelevant. | 225 // The last visit date has not changed or the change is irrelevant. |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 // Otherwise, we should update the suggestions. | 229 // Otherwise, we should update the suggestions. |
230 FetchBookmarks(); | 230 FetchBookmarks(); |
231 } | 231 } |
232 | 232 |
233 void BookmarkSuggestionsProvider::BookmarkNodeRemoved( | 233 void BookmarkSuggestionsProvider::BookmarkNodeRemoved( |
234 bookmarks::BookmarkModel* model, | 234 bookmarks::BookmarkModel* model, |
235 const bookmarks::BookmarkNode* parent, | 235 const bookmarks::BookmarkNode* parent, |
236 int old_index, | 236 int old_index, |
237 const bookmarks::BookmarkNode* node, | 237 const bookmarks::BookmarkNode* node, |
238 const std::set<GURL>& no_longer_bookmarked) { | 238 const std::set<GURL>& no_longer_bookmarked) { |
239 base::Time time; | 239 base::Time time; |
240 if (GetLastVisitDateForNTPBookmark( | 240 if (GetLastVisitDateForNTPBookmark( |
241 *node, consider_bookmark_visits_from_desktop_, &time) && | 241 *node, consider_bookmark_visits_from_desktop_, &time) && |
242 time < end_of_list_last_visit_date_) { | 242 time < end_of_list_last_visit_date_) { |
243 // We know the node is too old to influence the list. | 243 // We know the node is too old to influence the list. |
244 return; | 244 return; |
245 } | 245 } |
246 | 246 |
247 // Some node from our list got deleted, we should update the suggestions. | 247 // Some node from our list got deleted, we should update the suggestions. |
248 FetchBookmarks(); | 248 FetchBookmarks(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void BookmarkSuggestionsProvider::NotifyStatusChanged( | 319 void BookmarkSuggestionsProvider::NotifyStatusChanged( |
320 CategoryStatus new_status) { | 320 CategoryStatus new_status) { |
321 if (category_status_ == new_status) { | 321 if (category_status_ == new_status) { |
322 return; | 322 return; |
323 } | 323 } |
324 category_status_ = new_status; | 324 category_status_ = new_status; |
325 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 325 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
326 } | 326 } |
327 | 327 |
328 } // namespace ntp_snippets | 328 } // namespace ntp_snippets |
OLD | NEW |