| 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 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
| 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/history/history_service.h" | 22 #include "chrome/browser/history/history_service.h" |
| 23 #include "chrome/browser/history/history_types.h" | 23 #include "chrome/browser/history/history_types.h" |
| 24 #include "chrome/browser/history/page_usage_data.h" | 24 #include "chrome/browser/history/page_usage_data.h" |
| 25 #include "chrome/browser/history/top_sites_backend.h" | 25 #include "chrome/browser/history/top_sites_backend.h" |
| 26 #include "chrome/common/cancelable_task_tracker.h" | 26 #include "chrome/common/cancelable_task_tracker.h" |
| 27 #include "chrome/common/thumbnail_score.h" | 27 #include "chrome/common/thumbnail_score.h" |
| 28 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
| 29 #include "third_party/skia/include/core/SkColor.h" | 29 #include "third_party/skia/include/core/SkColor.h" |
| 30 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
| 31 | 31 |
| 32 class FilePath; | |
| 33 class Profile; | 32 class Profile; |
| 34 | 33 |
| 35 namespace base { | 34 namespace base { |
| 35 class FilePath; |
| 36 class RefCountedBytes; | 36 class RefCountedBytes; |
| 37 class RefCountedMemory; | 37 class RefCountedMemory; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace history { | 40 namespace history { |
| 41 | 41 |
| 42 class TopSitesCache; | 42 class TopSitesCache; |
| 43 class TopSitesTest; | 43 class TopSitesTest; |
| 44 | 44 |
| 45 // Stores the data for the top "most visited" sites. This includes a cache of | 45 // Stores the data for the top "most visited" sites. This includes a cache of |
| 46 // the most visited data from history, as well as the corresponding thumbnails | 46 // the most visited data from history, as well as the corresponding thumbnails |
| 47 // of those sites. | 47 // of those sites. |
| 48 // | 48 // |
| 49 // This class allows requests for most visited urls and thumbnails on any | 49 // This class allows requests for most visited urls and thumbnails on any |
| 50 // thread. All other methods must be invoked on the UI thread. All mutations | 50 // thread. All other methods must be invoked on the UI thread. All mutations |
| 51 // to internal state happen on the UI thread and are scheduled to update the | 51 // to internal state happen on the UI thread and are scheduled to update the |
| 52 // db using TopSitesBackend. | 52 // db using TopSitesBackend. |
| 53 class TopSites | 53 class TopSites |
| 54 : public base::RefCountedThreadSafe<TopSites>, | 54 : public base::RefCountedThreadSafe<TopSites>, |
| 55 public content::NotificationObserver { | 55 public content::NotificationObserver { |
| 56 public: | 56 public: |
| 57 explicit TopSites(Profile* profile); | 57 explicit TopSites(Profile* profile); |
| 58 | 58 |
| 59 // Initializes TopSites. | 59 // Initializes TopSites. |
| 60 void Init(const FilePath& db_name); | 60 void Init(const base::FilePath& db_name); |
| 61 | 61 |
| 62 // Sets the given thumbnail for the given URL. Returns true if the thumbnail | 62 // Sets the given thumbnail for the given URL. Returns true if the thumbnail |
| 63 // was updated. False means either the URL wasn't known to us, or we felt | 63 // was updated. False means either the URL wasn't known to us, or we felt |
| 64 // that our current thumbnail was superior to the given one. | 64 // that our current thumbnail was superior to the given one. |
| 65 bool SetPageThumbnail(const GURL& url, | 65 bool SetPageThumbnail(const GURL& url, |
| 66 const gfx::Image& thumbnail, | 66 const gfx::Image& thumbnail, |
| 67 const ThumbnailScore& score); | 67 const ThumbnailScore& score); |
| 68 | 68 |
| 69 typedef base::Callback<void(const MostVisitedURLList&)> | 69 typedef base::Callback<void(const MostVisitedURLList&)> |
| 70 GetMostVisitedURLsCallback; | 70 GetMostVisitedURLsCallback; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 #if defined(OS_ANDROID) | 364 #if defined(OS_ANDROID) |
| 365 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; | 365 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; |
| 366 #else | 366 #else |
| 367 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; | 367 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; |
| 368 #endif | 368 #endif |
| 369 | 369 |
| 370 } // namespace history | 370 } // namespace history |
| 371 | 371 |
| 372 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 372 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
| OLD | NEW |