Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Side by Side Diff: components/history/core/browser/history_backend.h

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Peter's comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
522 SetFaviconMappingsForPageAndRedirects); 524 SetFaviconMappingsForPageAndRedirects);
523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
524 SetFaviconMappingsForPageAndRedirectsWithFragment); 526 SetFaviconMappingsForPageAndRedirectsWithFragment);
525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
526 SetFaviconMappingsForPageDuplicates); 528 SetFaviconMappingsForPageDuplicates);
527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps); 529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsDeleteBitmaps);
528 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData); 530 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetFaviconsReplaceBitmapData);
529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
530 SetFaviconsSameFaviconURLForTwoPages); 532 SetFaviconsSameFaviconURLForTwoPages);
531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetLastResortFaviconsForEmptyDB); 533 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForEmptyDB);
532 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForPageInDB);
533 SetLastResortFaviconsForPageInDB); 535 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, SetOnDemandFaviconsForIconInDB);
534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
535 SetLastResortFaviconsForIconInDB);
536 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 536 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
537 UpdateFaviconMappingsAndFetchNoChange); 537 UpdateFaviconMappingsAndFetchNoChange);
538 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); 538 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB);
539 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); 539 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB);
540 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); 540 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage);
541 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 541 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
542 MergeFaviconIconURLMappedToDifferentPageURL); 542 MergeFaviconIconURLMappedToDifferentPageURL);
543 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 543 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
544 MergeFaviconMaxFaviconBitmapsPerIconURL); 544 MergeFaviconMaxFaviconBitmapsPerIconURL);
545 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 545 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // Favicons ------------------------------------------------------------------ 679 // Favicons ------------------------------------------------------------------
680 680
681 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified 681 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified
682 // only if it's not present in the database. In that case, it will be 682 // only if it's not present in the database. In that case, it will be
683 // initially set as expired. Returns whether the new bitmaps were actually 683 // initially set as expired. Returns whether the new bitmaps were actually
684 // written. 684 // written.
685 bool SetFaviconsImpl(const GURL& page_url, 685 bool SetFaviconsImpl(const GURL& page_url,
686 favicon_base::IconType icon_type, 686 favicon_base::IconType icon_type,
687 const GURL& icon_url, 687 const GURL& icon_url,
688 const std::vector<SkBitmap>& bitmaps, 688 const std::vector<SkBitmap>& bitmaps,
689 bool bitmaps_are_expired); 689 FaviconBitmapType type);
690 690
691 // Used by both UpdateFaviconMappingsAndFetch() and GetFavicon(). 691 // Used by both UpdateFaviconMappingsAndFetch() and GetFavicon().
692 // If |page_url| is non-null and there is a favicon stored in the database 692 // If |page_url| is non-null and there is a favicon stored in the database
693 // for |icon_url|, a mapping is added to the database from |page_url| (and all 693 // for |icon_url|, a mapping is added to the database from |page_url| (and all
694 // redirects) to |icon_url|. 694 // redirects) to |icon_url|.
695 void UpdateFaviconMappingsAndFetchImpl( 695 void UpdateFaviconMappingsAndFetchImpl(
696 const GURL* page_url, 696 const GURL* page_url,
697 const GURL& icon_url, 697 const GURL& icon_url,
698 favicon_base::IconType icon_type, 698 favicon_base::IconType icon_type,
699 const std::vector<int>& desired_sizes, 699 const std::vector<int>& desired_sizes,
700 std::vector<favicon_base::FaviconRawBitmapResult>* results); 700 std::vector<favicon_base::FaviconRawBitmapResult>* results);
701 701
702 // Set the favicon bitmaps for |icon_id|. 702 // Set the favicon bitmaps of |type| for |icon_id|.
703 // For each entry in |bitmaps|, if a favicon bitmap already exists at the 703 // For each entry in |bitmaps|, if a favicon bitmap already exists at the
704 // entry's pixel size, replace the favicon bitmap's data with the entry's 704 // entry's pixel size, replace the favicon bitmap's data with the entry's
705 // bitmap data. Otherwise add a new favicon bitmap. 705 // bitmap data. Otherwise add a new favicon bitmap.
706 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not 706 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not
707 // match the pixel size of one of |bitmaps| is deleted. 707 // match the pixel size of one of |bitmaps| is deleted.
708 // For bitmap type FaviconBitmapType::ON_DEMAND, this is legal to call only
709 // for a newly created |icon_id| (that has no bitmaps yet).
708 // Returns true if any of the bitmap data at |icon_id| is changed as a result 710 // Returns true if any of the bitmap data at |icon_id| is changed as a result
709 // of calling this method. 711 // of calling this method.
710 bool SetFaviconBitmaps(favicon_base::FaviconID icon_id, 712 bool SetFaviconBitmaps(favicon_base::FaviconID icon_id,
711 const std::vector<SkBitmap>& bitmaps); 713 const std::vector<SkBitmap>& bitmaps,
714 FaviconBitmapType type);
712 715
713 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. 716 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|.
714 bool IsFaviconBitmapDataEqual( 717 bool IsFaviconBitmapDataEqual(
715 FaviconBitmapID bitmap_id, 718 FaviconBitmapID bitmap_id,
716 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); 719 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data);
717 720
718 // Returns true if there are favicons for |page_url| and one of the types in 721 // Returns true if there are favicons for |page_url| and one of the types in
719 // |icon_types|. 722 // |icon_types|.
720 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes 723 // |favicon_bitmap_results| is set to the favicon bitmaps whose edge sizes
721 // most closely match |desired_sizes|. If |desired_sizes| has a '0' entry, the 724 // 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
920 // it unregisters itself as observer during destruction. 923 // it unregisters itself as observer during destruction.
921 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 924 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
922 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_; 925 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_;
923 926
924 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 927 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
925 }; 928 };
926 929
927 } // namespace history 930 } // namespace history
928 931
929 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 932 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « components/history/core/browser/android/favicon_sql_handler.cc ('k') | components/history/core/browser/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698