| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h" | 5 #include "chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 items_.pop_front(); | 57 items_.pop_front(); |
| 58 return item; | 58 return item; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void SuggestionsSourceTopSites::FetchItems(Profile* profile) { | 61 void SuggestionsSourceTopSites::FetchItems(Profile* profile) { |
| 62 DCHECK(combiner_); | 62 DCHECK(combiner_); |
| 63 STLDeleteElements(&items_); | 63 STLDeleteElements(&items_); |
| 64 | 64 |
| 65 history_tracker_.TryCancelAll(); | 65 history_tracker_.TryCancelAll(); |
| 66 HistoryService* history = HistoryServiceFactory::GetForProfile( | 66 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 67 profile, Profile::EXPLICIT_ACCESS); | 67 profile, ServiceAccessType::EXPLICIT_ACCESS); |
| 68 // |history| may be null during unit tests. | 68 // |history| may be null during unit tests. |
| 69 if (history) { | 69 if (history) { |
| 70 history::VisitFilter time_filter; | 70 history::VisitFilter time_filter; |
| 71 time_filter.SetFilterTime(base::Time::Now()); | 71 time_filter.SetFilterTime(base::Time::Now()); |
| 72 time_filter.SetFilterWidth(GetFilterWidth()); | 72 time_filter.SetFilterWidth(GetFilterWidth()); |
| 73 time_filter.set_sorting_order(GetSortingOrder()); | 73 time_filter.set_sorting_order(GetSortingOrder()); |
| 74 | 74 |
| 75 history->QueryFilteredURLs( | 75 history->QueryFilteredURLs( |
| 76 0, | 76 0, |
| 77 time_filter, | 77 time_filter, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // static | 130 // static |
| 131 base::TimeDelta SuggestionsSourceTopSites::GetFilterWidth() { | 131 base::TimeDelta SuggestionsSourceTopSites::GetFilterWidth() { |
| 132 return base::TimeDelta::FromHours(1); | 132 return base::TimeDelta::FromHours(1); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 history::VisitFilter::SortingOrder | 136 history::VisitFilter::SortingOrder |
| 137 SuggestionsSourceTopSites::GetSortingOrder() { | 137 SuggestionsSourceTopSites::GetSortingOrder() { |
| 138 return history::VisitFilter::ORDER_BY_RECENCY; | 138 return history::VisitFilter::ORDER_BY_RECENCY; |
| 139 } | 139 } |
| OLD | NEW |