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 COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 const GURL& icon_url, | 319 const GURL& icon_url, |
320 favicon_base::IconType icon_type, | 320 favicon_base::IconType icon_type, |
321 scoped_refptr<base::RefCountedMemory> bitmap_data, | 321 scoped_refptr<base::RefCountedMemory> bitmap_data, |
322 const gfx::Size& pixel_size); | 322 const gfx::Size& pixel_size); |
323 | 323 |
324 void SetFavicons(const GURL& page_url, | 324 void SetFavicons(const GURL& page_url, |
325 favicon_base::IconType icon_type, | 325 favicon_base::IconType icon_type, |
326 const GURL& icon_url, | 326 const GURL& icon_url, |
327 const std::vector<SkBitmap>& bitmaps); | 327 const std::vector<SkBitmap>& bitmaps); |
328 | 328 |
329 bool SetLastResortFavicons(const GURL& page_url, | 329 bool SetOnDemandFavicons(const GURL& page_url, |
330 favicon_base::IconType icon_type, | 330 favicon_base::IconType icon_type, |
331 const GURL& icon_url, | 331 const GURL& icon_url, |
332 const std::vector<SkBitmap>& bitmaps); | 332 const std::vector<SkBitmap>& bitmaps); |
333 | 333 |
334 void SetFaviconsOutOfDateForPage(const GURL& page_url); | 334 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
335 | 335 |
| 336 void TouchOnDemandFavicon(const GURL& icon_url); |
| 337 |
336 void SetImportedFavicons( | 338 void SetImportedFavicons( |
337 const favicon_base::FaviconUsageDataList& favicon_usage); | 339 const favicon_base::FaviconUsageDataList& favicon_usage); |
338 | 340 |
339 // Downloads ----------------------------------------------------------------- | 341 // Downloads ----------------------------------------------------------------- |
340 | 342 |
341 uint32_t GetNextDownloadId(); | 343 uint32_t GetNextDownloadId(); |
342 void QueryDownloads(std::vector<DownloadRow>* rows); | 344 void QueryDownloads(std::vector<DownloadRow>* rows); |
343 void UpdateDownload(const DownloadRow& data, bool should_commit_immediately); | 345 void UpdateDownload(const DownloadRow& data, bool should_commit_immediately); |
344 bool CreateDownload(const DownloadRow& history_info); | 346 bool CreateDownload(const DownloadRow& history_info); |
345 void RemoveDownloads(const std::set<uint32_t>& ids); | 347 void RemoveDownloads(const std::set<uint32_t>& ids); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
517 SetFaviconMappingsForPageAndRedirects); | 519 SetFaviconMappingsForPageAndRedirects); |
518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
519 SetFaviconMappingsForPageAndRedirectsWithFragment); | 521 SetFaviconMappingsForPageAndRedirectsWithFragment); |
520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 522 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
521 SetFaviconMappingsForPageDuplicates); | 523 SetFaviconMappingsForPageDuplicates); |
522 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps); | 524 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps); |
523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData); | 525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData); |
524 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 526 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
525 SetFaviconsSameFaviconURLForTwoPages); | 527 SetFaviconsSameFaviconURLForTwoPages); |
526 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetLastResortFaviconsForEmptyDB); | 528 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForEmptyDB); |
527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForPageInDB); |
528 SetLastResortFaviconsForPageInDB); | 530 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForIconInDB); |
529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | |
530 SetLastResortFaviconsForIconInDB); | |
531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
532 UpdateFaviconMappingsAndFetchNoChange); | 532 UpdateFaviconMappingsAndFetchNoChange); |
533 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); | 533 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); |
534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); | 534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); |
535 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); | 535 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); |
536 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 536 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
537 MergeFaviconIconURLMappedToDifferentPageURL); | 537 MergeFaviconIconURLMappedToDifferentPageURL); |
538 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 538 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
539 MergeFaviconMaxFaviconBitmapsPerIconURL); | 539 MergeFaviconMaxFaviconBitmapsPerIconURL); |
540 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 540 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // Favicons ------------------------------------------------------------------ | 674 // Favicons ------------------------------------------------------------------ |
675 | 675 |
676 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified | 676 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified |
677 // only if it's not present in the database. In that case, it will be | 677 // only if it's not present in the database. In that case, it will be |
678 // initially set as expired. Returns whether the new bitmaps were actually | 678 // initially set as expired. Returns whether the new bitmaps were actually |
679 // written. | 679 // written. |
680 bool SetFaviconsImpl(const GURL& page_url, | 680 bool SetFaviconsImpl(const GURL& page_url, |
681 favicon_base::IconType icon_type, | 681 favicon_base::IconType icon_type, |
682 const GURL& icon_url, | 682 const GURL& icon_url, |
683 const std::vector<SkBitmap>& bitmaps, | 683 const std::vector<SkBitmap>& bitmaps, |
684 bool bitmaps_are_expired); | 684 bool are_bitmaps_on_demand); |
685 | 685 |
686 // Used by both UpdateFaviconMappingsAndFetch() and GetFavicon(). | 686 // Used by both UpdateFaviconMappingsAndFetch() and GetFavicon(). |
687 // If |page_url| is non-null and there is a favicon stored in the database | 687 // If |page_url| is non-null and there is a favicon stored in the database |
688 // for |icon_url|, a mapping is added to the database from |page_url| (and all | 688 // for |icon_url|, a mapping is added to the database from |page_url| (and all |
689 // redirects) to |icon_url|. | 689 // redirects) to |icon_url|. |
690 void UpdateFaviconMappingsAndFetchImpl( | 690 void UpdateFaviconMappingsAndFetchImpl( |
691 const GURL* page_url, | 691 const GURL* page_url, |
692 const GURL& icon_url, | 692 const GURL& icon_url, |
693 favicon_base::IconType icon_type, | 693 favicon_base::IconType icon_type, |
694 const std::vector<int>& desired_sizes, | 694 const std::vector<int>& desired_sizes, |
695 std::vector<favicon_base::FaviconRawBitmapResult>* results); | 695 std::vector<favicon_base::FaviconRawBitmapResult>* results); |
696 | 696 |
697 // Set the favicon bitmaps for |icon_id|. | 697 // Set the favicon bitmaps for |icon_id|. |
698 // For each entry in |bitmaps|, if a favicon bitmap already exists at the | 698 // For each entry in |bitmaps|, if a favicon bitmap already exists at the |
699 // entry's pixel size, replace the favicon bitmap's data with the entry's | 699 // entry's pixel size, replace the favicon bitmap's data with the entry's |
700 // bitmap data. Otherwise add a new favicon bitmap. | 700 // bitmap data. Otherwise add a new favicon bitmap. |
701 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not | 701 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not |
702 // match the pixel size of one of |bitmaps| is deleted. | 702 // match the pixel size of one of |bitmaps| is deleted. |
703 // Returns true if any of the bitmap data at |icon_id| is changed as a result | 703 // Returns true if any of the bitmap data at |icon_id| is changed as a result |
704 // of calling this method. | 704 // of calling this method. |
705 bool SetFaviconBitmaps(favicon_base::FaviconID icon_id, | 705 bool SetFaviconBitmaps(favicon_base::FaviconID icon_id, |
706 const std::vector<SkBitmap>& bitmaps); | 706 const std::vector<SkBitmap>& bitmaps, |
| 707 bool are_bitmaps_on_demand); |
707 | 708 |
708 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. | 709 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. |
709 bool IsFaviconBitmapDataEqual( | 710 bool IsFaviconBitmapDataEqual( |
710 FaviconBitmapID bitmap_id, | 711 FaviconBitmapID bitmap_id, |
711 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); | 712 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); |
712 | 713 |
713 // Returns true if there are favicons for |page_url| and one of the types in | 714 // Returns true if there are favicons for |page_url| and one of the types in |
714 // |icon_types|. | 715 // |icon_types|. |
715 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes | 716 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes |
716 // most closely match |desired_sizes|. If |desired_sizes| has a '0' entry, the | 717 // most closely match |desired_sizes|. If |desired_sizes| has a '0' entry, the |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // it unregisters itself as observer during destruction. | 916 // it unregisters itself as observer during destruction. |
916 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 917 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
917 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_; | 918 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_; |
918 | 919 |
919 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 920 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
920 }; | 921 }; |
921 | 922 |
922 } // namespace history | 923 } // namespace history |
923 | 924 |
924 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 925 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
OLD | NEW |