| 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 COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const CanAddURLToHistoryFn& can_add_url_to_history); | 66 const CanAddURLToHistoryFn& can_add_url_to_history); |
| 67 | 67 |
| 68 // Initializes TopSitesImpl. | 68 // Initializes TopSitesImpl. |
| 69 void Init(const base::FilePath& db_name, | 69 void Init(const base::FilePath& db_name, |
| 70 const scoped_refptr<base::SingleThreadTaskRunner>& db_task_runner); | 70 const scoped_refptr<base::SingleThreadTaskRunner>& db_task_runner); |
| 71 | 71 |
| 72 // TopSites implementation. | 72 // TopSites implementation. |
| 73 bool SetPageThumbnail(const GURL& url, | 73 bool SetPageThumbnail(const GURL& url, |
| 74 const gfx::Image& thumbnail, | 74 const gfx::Image& thumbnail, |
| 75 const ThumbnailScore& score) override; | 75 const ThumbnailScore& score) override; |
| 76 bool SetPageThumbnailToJPEGBytes(const GURL& url, | |
| 77 const base::RefCountedMemory* memory, | |
| 78 const ThumbnailScore& score) override; | |
| 79 void GetMostVisitedURLs(const GetMostVisitedURLsCallback& callback, | 76 void GetMostVisitedURLs(const GetMostVisitedURLsCallback& callback, |
| 80 bool include_forced_urls) override; | 77 bool include_forced_urls) override; |
| 81 bool GetPageThumbnail(const GURL& url, | 78 bool GetPageThumbnail(const GURL& url, |
| 82 bool prefix_match, | 79 bool prefix_match, |
| 83 scoped_refptr<base::RefCountedMemory>* bytes) override; | 80 scoped_refptr<base::RefCountedMemory>* bytes) override; |
| 84 bool GetPageThumbnailScore(const GURL& url, ThumbnailScore* score) override; | 81 bool GetPageThumbnailScore(const GURL& url, ThumbnailScore* score) override; |
| 85 bool GetTemporaryPageThumbnailScore(const GURL& url, | 82 bool GetTemporaryPageThumbnailScore(const GURL& url, |
| 86 ThumbnailScore* score) override; | 83 ThumbnailScore* score) override; |
| 87 void SyncWithHistory() override; | 84 void SyncWithHistory() override; |
| 88 bool HasBlacklistedItems() const override; | 85 bool HasBlacklistedItems() const override; |
| 89 void AddBlacklistedURL(const GURL& url) override; | 86 void AddBlacklistedURL(const GURL& url) override; |
| 90 void RemoveBlacklistedURL(const GURL& url) override; | 87 void RemoveBlacklistedURL(const GURL& url) override; |
| 91 bool IsBlacklisted(const GURL& url) override; | 88 bool IsBlacklisted(const GURL& url) override; |
| 92 void ClearBlacklistedURLs() override; | 89 void ClearBlacklistedURLs() override; |
| 93 base::CancelableTaskTracker::TaskId StartQueryForMostVisited() override; | |
| 94 bool IsKnownURL(const GURL& url) override; | 90 bool IsKnownURL(const GURL& url) override; |
| 95 const std::string& GetCanonicalURLString(const GURL& url) const override; | |
| 96 bool IsNonForcedFull() override; | 91 bool IsNonForcedFull() override; |
| 97 bool IsForcedFull() override; | 92 bool IsForcedFull() override; |
| 98 PrepopulatedPageList GetPrepopulatedPages() override; | 93 PrepopulatedPageList GetPrepopulatedPages() override; |
| 99 bool loaded() const override; | 94 bool loaded() const override; |
| 100 bool AddForcedURL(const GURL& url, const base::Time& time) override; | 95 bool AddForcedURL(const GURL& url, const base::Time& time) override; |
| 101 void OnNavigationCommitted(const GURL& url) override; | 96 void OnNavigationCommitted(const GURL& url) override; |
| 102 | 97 |
| 103 // RefcountedKeyedService: | 98 // RefcountedKeyedService: |
| 104 void ShutdownOnUIThread() override; | 99 void ShutdownOnUIThread() override; |
| 105 | 100 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 130 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisited); | 125 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisited); |
| 131 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisitedWithForced); | 126 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisitedWithForced); |
| 132 | 127 |
| 133 typedef base::Callback<void(const MostVisitedURLList&, | 128 typedef base::Callback<void(const MostVisitedURLList&, |
| 134 const MostVisitedURLList&)> PendingCallback; | 129 const MostVisitedURLList&)> PendingCallback; |
| 135 | 130 |
| 136 typedef std::pair<GURL, Images> TempImage; | 131 typedef std::pair<GURL, Images> TempImage; |
| 137 typedef std::list<TempImage> TempImages; | 132 typedef std::list<TempImage> TempImages; |
| 138 typedef std::vector<PendingCallback> PendingCallbacks; | 133 typedef std::vector<PendingCallback> PendingCallbacks; |
| 139 | 134 |
| 135 void StartQueryForMostVisited(); |
| 136 |
| 140 // Generates the diff of things that happened between "old" and "new." | 137 // Generates the diff of things that happened between "old" and "new." |
| 141 // | 138 // |
| 142 // This treats forced URLs separately than non-forced URLs. | 139 // This treats forced URLs separately than non-forced URLs. |
| 143 // | 140 // |
| 144 // The URLs that are in "new" but not "old" will be have their index into | 141 // The URLs that are in "new" but not "old" will be have their index into |
| 145 // "new" put in |added_urls|. The non-forced URLs that are in "old" but not | 142 // "new" put in |added_urls|. The non-forced URLs that are in "old" but not |
| 146 // "new" will have their index into "old" put into |deleted_urls|. | 143 // "new" will have their index into "old" put into |deleted_urls|. |
| 147 // | 144 // |
| 148 // URLs appearing in both old and new lists but having different indices will | 145 // URLs appearing in both old and new lists but having different indices will |
| 149 // have their index into "new" be put into |moved_urls|. | 146 // have their index into "new" be put into |moved_urls|. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 312 |
| 316 ScopedObserver<HistoryService, HistoryServiceObserver> | 313 ScopedObserver<HistoryService, HistoryServiceObserver> |
| 317 history_service_observer_; | 314 history_service_observer_; |
| 318 | 315 |
| 319 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); | 316 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); |
| 320 }; | 317 }; |
| 321 | 318 |
| 322 } // namespace history | 319 } // namespace history |
| 323 | 320 |
| 324 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ | 321 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_IMPL_H_ |
| OLD | NEW |