| 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> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // db using TopSitesBackend. | 48 // db using TopSitesBackend. |
| 49 class TopSitesImpl : public TopSites { | 49 class TopSitesImpl : public TopSites { |
| 50 public: | 50 public: |
| 51 explicit TopSitesImpl(Profile* profile); | 51 explicit TopSitesImpl(Profile* profile); |
| 52 | 52 |
| 53 // Initializes TopSitesImpl. | 53 // Initializes TopSitesImpl. |
| 54 void Init(const base::FilePath& db_name); | 54 void Init(const base::FilePath& db_name); |
| 55 | 55 |
| 56 virtual bool SetPageThumbnail(const GURL& url, | 56 virtual bool SetPageThumbnail(const GURL& url, |
| 57 const gfx::Image& thumbnail, | 57 const gfx::Image& thumbnail, |
| 58 const ThumbnailScore& score) OVERRIDE; | 58 const ThumbnailScore& score) override; |
| 59 virtual bool SetPageThumbnailToJPEGBytes( | 59 virtual bool SetPageThumbnailToJPEGBytes( |
| 60 const GURL& url, | 60 const GURL& url, |
| 61 const base::RefCountedMemory* memory, | 61 const base::RefCountedMemory* memory, |
| 62 const ThumbnailScore& score) OVERRIDE; | 62 const ThumbnailScore& score) override; |
| 63 virtual void GetMostVisitedURLs( | 63 virtual void GetMostVisitedURLs( |
| 64 const GetMostVisitedURLsCallback& callback, | 64 const GetMostVisitedURLsCallback& callback, |
| 65 bool include_forced_urls) OVERRIDE; | 65 bool include_forced_urls) override; |
| 66 virtual bool GetPageThumbnail( | 66 virtual bool GetPageThumbnail( |
| 67 const GURL& url, | 67 const GURL& url, |
| 68 bool prefix_match, | 68 bool prefix_match, |
| 69 scoped_refptr<base::RefCountedMemory>* bytes) OVERRIDE; | 69 scoped_refptr<base::RefCountedMemory>* bytes) override; |
| 70 virtual bool GetPageThumbnailScore(const GURL& url, | 70 virtual bool GetPageThumbnailScore(const GURL& url, |
| 71 ThumbnailScore* score) OVERRIDE; | 71 ThumbnailScore* score) override; |
| 72 virtual bool GetTemporaryPageThumbnailScore(const GURL& url, | 72 virtual bool GetTemporaryPageThumbnailScore(const GURL& url, |
| 73 ThumbnailScore* score) OVERRIDE; | 73 ThumbnailScore* score) override; |
| 74 virtual void SyncWithHistory() OVERRIDE; | 74 virtual void SyncWithHistory() override; |
| 75 virtual bool HasBlacklistedItems() const OVERRIDE; | 75 virtual bool HasBlacklistedItems() const override; |
| 76 virtual void AddBlacklistedURL(const GURL& url) OVERRIDE; | 76 virtual void AddBlacklistedURL(const GURL& url) override; |
| 77 virtual void RemoveBlacklistedURL(const GURL& url) OVERRIDE; | 77 virtual void RemoveBlacklistedURL(const GURL& url) override; |
| 78 virtual bool IsBlacklisted(const GURL& url) OVERRIDE; | 78 virtual bool IsBlacklisted(const GURL& url) override; |
| 79 virtual void ClearBlacklistedURLs() OVERRIDE; | 79 virtual void ClearBlacklistedURLs() override; |
| 80 virtual void Shutdown() OVERRIDE; | 80 virtual void Shutdown() override; |
| 81 virtual base::CancelableTaskTracker::TaskId StartQueryForMostVisited() | 81 virtual base::CancelableTaskTracker::TaskId StartQueryForMostVisited() |
| 82 OVERRIDE; | 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: |
| 93 virtual ~TopSitesImpl(); | 93 virtual ~TopSitesImpl(); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 friend class TopSitesImplTest; | 96 friend class TopSitesImplTest; |
| 97 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisited); | 97 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisited); |
| 98 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisitedWithForced); | 98 FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisitedWithForced); |
| 99 | 99 |
| 100 typedef base::Callback<void(const MostVisitedURLList&, | 100 typedef base::Callback<void(const MostVisitedURLList&, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs. | 175 // Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs. |
| 176 std::string GetURLHash(const GURL& url); | 176 std::string GetURLHash(const GURL& url); |
| 177 | 177 |
| 178 // Returns the delay until the next update of history is needed. | 178 // Returns the delay until the next update of history is needed. |
| 179 // Uses num_urls_changed | 179 // Uses num_urls_changed |
| 180 base::TimeDelta GetUpdateDelay(); | 180 base::TimeDelta GetUpdateDelay(); |
| 181 | 181 |
| 182 // Implementation of content::NotificationObserver. | 182 // Implementation of content::NotificationObserver. |
| 183 virtual void Observe(int type, | 183 virtual void Observe(int type, |
| 184 const content::NotificationSource& source, | 184 const content::NotificationSource& source, |
| 185 const content::NotificationDetails& details) OVERRIDE; | 185 const content::NotificationDetails& details) override; |
| 186 | 186 |
| 187 // Updates URLs in |cache_| and the db (in the background). | 187 // Updates URLs in |cache_| and the db (in the background). |
| 188 // The non-forced URLs in |new_top_sites| replace those in |cache_|. | 188 // The non-forced URLs in |new_top_sites| replace those in |cache_|. |
| 189 // The forced URLs of |new_top_sites| are merged with those in |cache_|, | 189 // The forced URLs of |new_top_sites| are merged with those in |cache_|, |
| 190 // if the list of forced URLs overflows, the oldest ones are dropped. | 190 // if the list of forced URLs overflows, the oldest ones are dropped. |
| 191 // All mutations to cache_ *must* go through this. Should | 191 // All mutations to cache_ *must* go through this. Should |
| 192 // be called from the UI thread. | 192 // be called from the UI thread. |
| 193 void SetTopSites(const MostVisitedURLList& new_top_sites); | 193 void SetTopSites(const MostVisitedURLList& new_top_sites); |
| 194 | 194 |
| 195 // Returns the number of most visited results to request from history. This | 195 // Returns the number of most visited results to request from history. This |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 // Are we loaded? | 263 // Are we loaded? |
| 264 bool loaded_; | 264 bool loaded_; |
| 265 | 265 |
| 266 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); | 266 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 } // namespace history | 269 } // namespace history |
| 270 | 270 |
| 271 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ | 271 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ |
| OLD | NEW |