| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 const GURL& icon_url, | 318 const GURL& icon_url, |
| 319 favicon_base::IconType icon_type, | 319 favicon_base::IconType icon_type, |
| 320 scoped_refptr<base::RefCountedMemory> bitmap_data, | 320 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 321 const gfx::Size& pixel_size); | 321 const gfx::Size& pixel_size); |
| 322 | 322 |
| 323 void SetFavicons(const GURL& page_url, | 323 void SetFavicons(const GURL& page_url, |
| 324 favicon_base::IconType icon_type, | 324 favicon_base::IconType icon_type, |
| 325 const GURL& icon_url, | 325 const GURL& icon_url, |
| 326 const std::vector<SkBitmap>& bitmaps); | 326 const std::vector<SkBitmap>& bitmaps); |
| 327 | 327 |
| 328 bool SetLastResortFavicons(const GURL& page_url, |
| 329 favicon_base::IconType icon_type, |
| 330 const GURL& icon_url, |
| 331 const std::vector<SkBitmap>& bitmaps); |
| 332 |
| 328 void SetFaviconsOutOfDateForPage(const GURL& page_url); | 333 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
| 329 | 334 |
| 330 void SetImportedFavicons( | 335 void SetImportedFavicons( |
| 331 const favicon_base::FaviconUsageDataList& favicon_usage); | 336 const favicon_base::FaviconUsageDataList& favicon_usage); |
| 332 | 337 |
| 333 // Downloads ----------------------------------------------------------------- | 338 // Downloads ----------------------------------------------------------------- |
| 334 | 339 |
| 335 uint32_t GetNextDownloadId(); | 340 uint32_t GetNextDownloadId(); |
| 336 void QueryDownloads(std::vector<DownloadRow>* rows); | 341 void QueryDownloads(std::vector<DownloadRow>* rows); |
| 337 void UpdateDownload(const DownloadRow& data, bool should_commit_immediately); | 342 void UpdateDownload(const DownloadRow& data, bool should_commit_immediately); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 508 SetFaviconMappingsForPageAndRedirects); | 513 SetFaviconMappingsForPageAndRedirects); |
| 509 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 510 SetFaviconMappingsForPageAndRedirectsWithFragment); | 515 SetFaviconMappingsForPageAndRedirectsWithFragment); |
| 511 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 516 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 512 SetFaviconMappingsForPageDuplicates); | 517 SetFaviconMappingsForPageDuplicates); |
| 513 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps); | 518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps); |
| 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData); | 519 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData); |
| 515 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 516 SetFaviconsSameFaviconURLForTwoPages); | 521 SetFaviconsSameFaviconURLForTwoPages); |
| 522 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetLastResortFaviconsForEmptyDB); |
| 523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 524 SetLastResortFaviconsForPageInDB); |
| 525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 526 SetLastResortFaviconsForIconInDB); |
| 517 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 518 UpdateFaviconMappingsAndFetchNoChange); | 528 UpdateFaviconMappingsAndFetchNoChange); |
| 519 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); | 529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); |
| 520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); | 530 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); |
| 521 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); | 531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); |
| 522 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 532 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 523 MergeFaviconIconURLMappedToDifferentPageURL); | 533 MergeFaviconIconURLMappedToDifferentPageURL); |
| 524 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| 525 MergeFaviconMaxFaviconBitmapsPerIconURL); | 535 MergeFaviconMaxFaviconBitmapsPerIconURL); |
| 526 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 536 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Update the segment information. This is called internally when a page is | 662 // Update the segment information. This is called internally when a page is |
| 653 // added. Return the segment id of the segment that has been updated. | 663 // added. Return the segment id of the segment that has been updated. |
| 654 SegmentID UpdateSegments(const GURL& url, | 664 SegmentID UpdateSegments(const GURL& url, |
| 655 VisitID from_visit, | 665 VisitID from_visit, |
| 656 VisitID visit_id, | 666 VisitID visit_id, |
| 657 ui::PageTransition transition_type, | 667 ui::PageTransition transition_type, |
| 658 const base::Time ts); | 668 const base::Time ts); |
| 659 | 669 |
| 660 // Favicons ------------------------------------------------------------------ | 670 // Favicons ------------------------------------------------------------------ |
| 661 | 671 |
| 672 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified |
| 673 // only if it's not present in the database. In that case, it will be |
| 674 // initially set as expired. Returns whether the new bitmaps were actually |
| 675 // written. |
| 676 bool SetFaviconsImpl(const GURL& page_url, |
| 677 favicon_base::IconType icon_type, |
| 678 const GURL& icon_url, |
| 679 const std::vector<SkBitmap>& bitmaps, |
| 680 bool bitmaps_are_expired); |
| 681 |
| 662 // Used by both UpdateFaviconMappingsAndFetch and GetFavicons. | 682 // Used by both UpdateFaviconMappingsAndFetch and GetFavicons. |
| 663 // If |page_url| is non-null, the icon urls for |page_url| (and all | 683 // If |page_url| is non-null, the icon urls for |page_url| (and all |
| 664 // redirects) are set to the subset of |icon_urls| for which icons are | 684 // redirects) are set to the subset of |icon_urls| for which icons are |
| 665 // already stored in the database. | 685 // already stored in the database. |
| 666 // If |page_url| is non-null, |icon_types| can be multiple icon types | 686 // If |page_url| is non-null, |icon_types| can be multiple icon types |
| 667 // only if |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. | 687 // only if |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. |
| 668 // If multiple icon types are specified, |page_url| will be mapped to the | 688 // If multiple icon types are specified, |page_url| will be mapped to the |
| 669 // icon URLs of the largest type available in the database. | 689 // icon URLs of the largest type available in the database. |
| 670 void UpdateFaviconMappingsAndFetchImpl( | 690 void UpdateFaviconMappingsAndFetchImpl( |
| 671 const GURL* page_url, | 691 const GURL* page_url, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 // Init is called. Defined after observers_ because it unregisters itself as | 913 // Init is called. Defined after observers_ because it unregisters itself as |
| 894 // observer during destruction. | 914 // observer during destruction. |
| 895 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 915 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
| 896 | 916 |
| 897 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 917 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 898 }; | 918 }; |
| 899 | 919 |
| 900 } // namespace history | 920 } // namespace history |
| 901 | 921 |
| 902 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 922 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
| OLD | NEW |