| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "components/history/core/browser/history_types.h" | 13 #include "components/history/core/browser/history_types.h" |
| 15 #include "components/history/core/browser/top_sites_observer.h" | 14 #include "components/history/core/browser/top_sites_observer.h" |
| 16 #include "components/history/core/common/thumbnail_score.h" | 15 #include "components/history/core/common/thumbnail_score.h" |
| 16 #include "components/keyed_service/core/refcounted_keyed_service.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 class Profile; | 22 class Profile; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class FilePath; | 25 class FilePath; |
| 26 class RefCountedBytes; | 26 class RefCountedBytes; |
| 27 class RefCountedMemory; | 27 class RefCountedMemory; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace history { | 30 namespace history { |
| 31 | 31 |
| 32 class TopSitesCache; | 32 class TopSitesCache; |
| 33 | 33 |
| 34 // Interface for TopSites, which stores the data for the top "most visited" | 34 // Interface for TopSites, which stores the data for the top "most visited" |
| 35 // sites. This includes a cache of the most visited data from history, as well | 35 // sites. This includes a cache of the most visited data from history, as well |
| 36 // as the corresponding thumbnails of those sites. | 36 // as the corresponding thumbnails of those sites. |
| 37 // | 37 // |
| 38 // Some methods should only be called from the UI thread (see method | 38 // Some methods should only be called from the UI thread (see method |
| 39 // descriptions below). All others are assumed to be threadsafe. | 39 // descriptions below). All others are assumed to be threadsafe. |
| 40 class TopSites | 40 class TopSites : public RefcountedKeyedService, |
| 41 : public base::RefCountedThreadSafe<TopSites>, | 41 public content::NotificationObserver { |
| 42 public content::NotificationObserver { | |
| 43 public: | 42 public: |
| 44 TopSites(); | 43 TopSites(); |
| 45 | 44 |
| 46 // Initializes TopSites. | 45 // Initializes TopSites. |
| 47 static TopSites* Create(Profile* profile, const base::FilePath& db_name); | 46 static TopSites* Create(Profile* profile, const base::FilePath& db_name); |
| 48 | 47 |
| 49 // Sets the given thumbnail for the given URL. Returns true if the thumbnail | 48 // Sets the given thumbnail for the given URL. Returns true if the thumbnail |
| 50 // was updated. False means either the URL wasn't known to us, or we felt | 49 // was updated. False means either the URL wasn't known to us, or we felt |
| 51 // that our current thumbnail was superior to the given one. Should be called | 50 // that our current thumbnail was superior to the given one. Should be called |
| 52 // from the UI thread. | 51 // from the UI thread. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const int kPrepopulatedPagesCount = 0; | 190 const int kPrepopulatedPagesCount = 0; |
| 192 #else | 191 #else |
| 193 const int kPrepopulatedPagesCount = 2; | 192 const int kPrepopulatedPagesCount = 2; |
| 194 #endif | 193 #endif |
| 195 extern const TopSites::PrepopulatedPage | 194 extern const TopSites::PrepopulatedPage |
| 196 kPrepopulatedPages[kPrepopulatedPagesCount]; | 195 kPrepopulatedPages[kPrepopulatedPagesCount]; |
| 197 | 196 |
| 198 } // namespace history | 197 } // namespace history |
| 199 | 198 |
| 200 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 199 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
| OLD | NEW |