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