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

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

Issue 1133463005: Update all bookmarks which use an icon URL when a favicon's bitmap is updated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startup_do_not_unexpire
Patch Set: Created 5 years, 5 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Sets the in-memory history backend. The in-memory backend is created by 114 // Sets the in-memory history backend. The in-memory backend is created by
115 // the main backend. For non-unit tests, this happens on the background 115 // the main backend. For non-unit tests, this happens on the background
116 // thread. It is to be used on the main thread, so this would transfer 116 // thread. It is to be used on the main thread, so this would transfer
117 // it to the history service. Unit tests can override this behavior. 117 // it to the history service. Unit tests can override this behavior.
118 // 118 //
119 // This function is NOT guaranteed to be called. If there is an error, 119 // This function is NOT guaranteed to be called. If there is an error,
120 // there may be no in-memory database. 120 // there may be no in-memory database.
121 virtual void SetInMemoryBackend( 121 virtual void SetInMemoryBackend(
122 scoped_ptr<InMemoryHistoryBackend> backend) = 0; 122 scoped_ptr<InMemoryHistoryBackend> backend) = 0;
123 123
124 // Notify HistoryService that some URLs favicon changed that will forward 124 // Notify HistoryService that the favicons for the given page URLs (e.g.
125 // the events to the FaviconChangedObservers in the correct thread. 125 // http://www.google.com) and the given icon URL (e.g.
126 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; 126 // http://www.google.com/favicon.ico) have changed. HistoryService notifies
127 // any registered callbacks. It is valid to call NotifyFaviconsChanged()
128 // with non-empty |page_urls| and an empty |icon_url| and vice versa.
129 virtual void NotifyFaviconsChanged(const std::set<GURL>& page_urls,
130 const GURL& icon_url) = 0;
127 131
128 // Notify HistoryService that the user is visiting an URL. The event will 132 // Notify HistoryService that the user is visiting an URL. The event will
129 // be forwarded to the HistoryServiceObservers in the correct thread. 133 // be forwarded to the HistoryServiceObservers in the correct thread.
130 virtual void NotifyURLVisited(ui::PageTransition transition, 134 virtual void NotifyURLVisited(ui::PageTransition transition,
131 const URLRow& row, 135 const URLRow& row,
132 const RedirectList& redirects, 136 const RedirectList& redirects,
133 base::Time visit_time) = 0; 137 base::Time visit_time) = 0;
134 138
135 // Notify HistoryService that some URLs have been modified. The event will 139 // Notify HistoryService that some URLs have been modified. The event will
136 // be forwarded to the HistoryServiceObservers in the correct thread. 140 // be forwarded to the HistoryServiceObservers in the correct thread.
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); 505 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB);
502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); 506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB);
503 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); 507 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage);
504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
505 MergeFaviconIconURLMappedToDifferentPageURL); 509 MergeFaviconIconURLMappedToDifferentPageURL);
506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 510 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
507 MergeFaviconMaxFaviconBitmapsPerIconURL); 511 MergeFaviconMaxFaviconBitmapsPerIconURL);
508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
509 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); 513 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime);
510 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 514 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
515 FaviconChangedNotificationNewFavicon);
516 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
517 FaviconChangedNotificationBitmapDataChanged);
518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
519 FaviconChangedNotificationIconMappingChanged);
520 FRIEND_TEST_ALL_PREFIXES(
521 HistoryBackendTest,
522 FaviconChangedNotificationIconMappingAndBitmapDataChanged);
523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
524 FaviconChangedNotificationsMergeCopy);
525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, NoFaviconChangedNotifications);
526 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
511 UpdateFaviconMappingsAndFetchMultipleIconTypes); 527 UpdateFaviconMappingsAndFetchMultipleIconTypes);
512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); 528 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty);
513 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 529 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
514 GetFaviconsFromDBNoFaviconBitmaps); 530 GetFaviconsFromDBNoFaviconBitmaps);
515 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 531 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
516 GetFaviconsFromDBSelectClosestMatch); 532 GetFaviconsFromDBSelectClosestMatch);
517 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); 533 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType);
518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); 534 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired);
519 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 535 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
520 UpdateFaviconMappingsAndFetchNoDB); 536 UpdateFaviconMappingsAndFetchNoDB);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 const GURL& page_url, 731 const GURL& page_url,
716 favicon_base::IconType icon_type, 732 favicon_base::IconType icon_type,
717 const std::vector<favicon_base::FaviconID>& icon_ids); 733 const std::vector<favicon_base::FaviconID>& icon_ids);
718 734
719 // Returns all the page URLs in the redirect chain for |page_url|. If there 735 // Returns all the page URLs in the redirect chain for |page_url|. If there
720 // are no known redirects for |page_url|, returns a vector with |page_url|. 736 // are no known redirects for |page_url|, returns a vector with |page_url|.
721 void GetCachedRecentRedirects(const GURL& page_url, 737 void GetCachedRecentRedirects(const GURL& page_url,
722 RedirectList* redirect_list); 738 RedirectList* redirect_list);
723 739
724 // Send notification that the favicon has changed for |page_url| and all its 740 // Send notification that the favicon has changed for |page_url| and all its
725 // redirects. 741 // redirects. This should be called if the mapping between the page URL
742 // (e.g. http://www.google.com) and the icon URL (e.g.
743 // http://www.google.com/favicon.ico) has changed.
726 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); 744 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url);
727 745
746 // Send notification that the bitmap data for the favicon at |icon_url| has
747 // changed. Sending this notification is important because the favicon at
748 // |icon_url| may be mapped to hundreds of page URLs.
749 void SendFaviconChangedNotificationForIconURL(const GURL& icon_url);
750
728 // Generic stuff ------------------------------------------------------------- 751 // Generic stuff -------------------------------------------------------------
729 752
730 // Processes the next scheduled HistoryDBTask, scheduling this method 753 // Processes the next scheduled HistoryDBTask, scheduling this method
731 // to be invoked again if there are more tasks that need to run. 754 // to be invoked again if there are more tasks that need to run.
732 void ProcessDBTaskImpl(); 755 void ProcessDBTaskImpl();
733 756
734 // HistoryBackendNotifier: 757 // HistoryBackendNotifier:
735 void NotifyFaviconChanged(const std::set<GURL>& urls) override; 758 void NotifyFaviconsChanged(const std::set<GURL>& page_urls,
759 const GURL& icon_url) override;
736 void NotifyURLVisited(ui::PageTransition transition, 760 void NotifyURLVisited(ui::PageTransition transition,
737 const URLRow& row, 761 const URLRow& row,
738 const RedirectList& redirects, 762 const RedirectList& redirects,
739 base::Time visit_time) override; 763 base::Time visit_time) override;
740 void NotifyURLsModified(const URLRows& rows) override; 764 void NotifyURLsModified(const URLRows& rows) override;
741 void NotifyURLsDeleted(bool all_history, 765 void NotifyURLsDeleted(bool all_history,
742 bool expired, 766 bool expired,
743 const URLRows& rows, 767 const URLRows& rows,
744 const std::set<GURL>& favicon_urls) override; 768 const std::set<GURL>& favicon_urls) override;
745 769
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 873
850 // List of observers 874 // List of observers
851 base::ObserverList<HistoryBackendObserver> observers_; 875 base::ObserverList<HistoryBackendObserver> observers_;
852 876
853 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 877 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
854 }; 878 };
855 879
856 } // namespace history 880 } // namespace history
857 881
858 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 882 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « components/history/core/browser/expire_history_backend_unittest.cc ('k') | components/history/core/browser/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698