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

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, 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Sets the in-memory history backend. The in-memory backend is created by 113 // Sets the in-memory history backend. The in-memory backend is created by
114 // the main backend. For non-unit tests, this happens on the background 114 // the main backend. For non-unit tests, this happens on the background
115 // thread. It is to be used on the main thread, so this would transfer 115 // thread. It is to be used on the main thread, so this would transfer
116 // it to the history service. Unit tests can override this behavior. 116 // it to the history service. Unit tests can override this behavior.
117 // 117 //
118 // This function is NOT guaranteed to be called. If there is an error, 118 // This function is NOT guaranteed to be called. If there is an error,
119 // there may be no in-memory database. 119 // there may be no in-memory database.
120 virtual void SetInMemoryBackend( 120 virtual void SetInMemoryBackend(
121 scoped_ptr<InMemoryHistoryBackend> backend) = 0; 121 scoped_ptr<InMemoryHistoryBackend> backend) = 0;
122 122
123 // Notify HistoryService that some URLs favicon changed that will forward 123 // Notify HistoryService that the favicons for the given page URLs (e.g.
124 // the events to the FaviconChangedObservers in the correct thread. 124 // http://www.google.com) and the given icon URLs (e.g.
125 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; 125 // http://www.google.com/favicon.ico) have changed. HistoryService notifies
126 // any registered callbacks.
127 virtual void NotifyFaviconsChanged(const std::vector<GURL>& page_urls,
128 const std::vector<GURL>& icon_urls) = 0;
126 129
127 // Notify HistoryService that the user is visiting an URL. The event will 130 // Notify HistoryService that the user is visiting an URL. The event will
128 // be forwarded to the HistoryServiceObservers in the correct thread. 131 // be forwarded to the HistoryServiceObservers in the correct thread.
129 virtual void NotifyURLVisited(ui::PageTransition transition, 132 virtual void NotifyURLVisited(ui::PageTransition transition,
130 const URLRow& row, 133 const URLRow& row,
131 const RedirectList& redirects, 134 const RedirectList& redirects,
132 base::Time visit_time) = 0; 135 base::Time visit_time) = 0;
133 136
134 // Notify HistoryService that some URLs have been modified. The event will 137 // Notify HistoryService that some URLs have been modified. The event will
135 // be forwarded to the HistoryServiceObservers in the correct thread. 138 // be forwarded to the HistoryServiceObservers in the correct thread.
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB); 497 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLNotInDB);
495 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB); 498 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconPageURLInDB);
496 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage); 499 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, MergeFaviconMaxFaviconsPerPage);
497 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 500 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
498 MergeFaviconIconURLMappedToDifferentPageURL); 501 MergeFaviconIconURLMappedToDifferentPageURL);
499 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 502 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
500 MergeFaviconMaxFaviconBitmapsPerIconURL); 503 MergeFaviconMaxFaviconBitmapsPerIconURL);
501 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 504 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
502 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime); 505 MergeIdenticalFaviconDoesNotChangeLastUpdatedTime);
503 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
507 FaviconChangedNotificationNewFavicon);
508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
509 FaviconChangedNotificationBitmapDataChanged);
510 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
511 FaviconChangedNotificationIconMappingChanged);
512 FRIEND_TEST_ALL_PREFIXES(
513 HistoryBackendTest,
514 FaviconChangedNotificationIconMappingAndBitmapDataChanged);
515 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
516 FaviconChangedNotificationsMergeCopy);
517 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, NoFaviconChangedNotifications);
518 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
504 UpdateFaviconMappingsAndFetchMultipleIconTypes); 519 UpdateFaviconMappingsAndFetchMultipleIconTypes);
505 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty); 520 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBEmpty);
506 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 521 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
507 GetFaviconsFromDBNoFaviconBitmaps); 522 GetFaviconsFromDBNoFaviconBitmaps);
508 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 523 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
509 GetFaviconsFromDBSelectClosestMatch); 524 GetFaviconsFromDBSelectClosestMatch);
510 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); 525 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType);
511 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); 526 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired);
512 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 527 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
513 UpdateFaviconMappingsAndFetchNoDB); 528 UpdateFaviconMappingsAndFetchNoDB);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 const GURL& page_url, 714 const GURL& page_url,
700 favicon_base::IconType icon_type, 715 favicon_base::IconType icon_type,
701 const std::vector<favicon_base::FaviconID>& icon_ids); 716 const std::vector<favicon_base::FaviconID>& icon_ids);
702 717
703 // Returns all the page URLs in the redirect chain for |page_url|. If there 718 // Returns all the page URLs in the redirect chain for |page_url|. If there
704 // are no known redirects for |page_url|, returns a vector with |page_url|. 719 // are no known redirects for |page_url|, returns a vector with |page_url|.
705 void GetCachedRecentRedirects(const GURL& page_url, 720 void GetCachedRecentRedirects(const GURL& page_url,
706 RedirectList* redirect_list); 721 RedirectList* redirect_list);
707 722
708 // Send notification that the favicon has changed for |page_url| and all its 723 // Send notification that the favicon has changed for |page_url| and all its
709 // redirects. 724 // redirects. This should be called if the mapping between the page URL
725 // (e.g. http://www.google.com) and the icon URL (e.g.
726 // http://www.google.com/favicon.ico) has changed.
710 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url); 727 void SendFaviconChangedNotificationForPageAndRedirects(const GURL& page_url);
711 728
729 // Send notification that the bitmap data for the favicon at |icon_url| has
730 // changed. Sending this notification is important because the favicon at
731 // |icon_url| may be mapped to hundreds of page URLs.
732 void SendFaviconChangedNotificationForIconURL(const GURL& icon_url);
733
712 // Generic stuff ------------------------------------------------------------- 734 // Generic stuff -------------------------------------------------------------
713 735
714 // Processes the next scheduled HistoryDBTask, scheduling this method 736 // Processes the next scheduled HistoryDBTask, scheduling this method
715 // to be invoked again if there are more tasks that need to run. 737 // to be invoked again if there are more tasks that need to run.
716 void ProcessDBTaskImpl(); 738 void ProcessDBTaskImpl();
717 739
718 // HistoryBackendNotifier: 740 // HistoryBackendNotifier:
719 void NotifyFaviconChanged(const std::set<GURL>& urls) override; 741 void NotifyFaviconsChanged(const std::vector<GURL>& page_urls,
742 const std::vector<GURL>& icon_urls) override;
720 void NotifyURLVisited(ui::PageTransition transition, 743 void NotifyURLVisited(ui::PageTransition transition,
721 const URLRow& row, 744 const URLRow& row,
722 const RedirectList& redirects, 745 const RedirectList& redirects,
723 base::Time visit_time) override; 746 base::Time visit_time) override;
724 void NotifyURLsModified(const URLRows& rows) override; 747 void NotifyURLsModified(const URLRows& rows) override;
725 void NotifyURLsDeleted(bool all_history, 748 void NotifyURLsDeleted(bool all_history,
726 bool expired, 749 bool expired,
727 const URLRows& rows, 750 const URLRows& rows,
728 const std::set<GURL>& favicon_urls) override; 751 const std::set<GURL>& favicon_urls) override;
729 752
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 857
835 // List of observers 858 // List of observers
836 base::ObserverList<HistoryBackendObserver> observers_; 859 base::ObserverList<HistoryBackendObserver> observers_;
837 860
838 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 861 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
839 }; 862 };
840 863
841 } // namespace history 864 } // namespace history
842 865
843 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 866 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698