| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Schedules the db to be shutdown. | 39 // Schedules the db to be shutdown. |
| 40 void Shutdown(); | 40 void Shutdown(); |
| 41 | 41 |
| 42 // Fetches MostVisitedThumbnails. | 42 // Fetches MostVisitedThumbnails. |
| 43 void GetMostVisitedThumbnails( | 43 void GetMostVisitedThumbnails( |
| 44 const GetMostVisitedThumbnailsCallback& callback, | 44 const GetMostVisitedThumbnailsCallback& callback, |
| 45 base::CancelableTaskTracker* tracker); | 45 base::CancelableTaskTracker* tracker); |
| 46 | 46 |
| 47 // Updates top sites database from the specified delta. | 47 // Updates top sites database from the specified delta. |
| 48 void UpdateTopSites(const TopSitesDelta& delta); | 48 // The bool param is used for knowing weather this function is called during |
| 49 // startup or not, thus histogram value could be recorded accordingly. |
| 50 // TODO(yiyaoliu): Remove this when crbug/223430 is fixed. |
| 51 void UpdateTopSites(const TopSitesDelta& delta, bool startup); |
| 49 | 52 |
| 50 // Sets the thumbnail. | 53 // Sets the thumbnail. |
| 51 void SetPageThumbnail(const MostVisitedURL& url, | 54 void SetPageThumbnail(const MostVisitedURL& url, |
| 52 int url_rank, | 55 int url_rank, |
| 53 const Images& thumbnail); | 56 const Images& thumbnail); |
| 54 | 57 |
| 55 // Deletes the database and recreates it. | 58 // Deletes the database and recreates it. |
| 56 void ResetDatabase(); | 59 void ResetDatabase(); |
| 57 | 60 |
| 58 // Schedules a request that does nothing on the DB thread, but then notifies | 61 // Schedules a request that does nothing on the DB thread, but then notifies |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 void InitDBOnDBThread(const base::FilePath& path); | 73 void InitDBOnDBThread(const base::FilePath& path); |
| 71 | 74 |
| 72 // Shuts down the db. | 75 // Shuts down the db. |
| 73 void ShutdownDBOnDBThread(); | 76 void ShutdownDBOnDBThread(); |
| 74 | 77 |
| 75 // Does the work of getting the most visted thumbnails. | 78 // Does the work of getting the most visted thumbnails. |
| 76 void GetMostVisitedThumbnailsOnDBThread( | 79 void GetMostVisitedThumbnailsOnDBThread( |
| 77 scoped_refptr<MostVisitedThumbnails> thumbnails); | 80 scoped_refptr<MostVisitedThumbnails> thumbnails); |
| 78 | 81 |
| 79 // Updates top sites. | 82 // Updates top sites. |
| 80 void UpdateTopSitesOnDBThread(const TopSitesDelta& delta); | 83 // The bool param is used for knowing weather this function is called during |
| 84 // startup or not, thus histogram value could be recorded accordingly. |
| 85 // TODO(yiyaoliu): Remove this when crbug/223430 is fixed. |
| 86 void UpdateTopSitesOnDBThread(const TopSitesDelta& delta, bool startup); |
| 81 | 87 |
| 82 // Sets the thumbnail. | 88 // Sets the thumbnail. |
| 83 void SetPageThumbnailOnDBThread(const MostVisitedURL& url, | 89 void SetPageThumbnailOnDBThread(const MostVisitedURL& url, |
| 84 int url_rank, | 90 int url_rank, |
| 85 const Images& thumbnail); | 91 const Images& thumbnail); |
| 86 | 92 |
| 87 // Resets the database. | 93 // Resets the database. |
| 88 void ResetDatabaseOnDBThread(const base::FilePath& file_path); | 94 void ResetDatabaseOnDBThread(const base::FilePath& file_path); |
| 89 | 95 |
| 90 base::FilePath db_path_; | 96 base::FilePath db_path_; |
| 91 | 97 |
| 92 scoped_ptr<TopSitesDatabase> db_; | 98 scoped_ptr<TopSitesDatabase> db_; |
| 93 scoped_refptr<base::SingleThreadTaskRunner> db_task_runner_; | 99 scoped_refptr<base::SingleThreadTaskRunner> db_task_runner_; |
| 94 | 100 |
| 95 DISALLOW_COPY_AND_ASSIGN(TopSitesBackend); | 101 DISALLOW_COPY_AND_ASSIGN(TopSitesBackend); |
| 96 }; | 102 }; |
| 97 | 103 |
| 98 } // namespace history | 104 } // namespace history |
| 99 | 105 |
| 100 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ | 106 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_BACKEND_H_ |
| OLD | NEW |