OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ |
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ | 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/task/cancelable_task_tracker.h" | 19 #include "base/task/cancelable_task_tracker.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "base/timer/timer.h" | 21 #include "base/timer/timer.h" |
22 #include "chrome/browser/common/cancelable_request.h" | |
23 #include "chrome/browser/history/history_service.h" | 22 #include "chrome/browser/history/history_service.h" |
24 #include "chrome/browser/history/history_types.h" | 23 #include "chrome/browser/history/history_types.h" |
25 #include "chrome/browser/history/page_usage_data.h" | 24 #include "chrome/browser/history/page_usage_data.h" |
26 #include "chrome/browser/history/top_sites.h" | 25 #include "chrome/browser/history/top_sites.h" |
27 #include "chrome/browser/history/top_sites_backend.h" | 26 #include "chrome/browser/history/top_sites_backend.h" |
28 #include "components/history/core/common/thumbnail_score.h" | 27 #include "components/history/core/common/thumbnail_score.h" |
29 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
30 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
31 #include "url/gurl.h" | 30 #include "url/gurl.h" |
32 | 31 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 ThumbnailScore* score) OVERRIDE; | 71 ThumbnailScore* score) OVERRIDE; |
73 virtual bool GetTemporaryPageThumbnailScore(const GURL& url, | 72 virtual bool GetTemporaryPageThumbnailScore(const GURL& url, |
74 ThumbnailScore* score) OVERRIDE; | 73 ThumbnailScore* score) OVERRIDE; |
75 virtual void SyncWithHistory() OVERRIDE; | 74 virtual void SyncWithHistory() OVERRIDE; |
76 virtual bool HasBlacklistedItems() const OVERRIDE; | 75 virtual bool HasBlacklistedItems() const OVERRIDE; |
77 virtual void AddBlacklistedURL(const GURL& url) OVERRIDE; | 76 virtual void AddBlacklistedURL(const GURL& url) OVERRIDE; |
78 virtual void RemoveBlacklistedURL(const GURL& url) OVERRIDE; | 77 virtual void RemoveBlacklistedURL(const GURL& url) OVERRIDE; |
79 virtual bool IsBlacklisted(const GURL& url) OVERRIDE; | 78 virtual bool IsBlacklisted(const GURL& url) OVERRIDE; |
80 virtual void ClearBlacklistedURLs() OVERRIDE; | 79 virtual void ClearBlacklistedURLs() OVERRIDE; |
81 virtual void Shutdown() OVERRIDE; | 80 virtual void Shutdown() OVERRIDE; |
82 virtual CancelableRequestProvider::Handle StartQueryForMostVisited() OVERRIDE; | 81 virtual base::CancelableTaskTracker::TaskId StartQueryForMostVisited() |
82 OVERRIDE; | |
83 virtual bool IsKnownURL(const GURL& url) OVERRIDE; | 83 virtual bool IsKnownURL(const GURL& url) OVERRIDE; |
84 virtual const std::string& GetCanonicalURLString( | 84 virtual const std::string& GetCanonicalURLString( |
85 const GURL& url) const OVERRIDE; | 85 const GURL& url) const OVERRIDE; |
86 virtual bool IsNonForcedFull() OVERRIDE; | 86 virtual bool IsNonForcedFull() OVERRIDE; |
87 virtual bool IsForcedFull() OVERRIDE; | 87 virtual bool IsForcedFull() OVERRIDE; |
88 virtual MostVisitedURLList GetPrepopulatePages() OVERRIDE; | 88 virtual MostVisitedURLList GetPrepopulatePages() OVERRIDE; |
89 virtual bool loaded() const OVERRIDE; | 89 virtual bool loaded() const OVERRIDE; |
90 virtual bool AddForcedURL(const GURL& url, const base::Time& time) OVERRIDE; | 90 virtual bool AddForcedURL(const GURL& url, const base::Time& time) OVERRIDE; |
91 | 91 |
92 protected: | 92 protected: |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // Copy of the top sites data that may be accessed on any thread (assuming | 226 // Copy of the top sites data that may be accessed on any thread (assuming |
227 // you hold |lock_|). The data in |thread_safe_cache_| has blacklisted and | 227 // you hold |lock_|). The data in |thread_safe_cache_| has blacklisted and |
228 // pinned urls applied (|cache_| does not). | 228 // pinned urls applied (|cache_| does not). |
229 scoped_ptr<TopSitesCache> thread_safe_cache_; | 229 scoped_ptr<TopSitesCache> thread_safe_cache_; |
230 | 230 |
231 Profile* profile_; | 231 Profile* profile_; |
232 | 232 |
233 // Lock used to access |thread_safe_cache_|. | 233 // Lock used to access |thread_safe_cache_|. |
234 mutable base::Lock lock_; | 234 mutable base::Lock lock_; |
235 | 235 |
236 // Need a separate consumer for each CancelableRequestProvider we interact | 236 // Need a separate task tracker for each CancelableRequestProvider we |
blundell
2014/07/03 08:29:12
comment is out of date
sdefresne
2014/07/22 14:29:06
Done.
| |
237 // with (HistoryService and TopSitesBackend). | 237 // interact with (HistoryService and TopSitesBackend). |
238 CancelableRequestConsumer history_consumer_; | 238 base::CancelableTaskTracker history_task_tracker_; |
239 base::CancelableTaskTracker cancelable_task_tracker_; | 239 base::CancelableTaskTracker backend_task_tracker_; |
240 | 240 |
241 // Timer that asks history for the top sites. This is used to make sure our | 241 // Timer that asks history for the top sites. This is used to make sure our |
242 // data stays in sync with history. | 242 // data stays in sync with history. |
243 base::OneShotTimer<TopSitesImpl> timer_; | 243 base::OneShotTimer<TopSitesImpl> timer_; |
244 | 244 |
245 // The time we started |timer_| at. Only valid if |timer_| is running. | 245 // The time we started |timer_| at. Only valid if |timer_| is running. |
246 base::TimeTicks timer_start_time_; | 246 base::TimeTicks timer_start_time_; |
247 | 247 |
248 content::NotificationRegistrar registrar_; | 248 content::NotificationRegistrar registrar_; |
249 | 249 |
(...skipping 16 matching lines...) Expand all Loading... | |
266 | 266 |
267 // Are we loaded? | 267 // Are we loaded? |
268 bool loaded_; | 268 bool loaded_; |
269 | 269 |
270 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); | 270 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); |
271 }; | 271 }; |
272 | 272 |
273 } // namespace history | 273 } // namespace history |
274 | 274 |
275 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ | 275 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ |
OLD | NEW |