| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/ref_counted_memory.h" | |
| 19 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 20 #include "base/time.h" | 19 #include "base/time.h" |
| 21 #include "base/timer.h" | 20 #include "base/timer.h" |
| 22 #include "chrome/browser/cancelable_request.h" | 21 #include "chrome/browser/cancelable_request.h" |
| 23 #include "chrome/browser/history/history.h" | 22 #include "chrome/browser/history/history.h" |
| 24 #include "chrome/browser/history/history_types.h" | 23 #include "chrome/browser/history/history_types.h" |
| 25 #include "chrome/browser/history/page_usage_data.h" | 24 #include "chrome/browser/history/page_usage_data.h" |
| 26 #include "chrome/common/thumbnail_score.h" | 25 #include "chrome/common/thumbnail_score.h" |
| 27 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 28 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 29 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| 30 | 29 |
| 31 class FilePath; | 30 class FilePath; |
| 32 class Profile; | 31 class Profile; |
| 33 | 32 |
| 33 namespace base { |
| 34 class RefCountedBytes; |
| 35 class RefCountedMemory; |
| 36 } |
| 37 |
| 34 namespace history { | 38 namespace history { |
| 35 | 39 |
| 36 class TopSitesCache; | 40 class TopSitesCache; |
| 37 class TopSitesBackend; | 41 class TopSitesBackend; |
| 38 class TopSitesTest; | 42 class TopSitesTest; |
| 39 | 43 |
| 40 // Stores the data for the top "most visited" sites. This includes a cache of | 44 // Stores the data for the top "most visited" sites. This includes a cache of |
| 41 // the most visited data from history, as well as the corresponding thumbnails | 45 // the most visited data from history, as well as the corresponding thumbnails |
| 42 // of those sites. | 46 // of those sites. |
| 43 // | 47 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 // This may be invoked on any thread. | 75 // This may be invoked on any thread. |
| 72 // NOTE: the callback is called immediately if we have the data cached. | 76 // NOTE: the callback is called immediately if we have the data cached. |
| 73 void GetMostVisitedURLs(CancelableRequestConsumer* consumer, | 77 void GetMostVisitedURLs(CancelableRequestConsumer* consumer, |
| 74 const GetTopSitesCallback& callback); | 78 const GetTopSitesCallback& callback); |
| 75 | 79 |
| 76 // Get a thumbnail for a given page. Returns true iff we have the thumbnail. | 80 // Get a thumbnail for a given page. Returns true iff we have the thumbnail. |
| 77 // This may be invoked on any thread. | 81 // This may be invoked on any thread. |
| 78 // As this method may be invoked on any thread the ref count needs to be | 82 // As this method may be invoked on any thread the ref count needs to be |
| 79 // incremented before this method returns, so this takes a scoped_refptr*. | 83 // incremented before this method returns, so this takes a scoped_refptr*. |
| 80 bool GetPageThumbnail(const GURL& url, | 84 bool GetPageThumbnail(const GURL& url, |
| 81 scoped_refptr<RefCountedMemory>* bytes); | 85 scoped_refptr<base::RefCountedMemory>* bytes); |
| 82 | 86 |
| 83 // Get a thumbnail score for a given page. Returns true iff we have the | 87 // Get a thumbnail score for a given page. Returns true iff we have the |
| 84 // thumbnail score. This may be invoked on any thread. The score will | 88 // thumbnail score. This may be invoked on any thread. The score will |
| 85 // be copied to |score|. | 89 // be copied to |score|. |
| 86 virtual bool GetPageThumbnailScore(const GURL& url, ThumbnailScore* score); | 90 virtual bool GetPageThumbnailScore(const GURL& url, ThumbnailScore* score); |
| 87 | 91 |
| 88 // Get a temporary thumbnail score for a given page. Returns true iff we | 92 // Get a temporary thumbnail score for a given page. Returns true iff we |
| 89 // have the thumbnail score. Useful when checking if we should update a | 93 // have the thumbnail score. Useful when checking if we should update a |
| 90 // thumbnail for a given page. The score will be copied to |score|. | 94 // thumbnail for a given page. The score will be copied to |score|. |
| 91 bool GetTemporaryPageThumbnailScore(const GURL& url, ThumbnailScore* score); | 95 bool GetTemporaryPageThumbnailScore(const GURL& url, ThumbnailScore* score); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 bool loaded_; | 363 bool loaded_; |
| 360 | 364 |
| 361 DISALLOW_COPY_AND_ASSIGN(TopSites); | 365 DISALLOW_COPY_AND_ASSIGN(TopSites); |
| 362 }; | 366 }; |
| 363 | 367 |
| 364 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; | 368 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; |
| 365 | 369 |
| 366 } // namespace history | 370 } // namespace history |
| 367 | 371 |
| 368 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 372 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
| OLD | NEW |