| 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_HISTORY_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "components/visitedlink/browser/visitedlink_delegate.h" | 26 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 27 #include "sql/init_status.h" | 27 #include "sql/init_status.h" |
| 28 | 28 |
| 29 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 30 #include "chrome/browser/history/android/android_history_types.h" | 30 #include "chrome/browser/history/android/android_history_types.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 class HistoryURLProvider; | 33 class HistoryURLProvider; |
| 34 struct HistoryURLProviderParams; | 34 struct HistoryURLProviderParams; |
| 35 struct ImportedFaviconUsage; | 35 struct ImportedFaviconUsage; |
| 36 class SkBitmap; |
| 36 class TestingProfile; | 37 class TestingProfile; |
| 37 struct ThumbnailScore; | 38 struct ThumbnailScore; |
| 38 | 39 |
| 39 namespace base { | 40 namespace base { |
| 40 class MessageLoop; | 41 class MessageLoop; |
| 41 class SingleThreadTaskRunner; | 42 class SingleThreadTaskRunner; |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace history { | 45 namespace history { |
| 45 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); | 260 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); |
| 260 | 261 |
| 261 void MergeFavicon(const GURL& page_url, | 262 void MergeFavicon(const GURL& page_url, |
| 262 const GURL& icon_url, | 263 const GURL& icon_url, |
| 263 favicon_base::IconType icon_type, | 264 favicon_base::IconType icon_type, |
| 264 scoped_refptr<base::RefCountedMemory> bitmap_data, | 265 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 265 const gfx::Size& pixel_size); | 266 const gfx::Size& pixel_size); |
| 266 | 267 |
| 267 void SetFavicons(const GURL& page_url, | 268 void SetFavicons(const GURL& page_url, |
| 268 favicon_base::IconType icon_type, | 269 favicon_base::IconType icon_type, |
| 269 const std::vector<favicon_base::FaviconRawBitmapData>& | 270 const GURL& icon_url, |
| 270 favicon_bitmap_data); | 271 const std::vector<SkBitmap>& bitmaps); |
| 271 | 272 |
| 272 void SetFaviconsOutOfDateForPage(const GURL& page_url); | 273 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
| 273 | 274 |
| 274 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); | 275 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); |
| 275 | 276 |
| 276 void SetImportedFavicons( | 277 void SetImportedFavicons( |
| 277 const std::vector<ImportedFaviconUsage>& favicon_usage); | 278 const std::vector<ImportedFaviconUsage>& favicon_usage); |
| 278 | 279 |
| 279 // Downloads ----------------------------------------------------------------- | 280 // Downloads ----------------------------------------------------------------- |
| 280 | 281 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 MergeFaviconIconURLMappedToDifferentPageURL); | 540 MergeFaviconIconURLMappedToDifferentPageURL); |
| 540 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 541 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 541 MergeFaviconMaxFaviconBitmapsPerIconURL); | 542 MergeFaviconMaxFaviconBitmapsPerIconURL); |
| 542 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 543 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 543 UpdateFaviconMappingsAndFetchMultipleIconTypes); | 544 UpdateFaviconMappingsAndFetchMultipleIconTypes); |
| 544 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); | 545 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); |
| 545 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 546 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 546 GetFaviconsFromDBNoFaviconBitmaps); | 547 GetFaviconsFromDBNoFaviconBitmaps); |
| 547 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 548 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 548 GetFaviconsFromDBSelectClosestMatch); | 549 GetFaviconsFromDBSelectClosestMatch); |
| 549 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBSingleIconURL); | |
| 550 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); | 550 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); |
| 551 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); | 551 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); |
| 552 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 552 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 553 UpdateFaviconMappingsAndFetchNoDB); | 553 UpdateFaviconMappingsAndFetchNoDB); |
| 554 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 554 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 555 CloneFaviconIsRestrictedToSameDomain); | 555 CloneFaviconIsRestrictedToSameDomain); |
| 556 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs); | 556 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs); |
| 557 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration); | 557 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration); |
| 558 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes); | 558 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes); |
| 559 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases); | 559 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // If multiple icon types are specified, |page_url| will be mapped to the | 682 // If multiple icon types are specified, |page_url| will be mapped to the |
| 683 // icon URLs of the largest type available in the database. | 683 // icon URLs of the largest type available in the database. |
| 684 void UpdateFaviconMappingsAndFetchImpl( | 684 void UpdateFaviconMappingsAndFetchImpl( |
| 685 const GURL* page_url, | 685 const GURL* page_url, |
| 686 const std::vector<GURL>& icon_urls, | 686 const std::vector<GURL>& icon_urls, |
| 687 int icon_types, | 687 int icon_types, |
| 688 const std::vector<int>& desired_sizes, | 688 const std::vector<int>& desired_sizes, |
| 689 std::vector<favicon_base::FaviconRawBitmapResult>* results); | 689 std::vector<favicon_base::FaviconRawBitmapResult>* results); |
| 690 | 690 |
| 691 // Set the favicon bitmaps for |icon_id|. | 691 // Set the favicon bitmaps for |icon_id|. |
| 692 // For each entry in |favicon_bitmap_data|, if a favicon bitmap already | 692 // For each entry in |bitmaps|, if a favicon bitmap already exists at the |
| 693 // exists at the entry's pixel size, replace the favicon bitmap's data with | 693 // entry's pixel size, replace the favicon bitmap's data with the entry's |
| 694 // the entry's bitmap data. Otherwise add a new favicon bitmap. | 694 // bitmap data. Otherwise add a new favicon bitmap. |
| 695 // Any favicon bitmaps already mapped to |icon_id| whose pixel sizes are not | 695 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not |
| 696 // in |favicon_bitmap_data| are deleted. | 696 // match the pixel size of one of |bitmaps| is deleted. |
| 697 // If not NULL, |favicon_bitmaps_changed| is set to whether any of the bitmap | 697 // Returns true if any of the bitmap data at |icon_id| is changed as a result |
| 698 // data at |icon_id| is changed as a result of calling this method. | 698 // of calling this method. |
| 699 // Computing |favicon_bitmaps_changed| requires additional database queries | 699 bool SetFaviconBitmaps(favicon_base::FaviconID icon_id, |
| 700 // so should be avoided if unnecessary. | 700 const std::vector<SkBitmap>& bitmaps); |
| 701 void SetFaviconBitmaps(favicon_base::FaviconID icon_id, | |
| 702 const std::vector<favicon_base::FaviconRawBitmapData>& | |
| 703 favicon_bitmap_data, | |
| 704 bool* favicon_bitmaps_changed); | |
| 705 | |
| 706 // Returns true if |favicon_bitmap_data| passed to SetFavicons() is valid. | |
| 707 // Criteria: | |
| 708 // 1) |favicon_bitmap_data| contains no more than | |
| 709 // kMaxFaviconsPerPage unique icon URLs. | |
| 710 // kMaxFaviconBitmapsPerIconURL favicon bitmaps for each icon URL. | |
| 711 // 2) FaviconRawBitmapData::bitmap_data contains non NULL bitmap data. | |
| 712 bool ValidateSetFaviconsParams(const std::vector< | |
| 713 favicon_base::FaviconRawBitmapData>& favicon_bitmap_data) const; | |
| 714 | 701 |
| 715 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. | 702 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. |
| 716 bool IsFaviconBitmapDataEqual( | 703 bool IsFaviconBitmapDataEqual( |
| 717 FaviconBitmapID bitmap_id, | 704 FaviconBitmapID bitmap_id, |
| 718 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); | 705 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); |
| 719 | 706 |
| 720 // Returns true if there are favicons for |page_url| and one of the types in | 707 // Returns true if there are favicons for |page_url| and one of the types in |
| 721 // |icon_types|. | 708 // |icon_types|. |
| 722 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes | 709 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes |
| 723 // most closely match |desired_sizes|. If |desired_sizes| has a '0' entry, the | 710 // most closely match |desired_sizes|. If |desired_sizes| has a '0' entry, the |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 888 |
| 902 // Listens for the system being under memory pressure. | 889 // Listens for the system being under memory pressure. |
| 903 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 890 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 904 | 891 |
| 905 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 892 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 906 }; | 893 }; |
| 907 | 894 |
| 908 } // namespace history | 895 } // namespace history |
| 909 | 896 |
| 910 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 897 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |